@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | $eport = 3306; |
17 | 17 | } |
18 | 18 | if (!empty($eport)) { |
19 | - $config['DB_HOST'] = env('DB_PORT_' . $eport . '_TCP_ADDR'); |
|
20 | - $config['DB_PORT'] = env('DB_PORT_' . $eport . '_TCP_PORT'); |
|
19 | + $config['DB_HOST'] = env('DB_PORT_'.$eport.'_TCP_ADDR'); |
|
20 | + $config['DB_PORT'] = env('DB_PORT_'.$eport.'_TCP_PORT'); |
|
21 | 21 | } elseif (getenv('DB_PORT') === false) { |
22 | 22 | error('The env DB_PORT does not exist. Make sure to run with "--link mypostgresinstance:DB"'); |
23 | 23 | } elseif (is_numeric(getenv('DB_PORT')) && getenv('DB_HOST') !== false) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $config['DB_TYPE'] = 'pgsql'; |
34 | 34 | break; |
35 | 35 | default: |
36 | - error('Database on non-standard port ' . $config['DB_PORT'] . ' and env DB_TYPE not present'); |
|
36 | + error('Database on non-standard port '.$config['DB_PORT'].' and env DB_TYPE not present'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $config['DB_USER'] = env('DB_USER', $config['DB_NAME']); |
46 | 46 | $config['DB_PASS'] = env('DB_PASS', $config['DB_USER']); |
47 | 47 | if (!dbcheck($config)) { |
48 | - echo 'Database login failed, trying to create...' . PHP_EOL; |
|
48 | + echo 'Database login failed, trying to create...'.PHP_EOL; |
|
49 | 49 | // superuser account to create new database and corresponding user account |
50 | 50 | // username (SU_USER) can be supplied or defaults to "docker" |
51 | 51 | // password (SU_PASS) can be supplied or defaults to username |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | $super['DB_PASS'] = env('DB_ENV_PASS', $super['DB_USER']); |
56 | 56 | $pdo = dbconnect($super); |
57 | 57 | if ($super['DB_TYPE'] === 'mysql') { |
58 | - $pdo->exec('CREATE DATABASE ' . ($config['DB_NAME'])); |
|
59 | - $pdo->exec('GRANT ALL PRIVILEGES ON ' . ($config['DB_NAME']) . '.* TO ' . $pdo->quote($config['DB_USER']) . '@"%" IDENTIFIED BY ' . $pdo->quote($config['DB_PASS'])); |
|
58 | + $pdo->exec('CREATE DATABASE '.($config['DB_NAME'])); |
|
59 | + $pdo->exec('GRANT ALL PRIVILEGES ON '.($config['DB_NAME']).'.* TO '.$pdo->quote($config['DB_USER']).'@"%" IDENTIFIED BY '.$pdo->quote($config['DB_PASS'])); |
|
60 | 60 | } else { |
61 | - $pdo->exec('CREATE ROLE ' . ($config['DB_USER']) . ' WITH LOGIN PASSWORD ' . $pdo->quote($config['DB_PASS'])); |
|
62 | - $pdo->exec('CREATE DATABASE ' . ($config['DB_NAME']) . ' WITH OWNER ' . ($config['DB_USER'])); |
|
61 | + $pdo->exec('CREATE ROLE '.($config['DB_USER']).' WITH LOGIN PASSWORD '.$pdo->quote($config['DB_PASS'])); |
|
62 | + $pdo->exec('CREATE DATABASE '.($config['DB_NAME']).' WITH OWNER '.($config['DB_USER'])); |
|
63 | 63 | } |
64 | 64 | unset($pdo); |
65 | 65 | if (dbcheck($config)) { |
66 | - echo 'Database login created and confirmed' . PHP_EOL; |
|
66 | + echo 'Database login created and confirmed'.PHP_EOL; |
|
67 | 67 | } else { |
68 | 68 | error('Database login failed, trying to create login failed as well'); |
69 | 69 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | // reached this point => table found, assume db is complete |
75 | 75 | } |
76 | 76 | catch (PDOException $e) { |
77 | - echo 'Database table not found, applying schema... ' . PHP_EOL; |
|
78 | - $schema = file_get_contents('schema/ttrss_schema_' . $config['DB_TYPE'] . '.sql'); |
|
77 | + echo 'Database table not found, applying schema... '.PHP_EOL; |
|
78 | + $schema = file_get_contents('schema/ttrss_schema_'.$config['DB_TYPE'].'.sql'); |
|
79 | 79 | $schema = preg_replace('/--(.*?);/', '', $schema); |
80 | 80 | $schema = preg_replace('/[\r\n]/', ' ', $schema); |
81 | 81 | $schema = trim($schema, ' ;'); |
@@ -88,35 +88,35 @@ discard block |
||
88 | 88 | foreach ($_SERVER as $name => $value) { |
89 | 89 | if (strpos($name, $config_prefix) === 0) { |
90 | 90 | $name = substr($name, strlen($config_prefix)); |
91 | - echo 'Getting config from env: ' . $name . PHP_EOL; |
|
91 | + echo 'Getting config from env: '.$name.PHP_EOL; |
|
92 | 92 | $config[$name] = $value; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | $contents = file_get_contents($confpath); |
96 | 96 | foreach ($config as $name => $value) { |
97 | - $contents = preg_replace('/(define\s*\(\'' . $name . '\',\s*)(.*)(\);)/', '$1"' . $value . '"$3', $contents); |
|
97 | + $contents = preg_replace('/(define\s*\(\''.$name.'\',\s*)(.*)(\);)/', '$1"'.$value.'"$3', $contents); |
|
98 | 98 | } |
99 | 99 | file_put_contents($confpath, $contents); |
100 | 100 | function env($name, $default = null) |
101 | 101 | { |
102 | 102 | $v = getenv($name) ?: $default; |
103 | 103 | if ($v === null) { |
104 | - error('The env ' . $name . ' does not exist'); |
|
104 | + error('The env '.$name.' does not exist'); |
|
105 | 105 | } |
106 | 106 | return $v; |
107 | 107 | } |
108 | 108 | function error($text) |
109 | 109 | { |
110 | - echo 'Error: ' . $text . PHP_EOL; |
|
110 | + echo 'Error: '.$text.PHP_EOL; |
|
111 | 111 | exit(1); |
112 | 112 | } |
113 | 113 | function dbconnect($config) |
114 | 114 | { |
115 | 115 | $map = array('host' => 'HOST', 'port' => 'PORT', 'dbname' => 'NAME'); |
116 | - $dsn = $config['DB_TYPE'] . ':'; |
|
116 | + $dsn = $config['DB_TYPE'].':'; |
|
117 | 117 | foreach ($map as $d => $h) { |
118 | - if (isset($config['DB_' . $h])) { |
|
119 | - $dsn .= $d . '=' . $config['DB_' . $h] . ';'; |
|
118 | + if (isset($config['DB_'.$h])) { |
|
119 | + $dsn .= $d.'='.$config['DB_'.$h].';'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | $pdo = new \PDO($dsn, $config['DB_USER'], $config['DB_PASS']); |
@@ -139,58 +139,7 @@ |
||
139 | 139 | private function getPluralizationRule(int $number, string $locale): int |
140 | 140 | { |
141 | 141 | switch ('pt_BR' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) { |
142 | - case 'af': |
|
143 | - case 'bn': |
|
144 | - case 'bg': |
|
145 | - case 'ca': |
|
146 | - case 'da': |
|
147 | - case 'de': |
|
148 | - case 'el': |
|
149 | - case 'en': |
|
150 | - case 'eo': |
|
151 | - case 'es': |
|
152 | - case 'et': |
|
153 | - case 'eu': |
|
154 | - case 'fa': |
|
155 | - case 'fi': |
|
156 | - case 'fo': |
|
157 | - case 'fur': |
|
158 | - case 'fy': |
|
159 | - case 'gl': |
|
160 | - case 'gu': |
|
161 | - case 'ha': |
|
162 | - case 'he': |
|
163 | - case 'hu': |
|
164 | - case 'is': |
|
165 | - case 'it': |
|
166 | - case 'ku': |
|
167 | - case 'lb': |
|
168 | - case 'ml': |
|
169 | - case 'mn': |
|
170 | - case 'mr': |
|
171 | - case 'nah': |
|
172 | - case 'nb': |
|
173 | - case 'ne': |
|
174 | - case 'nl': |
|
175 | - case 'nn': |
|
176 | - case 'no': |
|
177 | - case 'oc': |
|
178 | - case 'om': |
|
179 | - case 'or': |
|
180 | - case 'pa': |
|
181 | - case 'pap': |
|
182 | - case 'ps': |
|
183 | - case 'pt': |
|
184 | - case 'so': |
|
185 | - case 'sq': |
|
186 | - case 'sv': |
|
187 | - case 'sw': |
|
188 | - case 'ta': |
|
189 | - case 'te': |
|
190 | - case 'tk': |
|
191 | - case 'ur': |
|
192 | - case 'zu': |
|
193 | - return (1 == $number) ? 0 : 1; |
|
142 | + case 'af' : case 'bn' : case 'bg' : case 'ca' : case 'da' : case 'de' : case 'el' : case 'en' : case 'eo' : case 'es' : case 'et' : case 'eu' : case 'fa' : case 'fi' : case 'fo' : case 'fur' : case 'fy' : case 'gl' : case 'gu' : case 'ha' : case 'he' : case 'hu' : case 'is' : case 'it' : case 'ku' : case 'lb' : case 'ml' : case 'mn' : case 'mr' : case 'nah' : case 'nb' : case 'ne' : case 'nl' : case 'nn' : case 'no' : case 'oc' : case 'om' : case 'or' : case 'pa' : case 'pap' : case 'ps' : case 'pt' : case 'so' : case 'sq' : case 'sv' : case 'sw' : case 'ta' : case 'te' : case 'tk' : case 'ur' : case 'zu' : return (1 == $number) ? 0 : 1; |
|
194 | 143 | |
195 | 144 | case 'am': |
196 | 145 | case 'bh': |
@@ -72,7 +72,7 @@ |
||
72 | 72 | $translationFilePaths = findTranslationFiles($originalFilePath, $config['locale_to_analyze']); |
73 | 73 | $translationStatus = calculateTranslationStatus($originalFilePath, $translationFilePaths); |
74 | 74 | |
75 | - $totalMissingTranslations += array_sum(array_map(function ($translation) { |
|
75 | + $totalMissingTranslations += array_sum(array_map(function($translation) { |
|
76 | 76 | return count($translation['missingKeys']); |
77 | 77 | }, array_values($translationStatus))); |
78 | 78 |
@@ -278,7 +278,7 @@ |
||
278 | 278 | |
279 | 279 | $this->assertValidLocale($locale); |
280 | 280 | $cache = $this->getConfigCacheFactory()->cache($this->getCatalogueCachePath($locale), |
281 | - function (ConfigCacheInterface $cache) use ($locale) { |
|
281 | + function(ConfigCacheInterface $cache) use ($locale) { |
|
282 | 282 | $this->dumpCatalogue($locale, $cache); |
283 | 283 | } |
284 | 284 | ); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } elseif (!$info['valid']) { |
175 | 175 | ++$erroredFiles; |
176 | 176 | $io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
177 | - $io->listing(array_map(function ($error) { |
|
177 | + $io->listing(array_map(function($error) { |
|
178 | 178 | // general document errors have a '-1' line number |
179 | 179 | return -1 === $error['line'] ? $error['message'] : sprintf('Line %d, Column %d: %s', $error['line'], $error['column'], $error['message']); |
180 | 180 | }, $info['messages'])); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | { |
195 | 195 | $errors = 0; |
196 | 196 | |
197 | - array_walk($filesInfo, function (&$v) use (&$errors) { |
|
197 | + array_walk($filesInfo, function(&$v) use (&$errors) { |
|
198 | 198 | $v['file'] = (string) $v['file']; |
199 | 199 | if (!$v['valid']) { |
200 | 200 | ++$errors; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | private function getDirectoryIterator(string $directory) |
227 | 227 | { |
228 | - $default = function ($directory) { |
|
228 | + $default = function($directory) { |
|
229 | 229 | return new \RecursiveIteratorIterator( |
230 | 230 | new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), |
231 | 231 | \RecursiveIteratorIterator::LEAVES_ONLY |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | private function isReadable(string $fileOrDirectory) |
243 | 243 | { |
244 | - $default = function ($fileOrDirectory) { |
|
244 | + $default = function($fileOrDirectory) { |
|
245 | 245 | return is_readable($fileOrDirectory); |
246 | 246 | }; |
247 | 247 |
@@ -62,20 +62,20 @@ |
||
62 | 62 | |
63 | 63 | $root = pack('V7', |
64 | 64 | $resOffset + (2 << 28), // Resource Offset + Resource Type |
65 | - 6, // Index length |
|
66 | - $keyTop, // Index keys top |
|
67 | - $bundleTop, // Index resources top |
|
68 | - $bundleTop, // Index bundle top |
|
65 | + 6, // Index length |
|
66 | + $keyTop, // Index keys top |
|
67 | + $bundleTop, // Index resources top |
|
68 | + $bundleTop, // Index bundle top |
|
69 | 69 | \count($messages->all($domain)), // Index max table length |
70 | 70 | 0 // Index attributes |
71 | 71 | ); |
72 | 72 | |
73 | 73 | $header = pack('vC2v4C12@32', |
74 | - 32, // Header size |
|
75 | - 0xDA, 0x27, // Magic number 1 and 2 |
|
76 | - 20, 0, 0, 2, // Rest of the header, ..., Size of a char |
|
74 | + 32, // Header size |
|
75 | + 0xDA, 0x27, // Magic number 1 and 2 |
|
76 | + 20, 0, 0, 2, // Rest of the header, ..., Size of a char |
|
77 | 77 | 0x52, 0x65, 0x73, 0x42, // Data format identifier |
78 | - 1, 2, 0, 0, // Data version |
|
78 | + 1, 2, 0, 0, // Data version |
|
79 | 79 | 1, 4, 0, 0 // Unicode version |
80 | 80 | ); |
81 | 81 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | private static $internalEncoding = 'UTF-8'; |
75 | 75 | private static $caseFold = array( |
76 | 76 | array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"), |
77 | - array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'), |
|
77 | + array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'), |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $vars = array(&$a, &$b, &$c, &$d, &$e, &$f); |
121 | 121 | |
122 | 122 | $ok = true; |
123 | - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
123 | + array_walk_recursive($vars, function(&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
124 | 124 | if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { |
125 | 125 | $ok = false; |
126 | 126 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (null !== $encoding && !\is_scalar($encoding)) { |
155 | 155 | trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); |
156 | 156 | |
157 | - return ''; // Instead of null (cf. mb_encode_numericentity). |
|
157 | + return ''; // Instead of null (cf. mb_encode_numericentity). |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $s = (string) $s; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $convmap[$i + 1] += $convmap[$i + 2]; |
182 | 182 | } |
183 | 183 | |
184 | - $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { |
|
184 | + $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function(array $m) use ($cnt, $convmap) { |
|
185 | 185 | $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; |
186 | 186 | for ($i = 0; $i < $cnt; $i += 4) { |
187 | 187 | if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | if (null !== $encoding && !\is_scalar($encoding)) { |
215 | 215 | trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); |
216 | 216 | |
217 | - return null; // Instead of '' (cf. mb_decode_numericentity). |
|
217 | + return null; // Instead of '' (cf. mb_decode_numericentity). |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | if (null !== $is_hex && !\is_scalar($is_hex)) { |
@@ -201,7 +201,7 @@ |
||
201 | 201 | |
202 | 202 | public function getDebugInfo() |
203 | 203 | { |
204 | - return array ( 37 => 1,); |
|
204 | + return array(37 => 1,); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | public function getSourceContext() |
@@ -31,7 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | if (T_CLASS === $tokens[$index][0] && T_WHITESPACE === $tokens[$index + 1][0] && T_STRING === $tokens[$index + 2][0]) { |
34 | - $index += 2; |
|
34 | + $index += 2; |
|
35 | 35 | $filterClasses[] = $namespace.'\\'.$tokens[$index][1]; |
36 | 36 | break; |
37 | 37 | } |