@@ -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 | |
@@ -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 |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $hash = $string->getHash(); |
| 63 | 63 | |
| 64 | - if(!isset($this->hashes[$hash])) { |
|
| 64 | + if (!isset($this->hashes[$hash])) { |
|
| 65 | 65 | $this->hashes[$hash] = new Localization_Scanner_StringHash($this, $hash); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function getHash($hash) |
| 89 | 89 | { |
| 90 | - if(isset($this->hashes[$hash])) { |
|
| 90 | + if (isset($this->hashes[$hash])) { |
|
| 91 | 91 | return $this->hashes[$hash]; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | 'warnings' => array() |
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - foreach($this->hashes as $hash) |
|
| 109 | + foreach ($this->hashes as $hash) |
|
| 110 | 110 | { |
| 111 | 111 | $data['hashes'] = array_merge($data['hashes'], $hash->toArray()); |
| 112 | 112 | } |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | public function fromArray($array) : bool |
| 120 | 120 | { |
| 121 | - if(!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) { |
|
| 121 | + if (!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) { |
|
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - foreach($array['hashes'] as $entry) |
|
| 125 | + foreach ($array['hashes'] as $entry) |
|
| 126 | 126 | { |
| 127 | 127 | $string = Localization_Scanner_StringInfo::fromArray($this, $entry); |
| 128 | 128 | $this->add($string); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $result = array(); |
| 165 | 165 | |
| 166 | - foreach($this->warnings as $def) { |
|
| 166 | + foreach ($this->warnings as $def) { |
|
| 167 | 167 | $result[] = new Localization_Scanner_StringsCollection_Warning($def); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | public function countFiles() : int |
| 179 | 179 | { |
| 180 | 180 | $amount = 0; |
| 181 | - foreach($this->hashes as $hash) { |
|
| 181 | + foreach ($this->hashes as $hash) { |
|
| 182 | 182 | $amount = $amount + $hash->countFiles(); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $hashes = array(); |
| 197 | 197 | |
| 198 | - foreach($this->hashes as $hash) { |
|
| 199 | - if($hash->hasSourceID($id)) { |
|
| 198 | + foreach ($this->hashes as $hash) { |
|
| 199 | + if ($hash->hasSourceID($id)) { |
|
| 200 | 200 | $hashes[] = $hash; |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | { |
| 215 | 215 | $hashes = array(); |
| 216 | 216 | |
| 217 | - foreach($this->hashes as $hash) { |
|
| 218 | - if($hash->hasLanguageType($languageID)) { |
|
| 217 | + foreach ($this->hashes as $hash) { |
|
| 218 | + if ($hash->hasLanguageType($languageID)) { |
|
| 219 | 219 | $hashes[] = $hash; |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function getProperty($name) |
| 76 | 76 | { |
| 77 | - if(isset($this->properties[$name])) { |
|
| 77 | + if (isset($this->properties[$name])) { |
|
| 78 | 78 | return $this->properties[$name]; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $array['line'] |
| 124 | 124 | ); |
| 125 | 125 | |
| 126 | - foreach($array['properties'] as $name => $value) { |
|
| 126 | + foreach ($array['properties'] as $name => $value) { |
|
| 127 | 127 | $string->setProperty($name, $value); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $entries = array(); |
| 50 | 50 | |
| 51 | - foreach($this->strings as $string) { |
|
| 51 | + foreach ($this->strings as $string) { |
|
| 52 | 52 | $entries[] = $string->toArray(); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $amount = 0; |
| 70 | 70 | |
| 71 | - foreach($this->strings as $string) { |
|
| 72 | - if($string->isFile()) { |
|
| 71 | + foreach ($this->strings as $string) { |
|
| 72 | + if ($string->isFile()) { |
|
| 73 | 73 | $amount++; |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function hasLanguageType(string $type) : bool |
| 86 | 86 | { |
| 87 | - foreach($this->strings as $string) { |
|
| 88 | - if($string->getLanguageType() == $type) { |
|
| 87 | + foreach ($this->strings as $string) { |
|
| 88 | + if ($string->getLanguageType() == $type) { |
|
| 89 | 89 | return true; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function getText() : string |
| 97 | 97 | { |
| 98 | - if(isset($this->strings[0])) { |
|
| 98 | + if (isset($this->strings[0])) { |
|
| 99 | 99 | return $this->strings[0]->getText(); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $translator = Localization::getTranslator(); |
| 128 | 128 | $text = $translator->getHashTranslation($this->getHash()); |
| 129 | 129 | |
| 130 | - if($text !== null) { |
|
| 130 | + if ($text !== null) { |
|
| 131 | 131 | return $text; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,14 +142,14 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | $files = array(); |
| 144 | 144 | |
| 145 | - foreach($this->strings as $string) |
|
| 145 | + foreach ($this->strings as $string) |
|
| 146 | 146 | { |
| 147 | - if(!$string->isFile()) { |
|
| 147 | + if (!$string->isFile()) { |
|
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $file = $string->getSourceFile(); |
| 152 | - if(!in_array($file, $files)) { |
|
| 152 | + if (!in_array($file, $files)) { |
|
| 153 | 153 | $files[] = $file; |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $files = $this->getFiles(); |
| 169 | 169 | $result = array(); |
| 170 | 170 | |
| 171 | - foreach($files as $path) { |
|
| 171 | + foreach ($files as $path) { |
|
| 172 | 172 | $result[] = basename($path); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -49,8 +49,8 @@ |
||
| 49 | 49 | $examples[] = '1.500'; |
| 50 | 50 | |
| 51 | 51 | if ($decimalPositions > 0) { |
| 52 | - $examples[] = '50,' . substr($decimals, 0, $decimalPositions); |
|
| 53 | - $examples[] = '1.500,' . substr($decimals, 0, $decimalPositions); |
|
| 52 | + $examples[] = '50,'.substr($decimals, 0, $decimalPositions); |
|
| 53 | + $examples[] = '1.500,'.substr($decimals, 0, $decimalPositions); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $examples; |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | protected function parseFile($file) |
| 96 | 96 | { |
| 97 | - $this->log(sprintf('Parsing file [' . $file . '].')); |
|
| 97 | + $this->log(sprintf('Parsing file ['.$file.'].')); |
|
| 98 | 98 | |
| 99 | 99 | $language = $this->parser->parseFile($file); |
| 100 | 100 | |
| 101 | 101 | $texts = $language->getTexts(); |
| 102 | 102 | |
| 103 | - foreach($texts as $def) |
|
| 103 | + foreach ($texts as $def) |
|
| 104 | 104 | { |
| 105 | 105 | $this->collection->addFromFile( |
| 106 | 106 | $this->getID(), |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $warnings = $language->getWarnings(); |
| 115 | 115 | |
| 116 | - foreach($warnings as $warning) { |
|
| 116 | + foreach ($warnings as $warning) { |
|
| 117 | 117 | $this->collection->addWarning($warning); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $amount = 0; |
| 141 | 141 | |
| 142 | 142 | $hashes = $this->getHashes($scanner); |
| 143 | - foreach($hashes as $hash) { |
|
| 143 | + foreach ($hashes as $hash) { |
|
| 144 | 144 | $text = $translator->getHashTranslation($hash->getHash()); |
| 145 | - if(empty($text)) { |
|
| 145 | + if (empty($text)) { |
|
| 146 | 146 | $amount++; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -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 | |
@@ -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 | |