@@ -42,7 +42,7 @@ |
||
42 | 42 | trait CommonFileHandlingTrait |
43 | 43 | { |
44 | 44 | /** |
45 | - * @param $fileName |
|
45 | + * @param string $fileName |
|
46 | 46 | * @param MediatorInterface $yem |
47 | 47 | * @param string $mode |
48 | 48 | * |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | protected function isWritablePath($path, MediatorInterface $yem) |
136 | 136 | { |
137 | 137 | if (!is_readable($path)) { |
138 | - $mess = 'Cache path is NOT readable or does NOT exist, was given ' . $path; |
|
138 | + $mess = 'Cache path is NOT readable or does NOT exist, was given '.$path; |
|
139 | 139 | $yem->triggerLogEvent('Yapeal.Log.log', Logger::NOTICE, $mess); |
140 | 140 | return false; |
141 | 141 | } |
142 | 142 | if (!is_dir($path)) { |
143 | - $mess = 'Cache path is NOT a directory, was given ' . $path; |
|
143 | + $mess = 'Cache path is NOT a directory, was given '.$path; |
|
144 | 144 | $yem->triggerLogEvent('Yapeal.Log.log', Logger::NOTICE, $mess); |
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | if (!is_writable($path)) { |
148 | - $mess = 'Cache path is NOT writable, was given ' . $path; |
|
148 | + $mess = 'Cache path is NOT writable, was given '.$path; |
|
149 | 149 | $yem->triggerLogEvent('Yapeal.Log.log', Logger::NOTICE, $mess); |
150 | 150 | return false; |
151 | 151 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | protected function safeFileRead($fileName, MediatorInterface $yem) |
215 | 215 | { |
216 | 216 | if (!is_readable($fileName) || !is_file($fileName)) { |
217 | - $mess = 'Could NOT find accessible file, was given ' . $fileName; |
|
217 | + $mess = 'Could NOT find accessible file, was given '.$fileName; |
|
218 | 218 | $yem->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $mess); |
219 | 219 | return false; |
220 | 220 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | protected function createEveApiMessage($messagePrefix, EveApiReadWriteInterface $data) |
51 | 51 | { |
52 | - $mess = $messagePrefix . ' Eve API %1$s/%2$s'; |
|
52 | + $mess = $messagePrefix.' Eve API %1$s/%2$s'; |
|
53 | 53 | $subs = [lcfirst($data->getEveApiSectionName()), $data->getEveApiName()]; |
54 | 54 | if ($data->hasEveApiArgument('keyID')) { |
55 | 55 | $mess .= ' for keyID = %3$s'; |
@@ -103,10 +103,10 @@ |
||
103 | 103 | public function setCachePath($value = null) |
104 | 104 | { |
105 | 105 | if ($value === null) { |
106 | - $value = dirname(dirname(__DIR__)) . '/cache/'; |
|
106 | + $value = dirname(dirname(__DIR__)).'/cache/'; |
|
107 | 107 | } |
108 | 108 | if (!is_string($value)) { |
109 | - $mess = 'Cache path MUST be string, but was given ' . gettype($value); |
|
109 | + $mess = 'Cache path MUST be string, but was given '.gettype($value); |
|
110 | 110 | throw new InvalidArgumentException($mess); |
111 | 111 | } |
112 | 112 | if ('' === $this->cachePath) { |
@@ -380,11 +380,11 @@ |
||
380 | 380 | public function getUpsert($tableName, array $columnNameList, $rowCount) |
381 | 381 | { |
382 | 382 | $columns = implode('","', $columnNameList); |
383 | - $rowPrototype = '(' . implode(',', array_fill(0, count($columnNameList), '?')) . ')'; |
|
383 | + $rowPrototype = '('.implode(',', array_fill(0, count($columnNameList), '?')).')'; |
|
384 | 384 | $rows = implode(',', array_fill(0, $rowCount, $rowPrototype)); |
385 | 385 | $updates = []; |
386 | 386 | foreach ($columnNameList as $column) { |
387 | - $updates[] = '"' . $column . '"=VALUES("' . $column . '")'; |
|
387 | + $updates[] = '"'.$column.'"=VALUES("'.$column.'")'; |
|
388 | 388 | } |
389 | 389 | $updates = implode(',', $updates); |
390 | 390 | $sql = sprintf( |
@@ -372,7 +372,7 @@ |
||
372 | 372 | } |
373 | 373 | /** |
374 | 374 | * @param string $tableName |
375 | - * @param array $columnNameList |
|
375 | + * @param string[] $columnNameList |
|
376 | 376 | * @param string $rowCount |
377 | 377 | * |
378 | 378 | * @return string |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | if ($code < 200) { |
82 | 82 | if (false !== strpos($mess, 'retry after')) { |
83 | - $data->setCacheInterval(strtotime(substr($mess, -19) . '+00:00') - time()); |
|
83 | + $data->setCacheInterval(strtotime(substr($mess, -19).'+00:00') - time()); |
|
84 | 84 | } |
85 | 85 | $yem->triggerLogEvent('Yapeal.Log.log', Logger::WARNING, |
86 | 86 | $this->createEventMessage($mess, $data, $eventName)); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $data->setCacheInterval(300); |
98 | 98 | } |
99 | 99 | $apiName = $data->getEveApiName(); |
100 | - $data->setEveApiName('Error_' . $apiName); |
|
100 | + $data->setEveApiName('Error_'.$apiName); |
|
101 | 101 | // Cache error XML. |
102 | 102 | $this->emitEvents($data, 'cache'); |
103 | 103 | $data->setEveApiName($apiName); |
@@ -50,20 +50,20 @@ |
||
50 | 50 | { |
51 | 51 | if (empty($dic['Yapeal.Event.EveApiEvent'])) { |
52 | 52 | $dic['Yapeal.Event.EveApi'] = $dic->factory( |
53 | - function ($dic) { |
|
53 | + function($dic) { |
|
54 | 54 | return new $dic['Yapeal.Event.Factories.eveApi'](); |
55 | 55 | } |
56 | 56 | ); |
57 | 57 | } |
58 | 58 | if (empty($dic['Yapeal.Event.LogEvent'])) { |
59 | 59 | $dic['Yapeal.Event.LogEvent'] = $dic->factory( |
60 | - function ($dic) { |
|
60 | + function($dic) { |
|
61 | 61 | return new $dic['Yapeal.Event.Factories.log']; |
62 | 62 | } |
63 | 63 | ); |
64 | 64 | } |
65 | 65 | if (empty($dic['Yapeal.Event.Mediator'])) { |
66 | - $dic['Yapeal.Event.Mediator'] = function ($dic) { |
|
66 | + $dic['Yapeal.Event.Mediator'] = function($dic) { |
|
67 | 67 | return new $dic['Yapeal.Event.mediator']($dic); |
68 | 68 | }; |
69 | 69 | } |
@@ -130,7 +130,7 @@ |
||
130 | 130 | * @param array $columnDefaults |
131 | 131 | * @param \SimpleXMLElement[] $rows |
132 | 132 | * |
133 | - * @return array |
|
133 | + * @return string[] |
|
134 | 134 | */ |
135 | 135 | protected function processXmlRows(array $columnDefaults, array $rows) |
136 | 136 | { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $mess); |
170 | 170 | $mess = implode(',', $columns); |
171 | 171 | if (512 < strlen($mess)) { |
172 | - $mess = substr($mess, 0, 512) . '...'; |
|
172 | + $mess = substr($mess, 0, 512).'...'; |
|
173 | 173 | } |
174 | 174 | $this->getYem() |
175 | 175 | ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $mess); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | } |
228 | 228 | $required = array_reduce($columnDefaults, |
229 | - function ($carry, $item) { |
|
229 | + function($carry, $item) { |
|
230 | 230 | return $carry + (int)(null === $item); |
231 | 231 | }, |
232 | 232 | 0); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | return $this; |
235 | 235 | } |
236 | 236 | uksort($columnDefaults, |
237 | - function ($alpha, $beta) { |
|
237 | + function($alpha, $beta) { |
|
238 | 238 | $alpha = strtolower($alpha); |
239 | 239 | $beta = strtolower($beta); |
240 | 240 | if ($alpha < $beta) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 | if (!is_string($name)) { |
60 | - $mess = 'Name MUST be string but was given ' . gettype($name); |
|
60 | + $mess = 'Name MUST be string but was given '.gettype($name); |
|
61 | 61 | throw new InvalidArgumentException($mess); |
62 | 62 | } |
63 | 63 | $this->eveApiArguments[$name] = (string)$value; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $name = (string)$name; |
91 | 91 | if (!array_key_exists($name, $this->eveApiArguments)) { |
92 | - $mess = 'Unknown argument ' . $name; |
|
92 | + $mess = 'Unknown argument '.$name; |
|
93 | 93 | throw new DomainException($mess); |
94 | 94 | } |
95 | 95 | return $this->eveApiArguments[$name]; |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getHash() |
153 | 153 | { |
154 | - $hash = $this->getEveApiName() . $this->getEveApiSectionName(); |
|
154 | + $hash = $this->getEveApiName().$this->getEveApiSectionName(); |
|
155 | 155 | $arguments = $this->getEveApiArguments(); |
156 | 156 | ksort($arguments); |
157 | 157 | foreach ($arguments as $key => $value) { |
158 | 158 | if ('mask' === $key) { |
159 | 159 | continue; |
160 | 160 | } |
161 | - $hash .= $key . $value; |
|
161 | + $hash .= $key.$value; |
|
162 | 162 | } |
163 | 163 | return hash('md5', $hash); |
164 | 164 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public function setEveApiName($value) |
229 | 229 | { |
230 | 230 | if (!is_string($value)) { |
231 | - $mess = 'Name MUST be string but was given ' . gettype($value); |
|
231 | + $mess = 'Name MUST be string but was given '.gettype($value); |
|
232 | 232 | throw new InvalidArgumentException($mess); |
233 | 233 | } |
234 | 234 | $this->eveApiName = $value; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function setEveApiSectionName($value) |
246 | 246 | { |
247 | 247 | if (!is_string($value)) { |
248 | - $mess = 'Section name MUST be string but was given ' . gettype($value); |
|
248 | + $mess = 'Section name MUST be string but was given '.gettype($value); |
|
249 | 249 | throw new InvalidArgumentException($mess); |
250 | 250 | } |
251 | 251 | $this->eveApiSectionName = $value; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $xml = ''; |
266 | 266 | } |
267 | 267 | if (!is_string($xml)) { |
268 | - $mess = 'Xml MUST be string but was given ' . gettype($xml); |
|
268 | + $mess = 'Xml MUST be string but was given '.gettype($xml); |
|
269 | 269 | throw new InvalidArgumentException($mess); |
270 | 270 | } |
271 | 271 | $this->eveApiXml = $xml; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | $statements = str_replace(array_keys($replacements), array_values($replacements), explode(';', $sqlStatements)); |
125 | 125 | // 5 is a 'magic' number that I think is shorter than any legal SQL statement. |
126 | - $statements = array_filter($statements, function ($value) { |
|
126 | + $statements = array_filter($statements, function($value) { |
|
127 | 127 | return 5 <= strlen(trim($value)); |
128 | 128 | }); |
129 | 129 | $progress = null; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $progress->finish(); |
152 | 152 | $output->writeln(''); |
153 | 153 | } |
154 | - $mess = $sql . PHP_EOL; |
|
154 | + $mess = $sql.PHP_EOL; |
|
155 | 155 | $mess .= sprintf( |
156 | 156 | 'Sql failed in %1$s on statement %2$s with (%3$s) %4$s', |
157 | 157 | $fileName, |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $dic = $this->getDic(); |
183 | 183 | foreach (['class', 'database', 'hostName', 'password', 'platform', 'tablePrefix', 'userName'] as $option) { |
184 | 184 | if (!empty($options[$option])) { |
185 | - $dic[$base . $option] = $options[$option]; |
|
185 | + $dic[$base.$option] = $options[$option]; |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | if (!empty($options['configFile'])) { |