| @@ -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) { | 
| @@ -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); | 
| @@ -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 |      { | 
| @@ -181,7 +181,7 @@ discard block | ||
| 181 | 181 |              if (PREG_NO_ERROR !== $lastError) { | 
| 182 | 182 | $constants = array_flip(get_defined_constants(true)['pcre']); | 
| 183 | 183 | $lastError = $constants[$lastError]; | 
| 184 | - $mess = 'Received preg error ' . $lastError; | |
| 184 | + $mess = 'Received preg error '.$lastError; | |
| 185 | 185 | throw new \DomainException($mess); | 
| 186 | 186 | } | 
| 187 | 187 | $this->getYem() | 
| @@ -245,7 +245,7 @@ discard block | ||
| 245 | 245 | } | 
| 246 | 246 | } | 
| 247 | 247 | $required = array_reduce($columnDefaults, | 
| 248 | -            function ($carry, $item) { | |
| 248 | +            function($carry, $item) { | |
| 249 | 249 | return $carry + (int)(null === $item); | 
| 250 | 250 | }, | 
| 251 | 251 | 0); | 
| @@ -253,7 +253,7 @@ discard block | ||
| 253 | 253 | return $this; | 
| 254 | 254 | } | 
| 255 | 255 | uksort($columnDefaults, | 
| 256 | -            function ($alpha, $beta) { | |
| 256 | +            function($alpha, $beta) { | |
| 257 | 257 | return strtolower($alpha) <=> strtolower($beta); | 
| 258 | 258 | }); | 
| 259 | 259 | return $this->flush(array_values($columnDefaults), array_keys($columnDefaults), $tableName); | 
| @@ -154,18 +154,18 @@ | ||
| 154 | 154 | } | 
| 155 | 155 | $name = strtolower($name); | 
| 156 | 156 | foreach ([ | 
| 157 | - 'descr' => 'xs:string', | |
| 158 | - 'name' => 'eveNameType', | |
| 159 | - 'balance' => 'eveISKType', | |
| 160 | - 'isk' => 'eveISKType', | |
| 161 | - 'tax' => 'eveISKType', | |
| 162 | - 'timeefficiency' => 'xs:unsignedByte', | |
| 163 | - 'date' => 'eveNEDTType', | |
| 164 | - 'time' => 'eveNEDTType', | |
| 165 | - 'until' => 'eveNEDTType', | |
| 166 | - 'errorcode' => 'xs:unsignedShort', | |
| 167 | - 'level' => 'xs:unsignedShort' | |
| 168 | -                 ] as $search => $replace) { | |
| 157 | + 'descr' => 'xs:string', | |
| 158 | + 'name' => 'eveNameType', | |
| 159 | + 'balance' => 'eveISKType', | |
| 160 | + 'isk' => 'eveISKType', | |
| 161 | + 'tax' => 'eveISKType', | |
| 162 | + 'timeefficiency' => 'xs:unsignedByte', | |
| 163 | + 'date' => 'eveNEDTType', | |
| 164 | + 'time' => 'eveNEDTType', | |
| 165 | + 'until' => 'eveNEDTType', | |
| 166 | + 'errorcode' => 'xs:unsignedShort', | |
| 167 | + 'level' => 'xs:unsignedShort' | |
| 168 | +                    ] as $search => $replace) { | |
| 169 | 169 |              if (false !== strpos($name, $search)) { | 
| 170 | 170 | return $replace; | 
| 171 | 171 | } | 
| @@ -95,7 +95,7 @@ discard block | ||
| 95 | 95 | 'className' => lcfirst($data->getEveApiName()), | 
| 96 | 96 | 'tables' => $this->tables, | 
| 97 | 97 | 'sectionName' => lcfirst($this->sectionName), | 
| 98 | -            'version' => gmdate('YmdHis', $sec) . sprintf('.%0-3s', floor($mSec * 1000)) | |
| 98 | +            'version' => gmdate('YmdHis', $sec).sprintf('.%0-3s', floor($mSec * 1000)) | |
| 99 | 99 | ]; | 
| 100 | 100 |          try { | 
| 101 | 101 | $contents = $this->getTwig() | 
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | $columns[$colName] = $this->inferTypeFromName($colName); | 
| 183 | 183 | } | 
| 184 | 184 | uksort($columns, | 
| 185 | -                function ($alpha, $beta) { | |
| 185 | +                function($alpha, $beta) { | |
| 186 | 186 | $alpha = strtolower($alpha); | 
| 187 | 187 | $beta = strtolower($beta); | 
| 188 | 188 |                      if ($alpha < $beta) { | 
| @@ -195,7 +195,7 @@ discard block | ||
| 195 | 195 | $tables[$tableName] = ['attributes' => $columns]; | 
| 196 | 196 | } | 
| 197 | 197 | uksort($tables, | 
| 198 | -            function ($alpha, $beta) { | |
| 198 | +            function($alpha, $beta) { | |
| 199 | 199 | $alpha = strtolower($alpha); | 
| 200 | 200 | $beta = strtolower($beta); | 
| 201 | 201 |                  if ($alpha < $beta) { | 
| @@ -231,7 +231,7 @@ discard block | ||
| 231 | 231 | $columns[$name] = $this->inferTypeFromName($name, true); | 
| 232 | 232 | } | 
| 233 | 233 | uksort($columns, | 
| 234 | -            function ($alpha, $beta) { | |
| 234 | +            function($alpha, $beta) { | |
| 235 | 235 | $alpha = strtolower($alpha); | 
| 236 | 236 | $beta = strtolower($beta); | 
| 237 | 237 |                  if ($alpha < $beta) { | 
| @@ -181,7 +181,7 @@ discard block | ||
| 181 | 181 |                  ->triggerLogEvent('Yapeal.Log.log', Logger::WARNING, $this->createEveApiMessage($mess, $data)); | 
| 182 | 182 | return false; | 
| 183 | 183 | } | 
| 184 | -        if (strtotime($expires[0]['expires'] . '+00:00') < time()) { | |
| 184 | +        if (strtotime($expires[0]['expires'].'+00:00') < time()) { | |
| 185 | 185 | $mess = 'Expired UtilCachedUntil record found for'; | 
| 186 | 186 | $this->getYem() | 
| 187 | 187 |                  ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $this->createEveApiMessage($mess, $data)); | 
| @@ -288,7 +288,7 @@ discard block | ||
| 288 | 288 |          if ('' === $currentTime) { | 
| 289 | 289 | return $this; | 
| 290 | 290 | } | 
| 291 | -        $dateTime = gmdate('Y-m-d H:i:s', strtotime($currentTime . '+00:00') + $data->getCacheInterval()); | |
| 291 | +        $dateTime = gmdate('Y-m-d H:i:s', strtotime($currentTime.'+00:00') + $data->getCacheInterval()); | |
| 292 | 292 | $row = [ | 
| 293 | 293 |              'accountKey' => $data->hasEveApiArgument('accountKey') ? $data->getEveApiArgument('accountKey') : '0', | 
| 294 | 294 | 'apiName' => $data->getEveApiName(), | 
| @@ -166,16 +166,16 @@ | ||
| 166 | 166 | $name = strtolower($name); | 
| 167 | 167 | $column = 'null'; | 
| 168 | 168 | foreach ([ | 
| 169 | - 'descr' => '\'\'', | |
| 170 | - 'name' => '\'\'', | |
| 171 | - 'balance' => '\'0.0\'', | |
| 172 | - 'isk' => '\'0.0\'', | |
| 173 | - 'tax' => '\'0.0\'', | |
| 174 | - 'timeefficiency' => 'null', | |
| 175 | - 'date' => '\'1970-01-01 00:00:01\'', | |
| 176 | - 'time' => '\'1970-01-01 00:00:01\'', | |
| 177 | - 'until' => '\'1970-01-01 00:00:01\'' | |
| 178 | -                 ] as $search => $replace) { | |
| 169 | + 'descr' => '\'\'', | |
| 170 | + 'name' => '\'\'', | |
| 171 | + 'balance' => '\'0.0\'', | |
| 172 | + 'isk' => '\'0.0\'', | |
| 173 | + 'tax' => '\'0.0\'', | |
| 174 | + 'timeefficiency' => 'null', | |
| 175 | + 'date' => '\'1970-01-01 00:00:01\'', | |
| 176 | + 'time' => '\'1970-01-01 00:00:01\'', | |
| 177 | + 'until' => '\'1970-01-01 00:00:01\'' | |
| 178 | +                    ] as $search => $replace) { | |
| 179 | 179 |              if (false !== strpos($name, $search)) { | 
| 180 | 180 | return $replace; | 
| 181 | 181 | } | 
| @@ -163,7 +163,7 @@ discard block | ||
| 163 | 163 | $attributes['ownerID'] = '$ownerID'; | 
| 164 | 164 | } | 
| 165 | 165 | uksort($attributes, | 
| 166 | -                function ($alpha, $beta) { | |
| 166 | +                function($alpha, $beta) { | |
| 167 | 167 | return strtolower($alpha) <=> strtolower($beta); | 
| 168 | 168 | }); | 
| 169 | 169 |              if (0 === count($this->tables)) { | 
| @@ -199,7 +199,7 @@ discard block | ||
| 199 | 199 | $values['ownerID'] = '$ownerID'; | 
| 200 | 200 | } | 
| 201 | 201 | uksort($values, | 
| 202 | -            function ($alpha, $beta) { | |
| 202 | +            function($alpha, $beta) { | |
| 203 | 203 | return strtolower($alpha) <=> strtolower($beta); | 
| 204 | 204 | }); | 
| 205 | 205 | $this->tables[$tableName] = ['values' => $values]; | 
| @@ -209,7 +209,7 @@ discard block | ||
| 209 | 209 | */ | 
| 210 | 210 | private function getNamespace(): string | 
| 211 | 211 |      { | 
| 212 | - return 'Yapeal\EveApi\\' . ucfirst($this->sectionName); | |
| 212 | + return 'Yapeal\EveApi\\'.ucfirst($this->sectionName); | |
| 213 | 213 | } | 
| 214 | 214 | /** | 
| 215 | 215 | * Used to determine if API is in section that has an owner. | 
| @@ -228,24 +228,24 @@ | ||
| 228 | 228 | } | 
| 229 | 229 | $name = strtolower($name); | 
| 230 | 230 | foreach ([ | 
| 231 | - 'descr' => 'TEXT NOT NULL', | |
| 232 | - 'name' => 'CHAR(100) NOT NULL', | |
| 233 | - 'balance' => 'DECIMAL(17, 2) NOT NULL', | |
| 234 | - 'isk' => 'DECIMAL(17, 2) NOT NULL', | |
| 235 | - 'tax' => 'DECIMAL(17, 2) NOT NULL', | |
| 236 | - 'timeefficiency' => 'TINYINT(3) UNSIGNED NOT NULL', | |
| 237 | - 'date' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 238 | - 'time' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 239 | - 'until' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 240 | - 'errorcode' => 'SMALLINT(4) UNSIGNED NOT NULL', | |
| 241 | - 'level' => 'SMALLINT(4) UNSIGNED NOT NULL', | |
| 242 | - 'logoncount' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 243 | - 'logonminutes' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 244 | - 'trainingend' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 245 | - 'skillintraining' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 246 | - 'trainingdestinationsp' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 247 | - 'trainingstartsp' => 'BIGINT(20) UNSIGNED NOT NULL' | |
| 248 | -                 ] as $search => $replace) { | |
| 231 | + 'descr' => 'TEXT NOT NULL', | |
| 232 | + 'name' => 'CHAR(100) NOT NULL', | |
| 233 | + 'balance' => 'DECIMAL(17, 2) NOT NULL', | |
| 234 | + 'isk' => 'DECIMAL(17, 2) NOT NULL', | |
| 235 | + 'tax' => 'DECIMAL(17, 2) NOT NULL', | |
| 236 | + 'timeefficiency' => 'TINYINT(3) UNSIGNED NOT NULL', | |
| 237 | + 'date' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 238 | + 'time' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 239 | + 'until' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 240 | + 'errorcode' => 'SMALLINT(4) UNSIGNED NOT NULL', | |
| 241 | + 'level' => 'SMALLINT(4) UNSIGNED NOT NULL', | |
| 242 | + 'logoncount' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 243 | + 'logonminutes' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 244 | + 'trainingend' => 'DATETIME NOT NULL DEFAULT \'1970-01-01 00:00:01\'', | |
| 245 | + 'skillintraining' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 246 | + 'trainingdestinationsp' => 'BIGINT(20) UNSIGNED NOT NULL', | |
| 247 | + 'trainingstartsp' => 'BIGINT(20) UNSIGNED NOT NULL' | |
| 248 | +                    ] as $search => $replace) { | |
| 249 | 249 |              if (false !== strpos($name, $search)) { | 
| 250 | 250 | return $replace; | 
| 251 | 251 | } | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | $this->setRelativeBaseDir($dir); | 
| 55 | 55 | $this->setPlatform($platform); | 
| 56 | 56 | $this->setTwig($twig); | 
| 57 | - $this->twigExtension = strtolower($platform) . '.sql.twig'; | |
| 57 | + $this->twigExtension = strtolower($platform).'.sql.twig'; | |
| 58 | 58 | } | 
| 59 | 59 | /** | 
| 60 | 60 | * @param EveApiEventInterface $event | 
| @@ -108,7 +108,7 @@ discard block | ||
| 108 | 108 | 'className' => lcfirst($this->apiName), | 
| 109 | 109 | 'tables' => $this->tables, | 
| 110 | 110 | 'sectionName' => lcfirst($this->sectionName), | 
| 111 | -            'version' => gmdate('YmdHis', $sec) . substr($mSec, 1, 4) | |
| 111 | +            'version' => gmdate('YmdHis', $sec).substr($mSec, 1, 4) | |
| 112 | 112 | ]; | 
| 113 | 113 | $contents = $this->getContentsFromTwig($eventName, $data, $context); | 
| 114 | 114 |          if (false === $contents) { | 
| @@ -158,7 +158,7 @@ discard block | ||
| 158 | 158 | $columns['ownerID'] = 'BIGINT(20) UNSIGNED NOT NULL'; | 
| 159 | 159 | } | 
| 160 | 160 | uksort($columns, | 
| 161 | -                function ($alpha, $beta) { | |
| 161 | +                function($alpha, $beta) { | |
| 162 | 162 | return strtolower($alpha) <=> strtolower($beta); | 
| 163 | 163 | }); | 
| 164 | 164 |              if (0 === count($this->tables)) { | 
| @@ -191,7 +191,7 @@ discard block | ||
| 191 | 191 | $columns['ownerID'] = 'BIGINT(20) UNSIGNED NOT NULL'; | 
| 192 | 192 | } | 
| 193 | 193 | uksort($columns, | 
| 194 | -            function ($alpha, $beta) { | |
| 194 | +            function($alpha, $beta) { | |
| 195 | 195 | return strtolower($alpha) <=> strtolower($beta); | 
| 196 | 196 | }); | 
| 197 | 197 | $keys = $this->getSqlKeys(); | 
| @@ -50,7 +50,7 @@ | ||
| 50 | 50 | public function wire(ContainerInterface $dic) | 
| 51 | 51 |      { | 
| 52 | 52 |          if (empty($dic['Yapeal.Xsl.Transformer'])) { | 
| 53 | -            $dic['Yapeal.Xsl.Transformer'] = function () use ($dic) { | |
| 53 | +            $dic['Yapeal.Xsl.Transformer'] = function() use ($dic) { | |
| 54 | 54 | return new $dic['Yapeal.Xsl.transform']($dic['Yapeal.Xsl.dir']); | 
| 55 | 55 | }; | 
| 56 | 56 | } |