@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | if (PREG_NO_ERROR !== $lastError = preg_last_error()) { |
| 233 | 233 | $constants = array_flip(get_defined_constants(true)['pcre']); |
| 234 | 234 | $lastError = $constants[$lastError]; |
| 235 | - $mess = 'Received preg error ' . $lastError; |
|
| 235 | + $mess = 'Received preg error '.$lastError; |
|
| 236 | 236 | throw new \DomainException($mess); |
| 237 | 237 | } |
| 238 | 238 | $this->getYem() |
@@ -244,12 +244,12 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | $mess = ''; |
| 246 | 246 | foreach ($columns as $column) { |
| 247 | - $mess .= $column . ','; |
|
| 247 | + $mess .= $column.','; |
|
| 248 | 248 | if (256 <= strlen($mess)) { |
| 249 | 249 | break; |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | - $mess = substr($mess, 0, 256) . '...'; |
|
| 252 | + $mess = substr($mess, 0, 256).'...'; |
|
| 253 | 253 | $this->getYem() |
| 254 | 254 | ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $mess); |
| 255 | 255 | $this->pdoStatement->execute($columns); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | protected function processXmlRows(array $rows, array $columnDefaults): array |
| 268 | 268 | { |
| 269 | - $callback = function (array $carry, \SimpleXMLElement $row) use ($columnDefaults): array { |
|
| 269 | + $callback = function(array $carry, \SimpleXMLElement $row) use ($columnDefaults): array { |
|
| 270 | 270 | foreach ($columnDefaults as $key => $value) { |
| 271 | 271 | $attribute = (string)$row[$key]; |
| 272 | 272 | $carry[] = '' !== $attribute ? $attribute : (string)$value; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | return $this; |
| 297 | 297 | } |
| 298 | 298 | $defaultNames = array_keys($columnDefaults); |
| 299 | - $callback = function (array $carry, \SimpleXMLElement $element) use ($defaultNames): array { |
|
| 299 | + $callback = function(array $carry, \SimpleXMLElement $element) use ($defaultNames): array { |
|
| 300 | 300 | if (in_array($name = $element->getName(), $defaultNames, true)) { |
| 301 | 301 | $carry[$name] = (string)$element; |
| 302 | 302 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $sql = $this->getCsq() |
| 141 | 141 | ->getLatestYapealSchemaVersion(); |
| 142 | 142 | $this->getYem() |
| 143 | - ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, 'sql - ' . $sql); |
|
| 143 | + ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, 'sql - '.$sql); |
|
| 144 | 144 | $version = '19700101000001.000'; |
| 145 | 145 | try { |
| 146 | 146 | $result = $this->getPdo() |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $version = (string)$result->fetchColumn(); |
| 149 | 149 | $result->closeCursor(); |
| 150 | 150 | } catch (\PDOException $exc) { |
| 151 | - $sql = '<comment>' . $sql . '</comment>'; |
|
| 151 | + $sql = '<comment>'.$sql.'</comment>'; |
|
| 152 | 152 | $mess = sprintf('<error>Could NOT query latest database version. Aborting ...</error>', $version); |
| 153 | 153 | if ($output::VERBOSITY_QUIET !== $output->getVerbosity()) { |
| 154 | 154 | $output->writeln([$sql, $mess]); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $fileExt); |
| 171 | 171 | $regex = '%^.+?/\d{14}\.\d{3}\..+$%'; |
| 172 | 172 | $filteredNames = array_filter(preg_grep($regex, glob($globPath, GLOB_BRACE | GLOB_NOESCAPE)), |
| 173 | - function (string $fileName) use ($fileExt, $latestVersion) { |
|
| 173 | + function(string $fileName) use ($fileExt, $latestVersion) { |
|
| 174 | 174 | return $latestVersion < basename($fileName, $fileExt); |
| 175 | 175 | }); |
| 176 | 176 | return $filteredNames; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $yem = $this->getYem(); |
| 131 | 131 | $statements = explode(';', $this->getCleanedUpSql($sqlStatements, $this->getReplacements())); |
| 132 | 132 | $statements = array_filter($statements, |
| 133 | - function ($statement) { |
|
| 133 | + function($statement) { |
|
| 134 | 134 | return '' !== trim($statement); |
| 135 | 135 | }); |
| 136 | 136 | $progress = null; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // here so as not to break statements. |
| 153 | 153 | $sql = str_replace('{semiColon}', ';', trim($sql)); |
| 154 | 154 | null !== $progress && $progress->clear(); |
| 155 | - $yem->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, 'sql - ' . $sql); |
|
| 155 | + $yem->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, 'sql - '.$sql); |
|
| 156 | 156 | $pdo->exec($sql); |
| 157 | 157 | if (null !== $progress) { |
| 158 | 158 | $progress->display(); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $progress->advance(); |
| 166 | 166 | $output->writeln(''); |
| 167 | 167 | } |
| 168 | - $mess = '<error>SQL error in statement ' . $statement . '</error>'; |
|
| 168 | + $mess = '<error>SQL error in statement '.$statement.'</error>'; |
|
| 169 | 169 | $output->writeln($mess); |
| 170 | 170 | throw new YapealDatabaseException(strip_tags($mess), 2, $exc); |
| 171 | 171 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $base = 'Yapeal.Sql.'; |
| 206 | 206 | foreach (['class', 'database', 'hostName', 'password', 'platform', 'tablePrefix', 'userName'] as $option) { |
| 207 | 207 | if (array_key_exists($option, $options) && null !== $options[$option]) { |
| 208 | - $dic[$base . $option] = $options[$option]; |
|
| 208 | + $dic[$base.$option] = $options[$option]; |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | return $this; |
@@ -187,7 +187,7 @@ |
||
| 187 | 187 | $regex = '%^.+?/\w*\..+$%'; |
| 188 | 188 | $drop = $this->dropSchema; |
| 189 | 189 | $filteredNames = array_filter(preg_grep($regex, glob($globPath, GLOB_BRACE | GLOB_NOESCAPE)), |
| 190 | - function (string $fileName) use ($drop) { |
|
| 190 | + function(string $fileName) use ($drop) { |
|
| 191 | 191 | return $drop || 0 !== strpos(basename($fileName), 'DropSchema'); |
| 192 | 192 | }); |
| 193 | 193 | return $filteredNames; |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | $depth = 0; |
| 88 | 88 | $maxDepth = 25; |
| 89 | - $callback = function ($subject) use ($dic, $settings, &$miss) { |
|
| 89 | + $callback = function($subject) use ($dic, $settings, &$miss) { |
|
| 90 | 90 | $regEx = '%(.*)\{(?<name>(?:\w+)(?:\.\w+)+)\}(.*)%'; |
| 91 | 91 | if (is_string($subject) && preg_match($regEx, $subject, $matches)) { |
| 92 | 92 | $name = $matches['name']; |
| 93 | 93 | if ($dic->offsetExists($name)) { |
| 94 | - $subject = $matches[1] . $dic[$name] . $matches[3]; |
|
| 94 | + $subject = $matches[1].$dic[$name].$matches[3]; |
|
| 95 | 95 | } elseif (array_key_exists($name, $settings)) { |
| 96 | - $subject = $matches[1] . $settings[$name] . $matches[3]; |
|
| 96 | + $subject = $matches[1].$settings[$name].$matches[3]; |
|
| 97 | 97 | } |
| 98 | 98 | if (false !== strpos($subject, '{') && false !== strpos($subject, '}')) { |
| 99 | 99 | ++$miss; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if (PREG_NO_ERROR !== $lastError) { |
| 113 | 113 | $constants = array_flip(get_defined_constants(true)['pcre']); |
| 114 | 114 | $lastError = $constants[$lastError]; |
| 115 | - $mess = 'Received preg error ' . $lastError; |
|
| 115 | + $mess = 'Received preg error '.$lastError; |
|
| 116 | 116 | throw new \DomainException($mess); |
| 117 | 117 | } |
| 118 | 118 | } while (0 < $miss); |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $this->setDic($dic); |
| 59 | 59 | if (empty($dic['Yapeal.Config.Yaml'])) { |
| 60 | - $dic['Yapeal.Config.Yaml'] = $dic->factory(function () { |
|
| 60 | + $dic['Yapeal.Config.Yaml'] = $dic->factory(function() { |
|
| 61 | 61 | return new YamlConfigFile(); |
| 62 | 62 | }); |
| 63 | 63 | } |
| 64 | - $path = dirname(str_replace('\\', '/', __DIR__), 2) . '/'; |
|
| 64 | + $path = dirname(str_replace('\\', '/', __DIR__), 2).'/'; |
|
| 65 | 65 | // These two paths are critical to Yapeal-ng working and can't be overridden. |
| 66 | 66 | $dic['Yapeal.baseDir'] = $path; |
| 67 | - $dic['Yapeal.libDir'] = $path . 'lib/'; |
|
| 68 | - $configFiles = [str_replace('\\', '/', __DIR__) . '/yapealDefaults.yaml']; |
|
| 67 | + $dic['Yapeal.libDir'] = $path.'lib/'; |
|
| 68 | + $configFiles = [str_replace('\\', '/', __DIR__).'/yapealDefaults.yaml']; |
|
| 69 | 69 | $settings = []; |
| 70 | 70 | /** |
| 71 | 71 | * Do to the importance that the cache/ and log/ directories and the main configuration file _not_ point to |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | if (false !== $vendorPos = strpos($path, 'vendor/')) { |
| 85 | 85 | $dic['Yapeal.vendorParentDir'] = substr($path, 0, $vendorPos); |
| 86 | - $configFiles[] = $dic['Yapeal.vendorParentDir'] . 'config/yapeal.yaml'; |
|
| 86 | + $configFiles[] = $dic['Yapeal.vendorParentDir'].'config/yapeal.yaml'; |
|
| 87 | 87 | $settings['Yapeal.FileSystem.Cache.dir'] = '{Yapeal.vendorParentDir}cache/'; |
| 88 | 88 | $settings['Yapeal.Log.dir'] = '{Yapeal.vendorParentDir}log/'; |
| 89 | 89 | } else { |
| 90 | - $configFiles[] = $path . 'config/yapeal.yaml'; |
|
| 91 | - $settings['Yapeal.FileSystem.Cache.dir'] = $path . 'cache/'; |
|
| 92 | - $settings['Yapeal.Log.dir'] = $path . 'log/'; |
|
| 90 | + $configFiles[] = $path.'config/yapeal.yaml'; |
|
| 91 | + $settings['Yapeal.FileSystem.Cache.dir'] = $path.'cache/'; |
|
| 92 | + $settings['Yapeal.Log.dir'] = $path.'log/'; |
|
| 93 | 93 | } |
| 94 | 94 | if (!empty($dic['Yapeal.Config.configFile'])) { |
| 95 | 95 | $configFiles[] = $dic['Yapeal.Config.configFile']; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $version = $settings['Yapeal.version'] ?? '0.0.0-0-dev+noGit-unknown'; |
| 118 | 118 | $gitVersion = trim(exec('git describe --always --long 2>&1', $junk, $status)); |
| 119 | 119 | if (0 === $status && '' !== $gitVersion && $gitVersion !== $version) { |
| 120 | - $settings['Yapeal.version'] = $gitVersion . '-dev'; |
|
| 120 | + $settings['Yapeal.version'] = $gitVersion.'-dev'; |
|
| 121 | 121 | } |
| 122 | 122 | return $settings; |
| 123 | 123 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | private function wireCli(ContainerInterface $dic): self |
| 294 | 294 | { |
| 295 | 295 | if (empty($dic['Yapeal.Log.Callable.Cli'])) { |
| 296 | - $dic['Yapeal.Log.Callable.Cli'] = function () use ($dic) { |
|
| 296 | + $dic['Yapeal.Log.Callable.Cli'] = function() use ($dic) { |
|
| 297 | 297 | $parameters = [ |
| 298 | 298 | $dic['Yapeal.Log.Parameters.Cli.stream'], |
| 299 | 299 | $dic['Yapeal.Log.Parameters.Cli.level'], |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | private function wireFileSystem(ContainerInterface $dic): self |
| 322 | 322 | { |
| 323 | 323 | if (empty($dic['Yapeal.Log.Callable.FileSystem'])) { |
| 324 | - $dic['Yapeal.Log.Callable.FileSystem'] = function () use ($dic) { |
|
| 324 | + $dic['Yapeal.Log.Callable.FileSystem'] = function() use ($dic) { |
|
| 325 | 325 | $parameters = [ |
| 326 | 326 | $dic['Yapeal.Log.Parameters.FileSystem.stream'], |
| 327 | 327 | $dic['Yapeal.Log.Parameters.FileSystem.level'], |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | private function wireFingersCrossed(ContainerInterface $dic): self |
| 350 | 350 | { |
| 351 | 351 | if (empty($dic['Yapeal.Log.Callable.FingersCrossed'])) { |
| 352 | - $dic['Yapeal.Log.Callable.FingersCrossed'] = function () use ($dic) { |
|
| 352 | + $dic['Yapeal.Log.Callable.FingersCrossed'] = function() use ($dic) { |
|
| 353 | 353 | /** |
| 354 | 354 | * @var string $activationStrategy |
| 355 | 355 | * @var string $handler |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | private function wireGroup(ContainerInterface $dic): self |
| 379 | 379 | { |
| 380 | 380 | if (empty($dic['Yapeal.Log.Callable.Group'])) { |
| 381 | - $dic['Yapeal.Log.Callable.Group'] = function () use ($dic) { |
|
| 381 | + $dic['Yapeal.Log.Callable.Group'] = function() use ($dic) { |
|
| 382 | 382 | $handlers = []; |
| 383 | 383 | foreach (explode(',', $dic['Yapeal.Log.Parameters.Group.handlers']) as $handler) { |
| 384 | 384 | if ('' === $handler) { |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | private function wireLineFormatter(ContainerInterface $dic): self |
| 404 | 404 | { |
| 405 | 405 | if (empty($dic['Yapeal.Log.Callable.LFFactory'])) { |
| 406 | - $dic['Yapeal.Log.Callable.LFFactory'] = $dic->factory(function () use ($dic) { |
|
| 406 | + $dic['Yapeal.Log.Callable.LFFactory'] = $dic->factory(function() use ($dic) { |
|
| 407 | 407 | $parameters = [ |
| 408 | 408 | $dic['Yapeal.Log.Parameters.LineFormatter.format'], |
| 409 | 409 | $dic['Yapeal.Log.Parameters.LineFormatter.dateFormat'], |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | private function wireLogger(ContainerInterface $dic) |
| 436 | 436 | { |
| 437 | 437 | if (empty($dic['Yapeal.Log.Callable.Logger'])) { |
| 438 | - $dic['Yapeal.Log.Callable.Logger'] = function () use ($dic) { |
|
| 438 | + $dic['Yapeal.Log.Callable.Logger'] = function() use ($dic) { |
|
| 439 | 439 | /** |
| 440 | 440 | * @var \Yapeal\Log\Logger $logger |
| 441 | 441 | */ |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | private function wireStrategy(ContainerInterface $dic): self |
| 473 | 473 | { |
| 474 | 474 | if (empty($dic['Yapeal.Log.Callable.Strategy'])) { |
| 475 | - $dic['Yapeal.Log.Callable.Strategy'] = function () use ($dic) { |
|
| 475 | + $dic['Yapeal.Log.Callable.Strategy'] = function() use ($dic) { |
|
| 476 | 476 | return new $dic['Yapeal.Log.Classes.strategy']((int)$dic['Yapeal.Log.Parameters.Strategy.actionLevel']); |
| 477 | 477 | }; |
| 478 | 478 | } |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $dic = $this->getDic(); |
| 77 | 77 | $base = 'Yapeal.Wiring.Classes.'; |
| 78 | - $dic[$base . 'config'] = $dic[$base . 'config'] ?? '\Yapeal\Configuration\ConfigWiring'; |
|
| 78 | + $dic[$base.'config'] = $dic[$base.'config'] ?? '\Yapeal\Configuration\ConfigWiring'; |
|
| 79 | 79 | $names = ['Config', 'Event', 'Log', 'Sql', 'Xml', 'Xsd', 'Xsl', 'FileSystem', 'Network', 'EveApi']; |
| 80 | 80 | /** |
| 81 | 81 | * @var WiringInterface $class |
| 82 | 82 | */ |
| 83 | 83 | foreach ($names as $name) { |
| 84 | - $setting = $base . strtolower($name); |
|
| 84 | + $setting = $base.strtolower($name); |
|
| 85 | 85 | if (!empty($dic[$setting]) |
| 86 | 86 | && is_subclass_of($dic[$setting], '\Yapeal\Configuration\WiringInterface', true) |
| 87 | 87 | ) { |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | $class->wire($dic); |
| 90 | 90 | continue; |
| 91 | 91 | } |
| 92 | - $methodName = 'wire' . $name; |
|
| 92 | + $methodName = 'wire'.$name; |
|
| 93 | 93 | if (method_exists($this, $methodName)) { |
| 94 | 94 | $this->$methodName(); |
| 95 | 95 | } else { |
| 96 | - $mess = 'Could NOT find class or method for ' . $name; |
|
| 96 | + $mess = 'Could NOT find class or method for '.$name; |
|
| 97 | 97 | throw new \LogicException($mess); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | break; |
| 82 | 82 | } |
| 83 | 83 | } catch (\BadMethodCallException $exc) { |
| 84 | - $this->lastErrorString = 'Failed to get SQL for ' . $this->command; |
|
| 84 | + $this->lastErrorString = 'Failed to get SQL for '.$this->command; |
|
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | if (!$this->executeCommandSql($sql)) { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | try { |
| 196 | 196 | if (!$this->pdo->beginTransaction()) { |
| 197 | - $this->lastErrorString = 'Failed to start transaction for ' . $this->command; |
|
| 197 | + $this->lastErrorString = 'Failed to start transaction for '.$this->command; |
|
| 198 | 198 | return false; |
| 199 | 199 | } |
| 200 | 200 | $stmt = $this->pdo->prepare($sql); |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | if ($this->pdo->inTransaction()) { |
| 203 | 203 | $this->pdo->rollBack(); |
| 204 | 204 | } |
| 205 | - $this->lastErrorString = 'Failed to execute prepared query for ' . $this->command; |
|
| 205 | + $this->lastErrorString = 'Failed to execute prepared query for '.$this->command; |
|
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | 208 | if (!$this->pdo->commit()) { |
| 209 | 209 | if ($this->pdo->inTransaction()) { |
| 210 | 210 | $this->pdo->rollBack(); |
| 211 | 211 | } |
| 212 | - $this->lastErrorString = 'Failed to commit the transaction for ' . $this->command; |
|
| 212 | + $this->lastErrorString = 'Failed to commit the transaction for '.$this->command; |
|
| 213 | 213 | return false; |
| 214 | 214 | } |
| 215 | 215 | } catch (\PDOException $exc) { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $stmt = $this->pdo->query($sql); |
| 284 | 284 | $result = $stmt->fetchAll(\PDO::FETCH_ASSOC); |
| 285 | 285 | if (1 !== count($result)) { |
| 286 | - $this->lastErrorString = 'Expected to fetch a single row for ' . $this->command; |
|
| 286 | + $this->lastErrorString = 'Expected to fetch a single row for '.$this->command; |
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | $this->active = (bool)$result[0]['active']; |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | private function enforceColumnTypes(array $columns): array |
| 303 | 303 | { |
| 304 | - array_walk($columns, function (&$value, $key) { |
|
| 304 | + array_walk($columns, function(&$value, $key) { |
|
| 305 | 305 | switch ($key) { |
| 306 | 306 | case 'active': |
| 307 | 307 | $value = (bool)$value; |