@@ -13,7 +13,7 @@ |
||
13 | 13 | $autoload = realpath($root.'/../vendor/autoload.php'); |
14 | 14 | |
15 | 15 | // we need the autoloader to be present |
16 | - if(!file_exists($autoload)) { |
|
16 | + if (!file_exists($autoload)) { |
|
17 | 17 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
18 | 18 | } |
19 | 19 |
@@ -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 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $autoload = realpath($root.'/../vendor/autoload.php'); |
18 | 18 | |
19 | 19 | // we need the autoloader to be present |
20 | - if($autoload === false) { |
|
20 | + if ($autoload === false) { |
|
21 | 21 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
22 | 22 | } |
23 | 23 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | $text = t('This text is in the global scope.'); |
4 | 4 | |
5 | 5 | $text2 = t( |
6 | - 'It is possible to write long texts ' . |
|
7 | - 'using text concatenation in the source ' . |
|
6 | + 'It is possible to write long texts '. |
|
7 | + 'using text concatenation in the source '. |
|
8 | 8 | 'code to keep it readable.' |
9 | 9 | ); |
10 | 10 | \ No newline at end of file |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function excludeFolder(string $folder) : Localization_Source_Folder |
51 | 51 | { |
52 | - if(!in_array($folder, $this->excludes['folders'])) { |
|
52 | + if (!in_array($folder, $this->excludes['folders'])) { |
|
53 | 53 | $this->excludes['folders'][] = $folder; |
54 | 54 | } |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function excludeFolders(array $folders) : Localization_Source_Folder |
60 | 60 | { |
61 | - foreach($folders as $folder) { |
|
61 | + foreach ($folders as $folder) { |
|
62 | 62 | $this->excludeFolder($folder); |
63 | 63 | } |
64 | 64 |
@@ -23,24 +23,24 @@ |
||
23 | 23 | */ |
24 | 24 | class Localization_Source_Folder extends Localization_Source |
25 | 25 | { |
26 | - /** |
|
27 | - * The folder under which all translatable files are kept. |
|
28 | - * @var string |
|
29 | - */ |
|
26 | + /** |
|
27 | + * The folder under which all translatable files are kept. |
|
28 | + * @var string |
|
29 | + */ |
|
30 | 30 | protected $sourcesFolder; |
31 | 31 | |
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | 35 | protected $id; |
36 | 36 | |
37 | - /** |
|
38 | - * @param string $alias An alias for this source, to recognize it by. |
|
39 | - * @param string $label The human-readable label, used in the editor. |
|
40 | - * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
41 | - * @param string $storageFolder The folder in which to store the localization files. |
|
42 | - * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
43 | - */ |
|
37 | + /** |
|
38 | + * @param string $alias An alias for this source, to recognize it by. |
|
39 | + * @param string $label The human-readable label, used in the editor. |
|
40 | + * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
41 | + * @param string $storageFolder The folder in which to store the localization files. |
|
42 | + * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
43 | + */ |
|
44 | 44 | public function __construct(string $alias, string $label, string $group, string $storageFolder, string $sourcesFolder) |
45 | 45 | { |
46 | 46 | parent::__construct($alias, $label, $group, $storageFolder); |
@@ -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])) { |
@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function getArgument(int $index) |
41 | 41 | { |
42 | - if(isset($this->args[$index])) { |
|
42 | + if (isset($this->args[$index])) { |
|
43 | 43 | return $this->args[$index]; |
44 | 44 | } |
45 | 45 |
@@ -9,12 +9,12 @@ |
||
9 | 9 | protected function parseDefinition() : void |
10 | 10 | { |
11 | 11 | // some entries are strings, like parenthesises, semicolons and the like. |
12 | - if(is_string($this->definition)) |
|
12 | + if (is_string($this->definition)) |
|
13 | 13 | { |
14 | 14 | $this->token = $this->definition; |
15 | 15 | $this->value = null; |
16 | 16 | |
17 | - if(isset($this->parentToken)) { |
|
17 | + if (isset($this->parentToken)) { |
|
18 | 18 | $this->line = $this->parentToken->getLine(); |
19 | 19 | } |
20 | 20 | } |
@@ -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) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | public function addHashes(array $hashes) : Localization_Writer |
70 | 70 | { |
71 | - foreach($hashes as $hash => $text) |
|
71 | + foreach ($hashes as $hash => $text) |
|
72 | 72 | { |
73 | 73 | $this->addHash($hash, $text); |
74 | 74 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $hashes = $this->compileHashes(); |
91 | 91 | $lines = array(); |
92 | 92 | |
93 | - foreach($hashes as $entry) |
|
93 | + foreach ($hashes as $entry) |
|
94 | 94 | { |
95 | 95 | $lines[] = sprintf( |
96 | 96 | '%s= "%s"', |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | |
107 | 107 | private function renderHead() : string |
108 | 108 | { |
109 | - $title = strtoupper($this->fileType).' TRANSLATION FILE FOR ' . strtoupper($this->locale->getLabel()); |
|
109 | + $title = strtoupper($this->fileType).' TRANSLATION FILE FOR '.strtoupper($this->locale->getLabel()); |
|
110 | 110 | |
111 | 111 | $lines = array(); |
112 | 112 | |
113 | 113 | $lines[] = '; -------------------------------------------------------'; |
114 | - $lines[] = '; '. $title; |
|
114 | + $lines[] = '; '.$title; |
|
115 | 115 | $lines[] = '; -------------------------------------------------------'; |
116 | 116 | $lines[] = '; '; |
117 | 117 | |
118 | - if($this->editable) |
|
118 | + if ($this->editable) |
|
119 | 119 | { |
120 | 120 | $lines[] = '; You may edit text directly in this file under the following conditions:'; |
121 | 121 | $lines[] = '; '; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | $hashes = array(); |
139 | 139 | |
140 | - foreach($this->hashes as $hash => $text) |
|
140 | + foreach ($this->hashes as $hash => $text) |
|
141 | 141 | { |
142 | 142 | $hashes[] = array( |
143 | 143 | 'hash' => $hash, |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | { |
165 | 165 | $result = strnatcasecmp($a['text'], $b['text']); |
166 | 166 | |
167 | - if($result === 0) |
|
167 | + if ($result === 0) |
|
168 | 168 | { |
169 | 169 | return strnatcmp($a['hash'], $b['hash']); |
170 | 170 | } |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Localization_Writer |
22 | 22 | { |
23 | - /** |
|
24 | - * @var array<string,string> |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var array<string,string> |
|
25 | + */ |
|
26 | 26 | private array $hashes = array(); |
27 | 27 | |
28 | 28 | private bool $editable = false; |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | return $hashes; |
139 | 139 | } |
140 | 140 | |
141 | - /** |
|
142 | - * Sort the strings to ensure they always appear in the same order: |
|
143 | - * first by text, and same strings by their hashes. This is important |
|
144 | - * for strings that have the same translation to avoid them changing |
|
145 | - * order between sorts. |
|
146 | - * |
|
147 | - * @param array $a |
|
148 | - * @param array $b |
|
149 | - * @return int |
|
150 | - */ |
|
141 | + /** |
|
142 | + * Sort the strings to ensure they always appear in the same order: |
|
143 | + * first by text, and same strings by their hashes. This is important |
|
144 | + * for strings that have the same translation to avoid them changing |
|
145 | + * order between sorts. |
|
146 | + * |
|
147 | + * @param array $a |
|
148 | + * @param array $b |
|
149 | + * @return int |
|
150 | + */ |
|
151 | 151 | public function callback_sortStrings(array $a, array $b) : int |
152 | 152 | { |
153 | 153 | $result = strnatcasecmp($a['text'], $b['text']); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | $ext = FileHelper::getExtension($path); |
105 | 105 | |
106 | - if($this->isExtensionSupported($ext)) { |
|
106 | + if ($this->isExtensionSupported($ext)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | $values = $this->getLanguageIDs(); |
128 | 128 | |
129 | - if(in_array($languageID, $values)) { |
|
129 | + if (in_array($languageID, $values)) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | $this->requireValidLanguageID($languageID); |
172 | 172 | |
173 | - if(!isset($this->languageParsers[$languageID])) |
|
173 | + if (!isset($this->languageParsers[$languageID])) |
|
174 | 174 | { |
175 | 175 | $this->languageParsers[$languageID] = $this->createLanguageInstance($languageID); |
176 | 176 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | $object = new $class($this); |
192 | 192 | |
193 | - if($object instanceof Localization_Parser_Language) |
|
193 | + if ($object instanceof Localization_Parser_Language) |
|
194 | 194 | { |
195 | 195 | return $object; |
196 | 196 | } |
@@ -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); |