@@ -16,9 +16,9 @@ |
||
| 16 | 16 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * The composer autoloader |
|
| 21 | - */ |
|
| 19 | + /** |
|
| 20 | + * The composer autoloader |
|
| 21 | + */ |
|
| 22 | 22 | require_once $autoload; |
| 23 | 23 | |
| 24 | 24 | // the folder in which the localization .ini files are stored |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | abstract class Localization_Event |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var array |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var array |
|
| 25 | + */ |
|
| 26 | 26 | protected $args; |
| 27 | 27 | |
| 28 | 28 | public function __construct(array $args) |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | $this->args = $args; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Fetches the argument at the specified index in the |
|
| 35 | - * event's arguments list, if it exists. |
|
| 36 | - * |
|
| 37 | - * @param int $index Zero-based index number. |
|
| 38 | - * @return mixed|NULL |
|
| 39 | - */ |
|
| 33 | + /** |
|
| 34 | + * Fetches the argument at the specified index in the |
|
| 35 | + * event's arguments list, if it exists. |
|
| 36 | + * |
|
| 37 | + * @param int $index Zero-based index number. |
|
| 38 | + * @return mixed|NULL |
|
| 39 | + */ |
|
| 40 | 40 | public function getArgument(int $index) |
| 41 | 41 | { |
| 42 | 42 | if(isset($this->args[$index])) { |
@@ -6,9 +6,9 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Localization_Scanner_StringsCollection_Warning |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var array |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var array |
|
| 11 | + */ |
|
| 12 | 12 | protected $data; |
| 13 | 13 | |
| 14 | 14 | public function __construct(array $data) |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | const SERIALIZED_PROPERTIES = 'properties'; |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @var Localization_Scanner_StringsCollection |
|
| 16 | - */ |
|
| 15 | + * @var Localization_Scanner_StringsCollection |
|
| 16 | + */ |
|
| 17 | 17 | protected $collection; |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | const ERROR_UNSUPPORTED_FILE_EXTENSION = 40602; |
| 31 | 31 | const ERROR_INVALID_LANGUAGE_CLASS = 40603; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var Localization_Scanner |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var Localization_Scanner |
|
| 35 | + */ |
|
| 36 | 36 | protected $scanner; |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var Localization_Scanner_StringsCollection |
|
| 40 | - */ |
|
| 38 | + /** |
|
| 39 | + * @var Localization_Scanner_StringsCollection |
|
| 40 | + */ |
|
| 41 | 41 | protected $collection; |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | $this->collection = $scanner->getCollection(); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Parses a source file. Must have a valid supported file extension. |
|
| 59 | - * |
|
| 60 | - * @param string $path |
|
| 61 | - * @return Localization_Parser_Language |
|
| 62 | - * @throws Localization_Exception |
|
| 63 | - * |
|
| 64 | - * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
| 65 | - */ |
|
| 57 | + /** |
|
| 58 | + * Parses a source file. Must have a valid supported file extension. |
|
| 59 | + * |
|
| 60 | + * @param string $path |
|
| 61 | + * @return Localization_Parser_Language |
|
| 62 | + * @throws Localization_Exception |
|
| 63 | + * |
|
| 64 | + * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
| 65 | + */ |
|
| 66 | 66 | public function parseFile(string $path) : Localization_Parser_Language |
| 67 | 67 | { |
| 68 | 68 | $this->requireValidFile($path); |
@@ -76,16 +76,16 @@ discard block |
||
| 76 | 76 | return $language; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Parses the string for the specified language. |
|
| 81 | - * |
|
| 82 | - * @param string $languageID |
|
| 83 | - * @param string $code |
|
| 84 | - * @return Localization_Parser_Language |
|
| 85 | - * @throws Localization_Exception |
|
| 86 | - * |
|
| 87 | - * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
| 88 | - */ |
|
| 79 | + /** |
|
| 80 | + * Parses the string for the specified language. |
|
| 81 | + * |
|
| 82 | + * @param string $languageID |
|
| 83 | + * @param string $code |
|
| 84 | + * @return Localization_Parser_Language |
|
| 85 | + * @throws Localization_Exception |
|
| 86 | + * |
|
| 87 | + * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
| 88 | + */ |
|
| 89 | 89 | public function parseString(string $languageID, string $code) : Localization_Parser_Language |
| 90 | 90 | { |
| 91 | 91 | $this->requireValidLanguageID($languageID); |
@@ -144,18 +144,18 @@ discard block |
||
| 144 | 144 | ); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * Retrieves a list of all language IDs that are supported. |
|
| 149 | - * @return string[] IDs list like "PHP", "Javascript" |
|
| 150 | - */ |
|
| 147 | + /** |
|
| 148 | + * Retrieves a list of all language IDs that are supported. |
|
| 149 | + * @return string[] IDs list like "PHP", "Javascript" |
|
| 150 | + */ |
|
| 151 | 151 | public function getLanguageIDs() : array |
| 152 | 152 | { |
| 153 | 153 | return array_values($this->languageMappings); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * @var array<string,Localization_Parser_Language> |
|
| 158 | - */ |
|
| 156 | + /** |
|
| 157 | + * @var array<string,Localization_Parser_Language> |
|
| 158 | + */ |
|
| 159 | 159 | protected $languageParsers = array(); |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | ); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - /** |
|
| 213 | - * Whether the specified file extension is supported. |
|
| 214 | - * |
|
| 215 | - * @param string $ext |
|
| 216 | - * @return bool |
|
| 217 | - */ |
|
| 212 | + /** |
|
| 213 | + * Whether the specified file extension is supported. |
|
| 214 | + * |
|
| 215 | + * @param string $ext |
|
| 216 | + * @return bool |
|
| 217 | + */ |
|
| 218 | 218 | public function isExtensionSupported(string $ext) : bool |
| 219 | 219 | { |
| 220 | 220 | $ext = strtolower($ext); |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | protected $reverseStrings = array(); |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * @var Localization_Source[] |
|
| 61 | - */ |
|
| 60 | + * @var Localization_Source[] |
|
| 61 | + */ |
|
| 62 | 62 | private $sources = array(); |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | ); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * Retrieves all available strings for the specified locale, |
|
| 196 | - * as hash => text value pairs. |
|
| 197 | - * |
|
| 198 | - * @param Localization_Locale $locale |
|
| 199 | - * @throws Localization_Exception |
|
| 200 | - * @return string[] |
|
| 201 | - */ |
|
| 194 | + /** |
|
| 195 | + * Retrieves all available strings for the specified locale, |
|
| 196 | + * as hash => text value pairs. |
|
| 197 | + * |
|
| 198 | + * @param Localization_Locale $locale |
|
| 199 | + * @throws Localization_Exception |
|
| 200 | + * @return string[] |
|
| 201 | + */ |
|
| 202 | 202 | public function getStrings(Localization_Locale $locale) : array |
| 203 | 203 | { |
| 204 | 204 | $this->load($locale); |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | const ERROR_NO_CURRENT_LOCALE_SPECIFIED = 91401; |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * The locale that was used before the change, if any. |
|
| 29 | - * @return Localization_Locale|NULL |
|
| 30 | - */ |
|
| 28 | + * The locale that was used before the change, if any. |
|
| 29 | + * @return Localization_Locale|NULL |
|
| 30 | + */ |
|
| 31 | 31 | public function getPrevious() : ?Localization_Locale |
| 32 | 32 | { |
| 33 | 33 | $arg = $this->getArgument(1); |
@@ -59,28 +59,28 @@ discard block |
||
| 59 | 59 | ); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * The namespace in which the locale change occurred. |
|
| 64 | - * @return string |
|
| 65 | - */ |
|
| 62 | + /** |
|
| 63 | + * The namespace in which the locale change occurred. |
|
| 64 | + * @return string |
|
| 65 | + */ |
|
| 66 | 66 | public function getNamespace() : string |
| 67 | 67 | { |
| 68 | 68 | return strval($this->getArgument(0)); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Whether the change occurred for an application locale. |
|
| 73 | - * @return bool |
|
| 74 | - */ |
|
| 71 | + /** |
|
| 72 | + * Whether the change occurred for an application locale. |
|
| 73 | + * @return bool |
|
| 74 | + */ |
|
| 75 | 75 | public function isAppLocale() : bool |
| 76 | 76 | { |
| 77 | 77 | return $this->getNamespace() === Localization::NAMESPACE_APPLICATION; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Whether the change occurred for a content locale. |
|
| 82 | - * @return bool |
|
| 83 | - */ |
|
| 80 | + /** |
|
| 81 | + * Whether the change occurred for a content locale. |
|
| 82 | + * @return bool |
|
| 83 | + */ |
|
| 84 | 84 | public function isContentLocale() : bool |
| 85 | 85 | { |
| 86 | 86 | return $this->getNamespace() === Localization::NAMESPACE_CONTENT; |
@@ -24,24 +24,24 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class Localization_Scanner |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var float |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var float |
|
| 29 | + */ |
|
| 30 | 30 | protected $timeStart; |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var float |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @var float |
|
| 34 | + */ |
|
| 35 | 35 | protected $timeEnd; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var array |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var array |
|
| 39 | + */ |
|
| 40 | 40 | protected $stringInfos = array(); |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var string |
|
| 44 | - */ |
|
| 42 | + /** |
|
| 43 | + * @var string |
|
| 44 | + */ |
|
| 45 | 45 | protected $storageFile; |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -172,12 +172,12 @@ discard block |
||
| 172 | 172 | return $this->getCollection()->countWarnings(); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * Retrieves all warnings that have been registered |
|
| 177 | - * during the last search for translatable texts. |
|
| 178 | - * |
|
| 179 | - * @return Localization_Scanner_StringsCollection_Warning[] |
|
| 180 | - */ |
|
| 175 | + /** |
|
| 176 | + * Retrieves all warnings that have been registered |
|
| 177 | + * during the last search for translatable texts. |
|
| 178 | + * |
|
| 179 | + * @return Localization_Scanner_StringsCollection_Warning[] |
|
| 180 | + */ |
|
| 181 | 181 | public function getWarnings() : array |
| 182 | 182 | { |
| 183 | 183 | return $this->getCollection()->getWarnings(); |
@@ -20,29 +20,29 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Localization_Writer |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var boolean |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var boolean |
|
| 25 | + */ |
|
| 26 | 26 | private $editable = false; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var array<string,string> |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var array<string,string> |
|
| 30 | + */ |
|
| 31 | 31 | private $hashes = array(); |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var Localization_Locale |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var Localization_Locale |
|
| 35 | + */ |
|
| 36 | 36 | private $locale; |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var string |
|
| 40 | - */ |
|
| 38 | + /** |
|
| 39 | + * @var string |
|
| 40 | + */ |
|
| 41 | 41 | private $fileType; |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @var string |
|
| 45 | - */ |
|
| 43 | + /** |
|
| 44 | + * @var string |
|
| 45 | + */ |
|
| 46 | 46 | private $filePath; |
| 47 | 47 | |
| 48 | 48 | public function __construct(Localization_Locale $locale, string $fileType, string $filePath) |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | return $hashes; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Sort the strings to ensure they always appear in the same order: |
|
| 155 | - * first by text, and same strings by their hashes. This is important |
|
| 156 | - * for strings that have the same translation to avoid them changing |
|
| 157 | - * order between sorts. |
|
| 158 | - * |
|
| 159 | - * @param array $a |
|
| 160 | - * @param array $b |
|
| 161 | - * @return int |
|
| 162 | - */ |
|
| 153 | + /** |
|
| 154 | + * Sort the strings to ensure they always appear in the same order: |
|
| 155 | + * first by text, and same strings by their hashes. This is important |
|
| 156 | + * for strings that have the same translation to avoid them changing |
|
| 157 | + * order between sorts. |
|
| 158 | + * |
|
| 159 | + * @param array $a |
|
| 160 | + * @param array $b |
|
| 161 | + * @return int |
|
| 162 | + */ |
|
| 163 | 163 | public function callback_sortStrings(array $a, array $b) : int |
| 164 | 164 | { |
| 165 | 165 | $result = strnatcasecmp($a['text'], $b['text']); |