@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | abstract class Localization_Parser_Token |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * @var array|string |
|
| 13 | - */ |
|
| 11 | + /** |
|
| 12 | + * @var array|string |
|
| 13 | + */ |
|
| 14 | 14 | protected $definition; |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @var Localization_Parser_Token |
|
| 18 | - */ |
|
| 16 | + /** |
|
| 17 | + * @var Localization_Parser_Token |
|
| 18 | + */ |
|
| 19 | 19 | protected $parentToken; |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -98,6 +98,6 @@ discard block |
||
| 98 | 98 | 'value' => $this->getValue(), |
| 99 | 99 | 'line' => $this->getLine(), |
| 100 | 100 | 'isEncapsedString' => ConvertHelper::bool2string($this->isEncapsedString()) |
| 101 | - ); |
|
| 101 | + ); |
|
| 102 | 102 | } |
| 103 | 103 | } |
@@ -23,49 +23,49 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | protected $parser; |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * The function names that are included in the search. |
|
| 28 | - * @var array |
|
| 29 | - */ |
|
| 26 | + /** |
|
| 27 | + * The function names that are included in the search. |
|
| 28 | + * @var array |
|
| 29 | + */ |
|
| 30 | 30 | protected $functionNames = array(); |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * The tokens definitions. |
|
| 34 | - * @var array |
|
| 35 | - */ |
|
| 32 | + /** |
|
| 33 | + * The tokens definitions. |
|
| 34 | + * @var array |
|
| 35 | + */ |
|
| 36 | 36 | protected $tokens = array(); |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * The total amount of tokens found in the content. |
|
| 40 | - * @var integer |
|
| 41 | - */ |
|
| 38 | + /** |
|
| 39 | + * The total amount of tokens found in the content. |
|
| 40 | + * @var integer |
|
| 41 | + */ |
|
| 42 | 42 | protected $totalTokens = 0; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * All texts that have been collected. |
|
| 46 | - * @var Text[] |
|
| 47 | - */ |
|
| 44 | + /** |
|
| 45 | + * All texts that have been collected. |
|
| 46 | + * @var Text[] |
|
| 47 | + */ |
|
| 48 | 48 | protected $texts = array(); |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | 53 | protected $content = ''; |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var string|NULL |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * @var string|NULL |
|
| 57 | + */ |
|
| 58 | 58 | protected $id; |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var Localization_Parser_Warning[] |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * @var Localization_Parser_Warning[] |
|
| 62 | + */ |
|
| 63 | 63 | protected $warnings = array(); |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * The source file that was parsed (if any) |
|
| 67 | - * @var string |
|
| 68 | - */ |
|
| 65 | + /** |
|
| 66 | + * The source file that was parsed (if any) |
|
| 67 | + * @var string |
|
| 68 | + */ |
|
| 69 | 69 | protected $sourceFile = ''; |
| 70 | 70 | |
| 71 | 71 | public function __construct(Localization_Parser $parser) |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | abstract protected function getTokens() : array; |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Retrieves the ID of the language. |
|
| 81 | - * @return string E.g. "PHP", "Javascript" |
|
| 82 | - */ |
|
| 79 | + /** |
|
| 80 | + * Retrieves the ID of the language. |
|
| 81 | + * @return string E.g. "PHP", "Javascript" |
|
| 82 | + */ |
|
| 83 | 83 | public function getID() : string |
| 84 | 84 | { |
| 85 | 85 | if(!isset($this->id)) { |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | return $this->sourceFile; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Parses the code from a file. |
|
| 104 | - * |
|
| 105 | - * @param string $path |
|
| 106 | - * @throws Localization_Exception |
|
| 107 | - */ |
|
| 102 | + /** |
|
| 103 | + * Parses the code from a file. |
|
| 104 | + * |
|
| 105 | + * @param string $path |
|
| 106 | + * @throws Localization_Exception |
|
| 107 | + */ |
|
| 108 | 108 | public function parseFile(string $path) : void |
| 109 | 109 | { |
| 110 | 110 | if(!file_exists($path)) |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | $this->parse(); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Parses a source code string. |
|
| 146 | - * @param string $content |
|
| 147 | - */ |
|
| 144 | + /** |
|
| 145 | + * Parses a source code string. |
|
| 146 | + * @param string $content |
|
| 147 | + */ |
|
| 148 | 148 | public function parseString(string $content) : void |
| 149 | 149 | { |
| 150 | 150 | $this->content = $content; |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | $this->texts[] = new Text($text, $line, $explanation); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * Retrieves a list of all the function names that are |
|
| 190 | - * used as translation functions in the language. |
|
| 191 | - * @return array |
|
| 192 | - */ |
|
| 188 | + /** |
|
| 189 | + * Retrieves a list of all the function names that are |
|
| 190 | + * used as translation functions in the language. |
|
| 191 | + * @return array |
|
| 192 | + */ |
|
| 193 | 193 | public function getFunctionNames() : array |
| 194 | 194 | { |
| 195 | 195 | return $this->createToken('dummy')->getFunctionNames(); |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | Localization::log(sprintf('%1$s parser | %2$s', $this->getID(), $message)); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Adds a warning message when a text cannot be parsed correctly for some reason. |
|
| 205 | - * |
|
| 206 | - * @param Localization_Parser_Token $token |
|
| 207 | - * @param string $message |
|
| 208 | - * @return Localization_Parser_Warning |
|
| 209 | - */ |
|
| 203 | + /** |
|
| 204 | + * Adds a warning message when a text cannot be parsed correctly for some reason. |
|
| 205 | + * |
|
| 206 | + * @param Localization_Parser_Token $token |
|
| 207 | + * @param string $message |
|
| 208 | + * @return Localization_Parser_Warning |
|
| 209 | + */ |
|
| 210 | 210 | protected function addWarning(Localization_Parser_Token $token, string $message) : Localization_Parser_Warning |
| 211 | 211 | { |
| 212 | 212 | $warning = new Localization_Parser_Warning($this, $token, $message); |
@@ -216,34 +216,34 @@ discard block |
||
| 216 | 216 | return $warning; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - /** |
|
| 220 | - * Whether any warnings were generated during parsing. |
|
| 221 | - * @return bool |
|
| 222 | - */ |
|
| 219 | + /** |
|
| 220 | + * Whether any warnings were generated during parsing. |
|
| 221 | + * @return bool |
|
| 222 | + */ |
|
| 223 | 223 | public function hasWarnings() : bool |
| 224 | 224 | { |
| 225 | 225 | return !empty($this->warnings); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - /** |
|
| 229 | - * Retrieves all warnings that were generated during parsing, |
|
| 230 | - * if any. |
|
| 231 | - * |
|
| 232 | - * @return Localization_Parser_Warning[] |
|
| 233 | - */ |
|
| 228 | + /** |
|
| 229 | + * Retrieves all warnings that were generated during parsing, |
|
| 230 | + * if any. |
|
| 231 | + * |
|
| 232 | + * @return Localization_Parser_Warning[] |
|
| 233 | + */ |
|
| 234 | 234 | public function getWarnings() : array |
| 235 | 235 | { |
| 236 | 236 | return $this->warnings; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - /** |
|
| 240 | - * Creates a token instance: this retrieves information on |
|
| 241 | - * the language token being parsed. |
|
| 242 | - * |
|
| 243 | - * @param array|string $definition The token definition. |
|
| 244 | - * @param Localization_Parser_Token|NULL $parentToken |
|
| 245 | - * @return Localization_Parser_Token |
|
| 246 | - */ |
|
| 239 | + /** |
|
| 240 | + * Creates a token instance: this retrieves information on |
|
| 241 | + * the language token being parsed. |
|
| 242 | + * |
|
| 243 | + * @param array|string $definition The token definition. |
|
| 244 | + * @param Localization_Parser_Token|NULL $parentToken |
|
| 245 | + * @return Localization_Parser_Token |
|
| 246 | + */ |
|
| 247 | 247 | protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token |
| 248 | 248 | { |
| 249 | 249 | $class = Localization_Parser_Token::class.'_'.$this->getID(); |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | return new $class($definition, $parentToken); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - /** |
|
| 255 | - * Parses a translation function token. |
|
| 256 | - * |
|
| 257 | - * @param int $number |
|
| 258 | - * @param Localization_Parser_Token $token |
|
| 259 | - */ |
|
| 254 | + /** |
|
| 255 | + * Parses a translation function token. |
|
| 256 | + * |
|
| 257 | + * @param int $number |
|
| 258 | + * @param Localization_Parser_Token $token |
|
| 259 | + */ |
|
| 260 | 260 | protected function parseToken(int $number, Localization_Parser_Token $token) : void |
| 261 | 261 | { |
| 262 | 262 | $textParts = array(); |
@@ -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']); |
@@ -12,19 +12,19 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | const STORAGE_FORMAT_VERSION = 2; |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @var Localization_Scanner |
|
| 17 | - */ |
|
| 15 | + /** |
|
| 16 | + * @var Localization_Scanner |
|
| 17 | + */ |
|
| 18 | 18 | protected $scanner; |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var Localization_Scanner_StringHash[] |
|
| 22 | - */ |
|
| 20 | + /** |
|
| 21 | + * @var Localization_Scanner_StringHash[] |
|
| 22 | + */ |
|
| 23 | 23 | protected $hashes = array(); |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var array |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var array |
|
| 27 | + */ |
|
| 28 | 28 | protected $warnings = array(); |
| 29 | 29 | |
| 30 | 30 | public function __construct(Localization_Scanner $scanner) |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | return new Localization_Scanner_StringInfo($this, $sourceID, $sourceType, $text); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Adds a single translatable string. |
|
| 57 | - * |
|
| 58 | - * @param Localization_Scanner_StringInfo $string |
|
| 59 | - * @return Localization_Scanner_StringsCollection |
|
| 60 | - */ |
|
| 55 | + /** |
|
| 56 | + * Adds a single translatable string. |
|
| 57 | + * |
|
| 58 | + * @param Localization_Scanner_StringInfo $string |
|
| 59 | + * @return Localization_Scanner_StringsCollection |
|
| 60 | + */ |
|
| 61 | 61 | protected function add(Localization_Scanner_StringInfo $string) : Localization_Scanner_StringsCollection |
| 62 | 62 | { |
| 63 | 63 | $hash = $string->getHash(); |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Retrieves all available translatable strings, |
|
| 75 | - * grouped by their hash to identify unique strings. |
|
| 76 | - * |
|
| 77 | - * @return Localization_Scanner_StringHash[] |
|
| 78 | - */ |
|
| 73 | + /** |
|
| 74 | + * Retrieves all available translatable strings, |
|
| 75 | + * grouped by their hash to identify unique strings. |
|
| 76 | + * |
|
| 77 | + * @return Localization_Scanner_StringHash[] |
|
| 78 | + */ |
|
| 79 | 79 | public function getHashes() : array |
| 80 | 80 | { |
| 81 | 81 | return array_values($this->hashes); |
@@ -146,32 +146,32 @@ discard block |
||
| 146 | 146 | return true; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - /** |
|
| 150 | - * Whether the parser reported warnings during the |
|
| 151 | - * search for translatable texts. |
|
| 152 | - * |
|
| 153 | - * @return bool |
|
| 154 | - */ |
|
| 149 | + /** |
|
| 150 | + * Whether the parser reported warnings during the |
|
| 151 | + * search for translatable texts. |
|
| 152 | + * |
|
| 153 | + * @return bool |
|
| 154 | + */ |
|
| 155 | 155 | public function hasWarnings() : bool |
| 156 | 156 | { |
| 157 | 157 | return !empty($this->warnings); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - /** |
|
| 161 | - * Retrieves the amount of warnings. |
|
| 162 | - * @return int |
|
| 163 | - */ |
|
| 160 | + /** |
|
| 161 | + * Retrieves the amount of warnings. |
|
| 162 | + * @return int |
|
| 163 | + */ |
|
| 164 | 164 | public function countWarnings() : int |
| 165 | 165 | { |
| 166 | 166 | return count($this->warnings); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * Retrieves all warning messages that were added |
|
| 171 | - * during the search for translatable texts, if any. |
|
| 172 | - * |
|
| 173 | - * @return Localization_Scanner_StringsCollection_Warning[] |
|
| 174 | - */ |
|
| 169 | + /** |
|
| 170 | + * Retrieves all warning messages that were added |
|
| 171 | + * during the search for translatable texts, if any. |
|
| 172 | + * |
|
| 173 | + * @return Localization_Scanner_StringsCollection_Warning[] |
|
| 174 | + */ |
|
| 175 | 175 | public function getWarnings() : array |
| 176 | 176 | { |
| 177 | 177 | $result = array(); |
@@ -198,12 +198,12 @@ discard block |
||
| 198 | 198 | return $amount; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - /** |
|
| 202 | - * Retrieves all string hashed for the specified source. |
|
| 203 | - * |
|
| 204 | - * @param string $id |
|
| 205 | - * @return Localization_Scanner_StringHash[] |
|
| 206 | - */ |
|
| 201 | + /** |
|
| 202 | + * Retrieves all string hashed for the specified source. |
|
| 203 | + * |
|
| 204 | + * @param string $id |
|
| 205 | + * @return Localization_Scanner_StringHash[] |
|
| 206 | + */ |
|
| 207 | 207 | public function getHashesBySourceID(string $id) : array |
| 208 | 208 | { |
| 209 | 209 | $hashes = array(); |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | return $hashes; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * Retrieves all hashes for the specified language ID. |
|
| 222 | - * |
|
| 223 | - * @param string $languageID The language ID, e.g. "PHP" |
|
| 224 | - * @return Localization_Scanner_StringHash[] |
|
| 225 | - */ |
|
| 220 | + /** |
|
| 221 | + * Retrieves all hashes for the specified language ID. |
|
| 222 | + * |
|
| 223 | + * @param string $languageID The language ID, e.g. "PHP" |
|
| 224 | + * @return Localization_Scanner_StringHash[] |
|
| 225 | + */ |
|
| 226 | 226 | public function getHashesByLanguageID(string $languageID) : array |
| 227 | 227 | { |
| 228 | 228 | $hashes = array(); |
@@ -15,19 +15,19 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class Localization_Scanner_StringHash |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * @var Localization_Scanner_StringsCollection |
|
| 20 | - */ |
|
| 18 | + /** |
|
| 19 | + * @var Localization_Scanner_StringsCollection |
|
| 20 | + */ |
|
| 21 | 21 | protected $collection; |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | 26 | protected $hash; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var Localization_Scanner_StringInfo[] |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var Localization_Scanner_StringInfo[] |
|
| 30 | + */ |
|
| 31 | 31 | protected $strings = array(); |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | return $entries; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Retrieves all individual string locations where this text was found. |
|
| 65 | - * @return Localization_Scanner_StringInfo[] |
|
| 66 | - */ |
|
| 63 | + /** |
|
| 64 | + * Retrieves all individual string locations where this text was found. |
|
| 65 | + * @return Localization_Scanner_StringInfo[] |
|
| 66 | + */ |
|
| 67 | 67 | public function getStrings() : array |
| 68 | 68 | { |
| 69 | 69 | return $this->strings; |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | return count($this->strings); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * Retrieves the translated text, if any. |
|
| 128 | - * @return string |
|
| 129 | - */ |
|
| 126 | + /** |
|
| 127 | + * Retrieves the translated text, if any. |
|
| 128 | + * @return string |
|
| 129 | + */ |
|
| 130 | 130 | public function getTranslatedText() : string |
| 131 | 131 | { |
| 132 | 132 | $translator = Localization::getTranslator(); |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | return ''; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - /** |
|
| 143 | - * Retrieves a list of all file names, with relative paths. |
|
| 144 | - * @return string[] |
|
| 145 | - */ |
|
| 142 | + /** |
|
| 143 | + * Retrieves a list of all file names, with relative paths. |
|
| 144 | + * @return string[] |
|
| 145 | + */ |
|
| 146 | 146 | public function getFiles() : array |
| 147 | 147 | { |
| 148 | 148 | $files = array(); |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | return $files; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Retrieves a list of all file names this string is used in. |
|
| 169 | - * @return string[] |
|
| 170 | - */ |
|
| 167 | + /** |
|
| 168 | + * Retrieves a list of all file names this string is used in. |
|
| 169 | + * @return string[] |
|
| 170 | + */ |
|
| 171 | 171 | public function getFileNames() : array |
| 172 | 172 | { |
| 173 | 173 | $files = $this->getFiles(); |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | return $result; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * Retrieves a text comprised of all strings that are relevant |
|
| 189 | - * for a full text search, imploded together. Used in the search |
|
| 190 | - * function to find matching strings. |
|
| 191 | - * |
|
| 192 | - * @return string |
|
| 193 | - */ |
|
| 187 | + /** |
|
| 188 | + * Retrieves a text comprised of all strings that are relevant |
|
| 189 | + * for a full text search, imploded together. Used in the search |
|
| 190 | + * function to find matching strings. |
|
| 191 | + * |
|
| 192 | + * @return string |
|
| 193 | + */ |
|
| 194 | 194 | public function getSearchString() : string |
| 195 | 195 | { |
| 196 | 196 | $parts = array($this->getTranslatedText(), $this->getText()); |
@@ -17,24 +17,24 @@ discard block |
||
| 17 | 17 | const FILES_LOCALES = 'locales'; |
| 18 | 18 | const FILES_CACHE_KEY = 'cachekey'; |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var bool |
|
| 22 | - */ |
|
| 20 | + /** |
|
| 21 | + * @var bool |
|
| 22 | + */ |
|
| 23 | 23 | protected $force = false; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var Localization_Translator |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var Localization_Translator |
|
| 27 | + */ |
|
| 28 | 28 | protected $translator; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var string |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var string |
|
| 32 | + */ |
|
| 33 | 33 | protected $targetFolder; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | 38 | protected $cacheKeyFile; |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | $this->writeCacheKey(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Retrieves a list of all localization client |
|
| 124 | - * files that are written to disk. This includes |
|
| 125 | - * the locale files and the libraries required |
|
| 126 | - * to make it work clientside. |
|
| 127 | - * |
|
| 128 | - * @return string[] |
|
| 129 | - */ |
|
| 122 | + /** |
|
| 123 | + * Retrieves a list of all localization client |
|
| 124 | + * files that are written to disk. This includes |
|
| 125 | + * the locale files and the libraries required |
|
| 126 | + * to make it work clientside. |
|
| 127 | + * |
|
| 128 | + * @return string[] |
|
| 129 | + */ |
|
| 130 | 130 | public function getFilesList() : array |
| 131 | 131 | { |
| 132 | 132 | $files = array(); |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | $this->written[self::FILES_LOCALES] = true; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * Generates the cache key file, which is used to determine |
|
| 284 | - * automatically whether the client libraries need to be |
|
| 285 | - * refreshed. |
|
| 286 | - */ |
|
| 282 | + /** |
|
| 283 | + * Generates the cache key file, which is used to determine |
|
| 284 | + * automatically whether the client libraries need to be |
|
| 285 | + * refreshed. |
|
| 286 | + */ |
|
| 287 | 287 | protected function writeCacheKey() : void |
| 288 | 288 | { |
| 289 | 289 | if(file_exists($this->cacheKeyFile) && !$this->force) { |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Localization_Editor_Filters |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var Localization_Editor |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var Localization_Editor |
|
| 28 | + */ |
|
| 29 | 29 | protected $editor; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var Request |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var Request |
|
| 33 | + */ |
|
| 34 | 34 | |
| 35 | 35 | protected $request; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | 40 | protected $sessionName = 'localize_filters'; |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var string[] |
|
| 44 | - */ |
|
| 42 | + /** |
|
| 43 | + * @var string[] |
|
| 44 | + */ |
|
| 45 | 45 | protected $vars = array( |
| 46 | 46 | 'resetfilter' => '', |
| 47 | 47 | 'filter' => '', |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | <form class="form-inline"> |
| 205 | 205 | <div class="form-hiddens"> |
| 206 | 206 | <?php |
| 207 | - $params = $this->editor->getRequestParams(); |
|
| 208 | - foreach($params as $name => $value) { |
|
| 209 | - ?> |
|
| 207 | + $params = $this->editor->getRequestParams(); |
|
| 208 | + foreach($params as $name => $value) { |
|
| 209 | + ?> |
|
| 210 | 210 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
| 211 | 211 | <?php |
| 212 | - } |
|
| 213 | - ?> |
|
| 212 | + } |
|
| 213 | + ?> |
|
| 214 | 214 | </div> |
| 215 | 215 | <div class="form-row"> |
| 216 | 216 | <div class="col-auto"> |
@@ -218,42 +218,42 @@ discard block |
||
| 218 | 218 | </div> |
| 219 | 219 | <div class="col-auto"> |
| 220 | 220 | <?php |
| 221 | - echo $this->renderSelect( |
|
| 222 | - $this->vars['status'], |
|
| 223 | - array( |
|
| 224 | - array( |
|
| 225 | - 'value' => '', |
|
| 226 | - 'label' => t('Status...') |
|
| 227 | - ), |
|
| 228 | - array( |
|
| 229 | - 'value' => 'untranslated', |
|
| 230 | - 'label' => t('Not translated') |
|
| 231 | - ), |
|
| 232 | - array( |
|
| 233 | - 'value' => 'translated', |
|
| 234 | - 'label' => t('Translated') |
|
| 235 | - ) |
|
| 236 | - ) |
|
| 237 | - ); |
|
| 221 | + echo $this->renderSelect( |
|
| 222 | + $this->vars['status'], |
|
| 223 | + array( |
|
| 224 | + array( |
|
| 225 | + 'value' => '', |
|
| 226 | + 'label' => t('Status...') |
|
| 227 | + ), |
|
| 228 | + array( |
|
| 229 | + 'value' => 'untranslated', |
|
| 230 | + 'label' => t('Not translated') |
|
| 231 | + ), |
|
| 232 | + array( |
|
| 233 | + 'value' => 'translated', |
|
| 234 | + 'label' => t('Translated') |
|
| 235 | + ) |
|
| 236 | + ) |
|
| 237 | + ); |
|
| 238 | 238 | |
| 239 | - echo $this->renderSelect( |
|
| 240 | - $this->vars['location'], |
|
| 241 | - array( |
|
| 242 | - array( |
|
| 243 | - 'value' => '', |
|
| 244 | - 'label' => t('Location...') |
|
| 245 | - ), |
|
| 246 | - array( |
|
| 247 | - 'value' => 'client', |
|
| 248 | - 'label' => t('Clientside') |
|
| 249 | - ), |
|
| 250 | - array( |
|
| 251 | - 'value' => 'server', |
|
| 252 | - 'label' => t('Serverside') |
|
| 253 | - ) |
|
| 254 | - ) |
|
| 255 | - ); |
|
| 256 | - ?> |
|
| 239 | + echo $this->renderSelect( |
|
| 240 | + $this->vars['location'], |
|
| 241 | + array( |
|
| 242 | + array( |
|
| 243 | + 'value' => '', |
|
| 244 | + 'label' => t('Location...') |
|
| 245 | + ), |
|
| 246 | + array( |
|
| 247 | + 'value' => 'client', |
|
| 248 | + 'label' => t('Clientside') |
|
| 249 | + ), |
|
| 250 | + array( |
|
| 251 | + 'value' => 'server', |
|
| 252 | + 'label' => t('Serverside') |
|
| 253 | + ) |
|
| 254 | + ) |
|
| 255 | + ); |
|
| 256 | + ?> |
|
| 257 | 257 | </div> |
| 258 | 258 | <div class="col-auto"> |
| 259 | 259 | <button type="submit" name="<?php echo $this->vars['filter'] ?>" value="yes" class="btn btn-primary mb-2" title="<?php pt('Filter the list with the selected criteria.') ?>" data-toggle="tooltip"> |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | </form> |
| 269 | 269 | <p> |
| 270 | 270 | <small class="text-muted"><?php |
| 271 | - pts('Hint:'); |
|
| 272 | - pt('Search works in translated and untranslated text, as well as the file name.') |
|
| 273 | - ?></small> |
|
| 271 | + pts('Hint:'); |
|
| 272 | + pt('Search works in translated and untranslated text, as well as the file name.') |
|
| 273 | + ?></small> |
|
| 274 | 274 | </p> |
| 275 | 275 | <br> |
| 276 | 276 | <?php |