Debian Codegraph @

vendor/wikimedia/equivset/src/EquivsetInterface.php

raw
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 */
18
19 namespace Wikimedia\Equivset;
20
21 use LogicException;
22
23 /**
24 * Equivset
25 */
26 interface EquivsetInterface {
27
28 /**
29 * Gets the equivset.
30 *
31 * @return array An associative array of equivalent characters.
32 */
33 public function all(): array;
34
35 /**
36 * Normalize a string.
37 *
38 * @param string $value The string to normalize against the equivset.
39 *
40 * @return string
41 */
42 public function normalize( string $value ): string;
43
44 /**
45 * Determine if the two strings are visually equal.
46 *
47 * @param string $str1 The first string.
48 * @param string $str2 The second string.
49 *
50 * @return bool
51 */
52 public function isEqual( string $str1, string $str2 ): bool;
53
54 /**
55 * Determine if an equivalent character exists.
56 *
57 * @param string $key The character that was used.
58 *
59 * @return bool If the character has an equivalent.
60 */
61 public function has( string $key ): bool;
62
63 /**
64 * Get an equivalent character.
65 *
66 * @param string $key The character that was used.
67 *
68 * @return string The equivalent character.
69 *
70 * @throws LogicException If character does not exist.
71 */
72 public function get( string $key ): string;
73 }