1 | <?php |
||
49 | class Dictionary |
||
50 | { |
||
51 | /** |
||
52 | * The internal storage for the dictionary. |
||
53 | * |
||
54 | * @var array $dictionary |
||
55 | */ |
||
56 | private $dictionary = array(); |
||
57 | |||
58 | /** |
||
59 | * Where to look for the basic files. |
||
60 | * |
||
61 | * @var string $_fileLocation |
||
62 | */ |
||
63 | private static $fileLocation = ''; |
||
64 | |||
65 | /** |
||
66 | * Set the file-location. |
||
67 | * |
||
68 | * @param string $fileLocation THe default file-location for ini-files |
||
69 | * |
||
70 | * @return void |
||
71 | */ |
||
72 | public static function setFileLocation($fileLocation) |
||
76 | |||
77 | /** |
||
78 | * Create a new Instance of the Dictionary |
||
79 | * |
||
80 | * @return void |
||
|
|||
81 | */ |
||
82 | public function __construct() |
||
85 | |||
86 | /** |
||
87 | * Create an instance for a given file |
||
88 | * |
||
89 | * @param string $locale The locale to be set for this Dictionary |
||
90 | * |
||
91 | * @return Dictionary |
||
92 | */ |
||
93 | public static function factory($locale) |
||
100 | |||
101 | /** |
||
102 | * Load a given locale-file as base for the dictionary |
||
103 | * |
||
104 | * @param string $locale Load the file for the given locale |
||
105 | * |
||
106 | * @return Dictionary |
||
107 | */ |
||
108 | public function load($locale) |
||
122 | |||
123 | /** |
||
124 | * parse a dictionary-file to create an ini-file from it. |
||
125 | * |
||
126 | * @param string $locale Parse the file for the given locale |
||
127 | * |
||
128 | * @throws \Org\Heigl\Hyphenator\Exception\PathNotFoundException |
||
129 | * @return string |
||
130 | */ |
||
131 | public static function parseFile($locale) |
||
174 | |||
175 | /** |
||
176 | * Get all patterns for a given word. |
||
177 | * |
||
178 | * @param string $word The word to get the patterns for. |
||
179 | * |
||
180 | * @return array |
||
181 | */ |
||
182 | public function getPatternsForWord($word) |
||
199 | |||
200 | /** |
||
201 | * Manually add or overwrite a pattern |
||
202 | * |
||
203 | * @param string $string String to be maatched |
||
204 | * @param string $pattern Numerical hyphenation-pattern |
||
205 | * |
||
206 | * @return \Org\Heigl\Hyphenator\Dictionary\Dictionary |
||
207 | */ |
||
208 | public function addPAttern($string, $pattern) |
||
214 | |||
215 | /** |
||
216 | * Unify the given locale to a default format. |
||
217 | * |
||
218 | * For that in a 2 by 2 format the whole string is splited, the first part |
||
219 | * lowercased, the sewcond part upercased and concatenated with n under- |
||
220 | * score. |
||
221 | * |
||
222 | * a 2letter locae will simply be lowercased. |
||
223 | * |
||
224 | * everything else will be returned AS IS |
||
225 | * |
||
226 | * @param string $locale The locale to unify |
||
227 | * |
||
228 | * @return string |
||
229 | */ |
||
230 | private function unifyLocale($locale) |
||
241 | } |
||
242 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.