@@ -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 | { |
@@ -97,21 +97,21 @@ discard block |
||
97 | 97 | $rowCount = count($columns) / count($columnNames); |
98 | 98 | $mess = sprintf('Have %1$s row(s) to upsert into %2$s table', $rowCount, $tableName); |
99 | 99 | $this->getYem() |
100 | - ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $mess); |
|
100 | + ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $mess); |
|
101 | 101 | $sql = $this->getCsq() |
102 | 102 | ->getUpsert($tableName, $columnNames, $rowCount); |
103 | 103 | $mess = preg_replace('/(,\(\?(?:,\?)*\))+/', ',...', $sql); |
104 | 104 | $this->getYem() |
105 | - ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $mess); |
|
105 | + ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $mess); |
|
106 | 106 | $mess = implode(',', $columns); |
107 | 107 | if (512 < strlen($mess)) { |
108 | 108 | $mess = substr($mess, 0, 512) . '...'; |
109 | 109 | } |
110 | 110 | $this->getYem() |
111 | - ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $mess); |
|
111 | + ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $mess); |
|
112 | 112 | $this->getPdo() |
113 | - ->prepare($sql) |
|
114 | - ->execute($columns); |
|
113 | + ->prepare($sql) |
|
114 | + ->execute($columns); |
|
115 | 115 | return $this; |
116 | 116 | } |
117 | 117 | /** |
@@ -206,30 +206,30 @@ discard block |
||
206 | 206 | return $event->setHandledSufficiently(); |
207 | 207 | } |
208 | 208 | $this->getYem() |
209 | - ->triggerLogEvent( |
|
210 | - 'Yapeal.Log.log', |
|
211 | - Logger::DEBUG, |
|
212 | - $this->getReceivedEventMessage($data, $eventName, __CLASS__) |
|
213 | - ); |
|
209 | + ->triggerLogEvent( |
|
210 | + 'Yapeal.Log.log', |
|
211 | + Logger::DEBUG, |
|
212 | + $this->getReceivedEventMessage($data, $eventName, __CLASS__) |
|
213 | + ); |
|
214 | 214 | $this->getPdo() |
215 | - ->beginTransaction(); |
|
215 | + ->beginTransaction(); |
|
216 | 216 | try { |
217 | 217 | foreach ($this->getPreserveTos() as $preserveTo) { |
218 | 218 | $this->$preserveTo($data); |
219 | 219 | } |
220 | 220 | $this->getPdo() |
221 | - ->commit(); |
|
221 | + ->commit(); |
|
222 | 222 | } catch (\PDOException $exc) { |
223 | 223 | $mess = 'Failed to upsert data of'; |
224 | 224 | $this->getYem() |
225 | - ->triggerLogEvent( |
|
226 | - 'Yapeal.Log.log', |
|
227 | - Logger::WARNING, |
|
228 | - $this->createEveApiMessage($mess, $data), |
|
229 | - ['exception' => $exc] |
|
230 | - ); |
|
225 | + ->triggerLogEvent( |
|
226 | + 'Yapeal.Log.log', |
|
227 | + Logger::WARNING, |
|
228 | + $this->createEveApiMessage($mess, $data), |
|
229 | + ['exception' => $exc] |
|
230 | + ); |
|
231 | 231 | $this->getPdo() |
232 | - ->rollBack(); |
|
232 | + ->rollBack(); |
|
233 | 233 | return $event; |
234 | 234 | } |
235 | 235 | return $event->setHandledSufficiently(); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getPreserveTos() |
50 | 50 | { |
51 | - if (0 === count($this->preserveTos)){ |
|
51 | + if (0 === count($this->preserveTos)) { |
|
52 | 52 | $mess = 'Tried to access preserveTos before it was set'; |
53 | 53 | throw new \LogicException($mess); |
54 | 54 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $mess); |
106 | 106 | $mess = implode(',', $columns); |
107 | 107 | if (512 < strlen($mess)) { |
108 | - $mess = substr($mess, 0, 512) . '...'; |
|
108 | + $mess = substr($mess, 0, 512).'...'; |
|
109 | 109 | } |
110 | 110 | $this->getYem() |
111 | 111 | ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $mess); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (!empty($dic['Yapeal.Error.Logger'])) { |
54 | 54 | return $this; |
55 | 55 | } |
56 | - $dic['Yapeal.Error.Logger'] = function ($dic) { |
|
56 | + $dic['Yapeal.Error.Logger'] = function($dic) { |
|
57 | 57 | /** |
58 | 58 | * @var Logger $logger |
59 | 59 | */ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $handler = new $dic['Yapeal.Error.Handlers.stream']('php://stderr', 100); |
70 | 70 | $group[] = $handler->setFormatter($lineFormatter); |
71 | 71 | } |
72 | - $handler = new $dic['Yapeal.Error.Handlers.stream']($dic['Yapeal.Error.dir'] . $dic['Yapeal.Error.fileName'], |
|
72 | + $handler = new $dic['Yapeal.Error.Handlers.stream']($dic['Yapeal.Error.dir'].$dic['Yapeal.Error.fileName'], |
|
73 | 73 | 100); |
74 | 74 | $group[] = $handler->setFormatter($lineFormatter); |
75 | 75 | $logger->pushHandler( |
@@ -56,16 +56,16 @@ |
||
56 | 56 | protected function addOptions($help) |
57 | 57 | { |
58 | 58 | $this->addOption('configFile', 'c', InputOption::VALUE_REQUIRED, 'Configuration file to get settings from.') |
59 | - ->addOption('database', 'd', InputOption::VALUE_REQUIRED, 'Name of the database.') |
|
60 | - ->addOption('hostName', 'o', InputOption::VALUE_REQUIRED, 'Host name for database server.') |
|
61 | - ->addOption('password', 'p', InputOption::VALUE_REQUIRED, 'Password used to access database.') |
|
62 | - ->addOption('platform', null, InputOption::VALUE_REQUIRED, |
|
63 | - 'Platform of database driver. Currently only "mysql" can be used.') |
|
64 | - ->addOption('port', null, InputOption::VALUE_REQUIRED, |
|
65 | - 'Port number for remote server. Only needed if using http connection.') |
|
66 | - ->addOption('tablePrefix', 't', InputOption::VALUE_REQUIRED, 'Prefix for database table names.') |
|
67 | - ->addOption('userName', 'u', InputOption::VALUE_REQUIRED, 'User name used to access database.') |
|
68 | - ->setHelp($help); |
|
59 | + ->addOption('database', 'd', InputOption::VALUE_REQUIRED, 'Name of the database.') |
|
60 | + ->addOption('hostName', 'o', InputOption::VALUE_REQUIRED, 'Host name for database server.') |
|
61 | + ->addOption('password', 'p', InputOption::VALUE_REQUIRED, 'Password used to access database.') |
|
62 | + ->addOption('platform', null, InputOption::VALUE_REQUIRED, |
|
63 | + 'Platform of database driver. Currently only "mysql" can be used.') |
|
64 | + ->addOption('port', null, InputOption::VALUE_REQUIRED, |
|
65 | + 'Port number for remote server. Only needed if using http connection.') |
|
66 | + ->addOption('tablePrefix', 't', InputOption::VALUE_REQUIRED, 'Prefix for database table names.') |
|
67 | + ->addOption('userName', 'u', InputOption::VALUE_REQUIRED, 'User name used to access database.') |
|
68 | + ->setHelp($help); |
|
69 | 69 | } |
70 | 70 | /** @noinspection PhpMissingParentCallCommonInspection */ |
71 | 71 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | $statements = str_replace(array_keys($replacements), array_values($replacements), explode(';', $sqlStatements)); |
119 | 119 | // 5 is a 'magic' number that I think is shorter than any legal SQL statement. |
120 | - $statements = array_filter($statements, function ($value) { |
|
120 | + $statements = array_filter($statements, function($value) { |
|
121 | 121 | return 5 <= strlen(trim($value)); |
122 | 122 | }); |
123 | 123 | $progress = null; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $progress->finish(); |
146 | 146 | $output->writeln(''); |
147 | 147 | } |
148 | - $mess = $sql . PHP_EOL; |
|
148 | + $mess = $sql.PHP_EOL; |
|
149 | 149 | $mess .= sprintf( |
150 | 150 | 'Sql failed in %1$s on statement %2$s with (%3$s) %4$s', |
151 | 151 | $fileName, |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $base = 'Yapeal.Sql.'; |
174 | 174 | foreach (['class', 'database', 'hostName', 'password', 'platform', 'tablePrefix', 'userName'] as $option) { |
175 | 175 | if (!empty($options[$option])) { |
176 | - $this->getDic()[$base . $option] = $options[$option]; |
|
176 | + $this->getDic()[$base.$option] = $options[$option]; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | if (!empty($options['configFile'])) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $name = 'DatabaseUpdater::dropDatabaseProcedure'; |
114 | 114 | $this->executeSqlStatements($this->getCsq() |
115 | - ->getDropAddOrModifyColumnProcedure(), $name, $output); |
|
115 | + ->getDropAddOrModifyColumnProcedure(), $name, $output); |
|
116 | 116 | } |
117 | 117 | /** |
118 | 118 | * @param OutputInterface $output |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | ->getUtilLatestDatabaseVersion(); |
128 | 128 | try { |
129 | 129 | $result = $this->getPdo() |
130 | - ->query($sql, \PDO::FETCH_NUM); |
|
130 | + ->query($sql, \PDO::FETCH_NUM); |
|
131 | 131 | $version = sprintf('%018.3F', $result->fetchColumn()); |
132 | 132 | $result->closeCursor(); |
133 | 133 | } catch (\PDOException $exc) { |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | $updateVersion |
247 | 247 | ); |
248 | 248 | if ($this->getPdo() |
249 | - ->inTransaction() |
|
249 | + ->inTransaction() |
|
250 | 250 | ) { |
251 | 251 | $this->getPdo() |
252 | - ->rollBack(); |
|
252 | + ->rollBack(); |
|
253 | 253 | } |
254 | 254 | throw new YapealDatabaseException($mess, 2); |
255 | 255 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if ('Database' === $dir && $this->dropDatabase) { |
107 | 107 | // Add drop database file if requested. |
108 | 108 | $fileList[] = $this->getFpn() |
109 | - ->normalizeFile($path . $dir . '/DropDatabase.sql'); |
|
109 | + ->normalizeFile($path . $dir . '/DropDatabase.sql'); |
|
110 | 110 | } |
111 | 111 | foreach (new \DirectoryIterator($path . $dir . '/') as $fileInfo) { |
112 | 112 | // Add file path if it's a sql create file. |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | && 0 === strpos($fileInfo->getBasename(), 'Create') |
116 | 116 | ) { |
117 | 117 | $fileList[] = $this->getFpn() |
118 | - ->normalizeFile($fileInfo->getPathname()); |
|
118 | + ->normalizeFile($fileInfo->getPathname()); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -106,9 +106,9 @@ |
||
106 | 106 | if ('Database' === $dir && $this->dropDatabase) { |
107 | 107 | // Add drop database file if requested. |
108 | 108 | $fileList[] = $this->getFpn() |
109 | - ->normalizeFile($path . $dir . '/DropDatabase.sql'); |
|
109 | + ->normalizeFile($path.$dir.'/DropDatabase.sql'); |
|
110 | 110 | } |
111 | - foreach (new \DirectoryIterator($path . $dir . '/') as $fileInfo) { |
|
111 | + foreach (new \DirectoryIterator($path.$dir.'/') as $fileInfo) { |
|
112 | 112 | // Add file path if it's a sql create file. |
113 | 113 | if ($fileInfo->isFile() |
114 | 114 | && 'sql' === $fileInfo->getExtension() |
@@ -67,9 +67,9 @@ |
||
67 | 67 | $sql = $this->getCsq() |
68 | 68 | ->getDeleteFromTable($tableName); |
69 | 69 | $this->getYem() |
70 | - ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $sql); |
|
70 | + ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $sql); |
|
71 | 71 | $this->getPdo() |
72 | - ->exec($sql); |
|
72 | + ->exec($sql); |
|
73 | 73 | $columnDefaults = [ |
74 | 74 | 'errorCode' => null, |
75 | 75 | 'errorText' => null |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return []; |
82 | 82 | } |
83 | 83 | $this->getYem() |
84 | - ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $sql); |
|
84 | + ->triggerLogEvent('Yapeal.Log.log', Logger::DEBUG, $sql); |
|
85 | 85 | try { |
86 | 86 | return $this->getPdo() |
87 | 87 | ->query($sql) |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | } catch (PDOException $exc) { |
90 | 90 | $mess = 'Could NOT get a list of active owners for'; |
91 | 91 | $this->getYem() |
92 | - ->triggerLogEvent( |
|
93 | - 'Yapeal.Log.log', |
|
94 | - Logger::WARNING, |
|
95 | - $this->createEveApiMessage($mess, $data), |
|
96 | - ['exception' => $exc] |
|
97 | - ); |
|
92 | + ->triggerLogEvent( |
|
93 | + 'Yapeal.Log.log', |
|
94 | + Logger::WARNING, |
|
95 | + $this->createEveApiMessage($mess, $data), |
|
96 | + ['exception' => $exc] |
|
97 | + ); |
|
98 | 98 | return []; |
99 | 99 | } |
100 | 100 | } |
@@ -66,30 +66,30 @@ |
||
66 | 66 | } |
67 | 67 | $ownerID = $this->extractOwnerID($data->getEveApiArguments()); |
68 | 68 | $this->getYem() |
69 | - ->triggerLogEvent( |
|
70 | - 'Yapeal.Log.log', |
|
71 | - Logger::DEBUG, |
|
72 | - $this->getReceivedEventMessage($data, $eventName, __CLASS__) |
|
73 | - ); |
|
69 | + ->triggerLogEvent( |
|
70 | + 'Yapeal.Log.log', |
|
71 | + Logger::DEBUG, |
|
72 | + $this->getReceivedEventMessage($data, $eventName, __CLASS__) |
|
73 | + ); |
|
74 | 74 | $this->getPdo() |
75 | - ->beginTransaction(); |
|
75 | + ->beginTransaction(); |
|
76 | 76 | try { |
77 | 77 | $this->preserveToAPIKeyInfo($xml, $ownerID) |
78 | - ->preserveToCharacters($xml) |
|
79 | - ->preserveToKeyBridge($xml, $ownerID); |
|
78 | + ->preserveToCharacters($xml) |
|
79 | + ->preserveToKeyBridge($xml, $ownerID); |
|
80 | 80 | $this->getPdo() |
81 | - ->commit(); |
|
81 | + ->commit(); |
|
82 | 82 | } catch (PDOException $exc) { |
83 | 83 | $mess = 'Failed to upsert data of'; |
84 | 84 | $this->getYem() |
85 | - ->triggerLogEvent( |
|
86 | - 'Yapeal.Log.log', |
|
87 | - Logger::WARNING, |
|
88 | - $this->createEveApiMessage($mess, $data), |
|
89 | - ['exception' => $exc] |
|
90 | - ); |
|
85 | + ->triggerLogEvent( |
|
86 | + 'Yapeal.Log.log', |
|
87 | + Logger::WARNING, |
|
88 | + $this->createEveApiMessage($mess, $data), |
|
89 | + ['exception' => $exc] |
|
90 | + ); |
|
91 | 91 | $this->getPdo() |
92 | - ->rollBack(); |
|
92 | + ->rollBack(); |
|
93 | 93 | return $event; |
94 | 94 | } |
95 | 95 | return $event->setHandledSufficiently(); |
@@ -74,30 +74,30 @@ discard block |
||
74 | 74 | } |
75 | 75 | $ownerID = $this->extractOwnerID($data->getEveApiArguments()); |
76 | 76 | $this->getYem() |
77 | - ->triggerLogEvent( |
|
78 | - 'Yapeal.Log.log', |
|
79 | - Logger::DEBUG, |
|
80 | - $this->getReceivedEventMessage($data, $eventName, __CLASS__) |
|
81 | - ); |
|
77 | + ->triggerLogEvent( |
|
78 | + 'Yapeal.Log.log', |
|
79 | + Logger::DEBUG, |
|
80 | + $this->getReceivedEventMessage($data, $eventName, __CLASS__) |
|
81 | + ); |
|
82 | 82 | $this->getPdo() |
83 | - ->beginTransaction(); |
|
83 | + ->beginTransaction(); |
|
84 | 84 | try { |
85 | 85 | $this->preserveToAccountStatus($xml, $ownerID) |
86 | - ->preserveToMultiCharacterTraining($xml, $ownerID) |
|
87 | - ->preserveToOffers($xml, $ownerID); |
|
86 | + ->preserveToMultiCharacterTraining($xml, $ownerID) |
|
87 | + ->preserveToOffers($xml, $ownerID); |
|
88 | 88 | $this->getPdo() |
89 | - ->commit(); |
|
89 | + ->commit(); |
|
90 | 90 | } catch (PDOException $exc) { |
91 | 91 | $mess = 'Failed to upsert data of'; |
92 | 92 | $this->getYem() |
93 | - ->triggerLogEvent( |
|
94 | - 'Yapeal.Log.log', |
|
95 | - Logger::WARNING, |
|
96 | - $this->createEveApiMessage($mess, $data), |
|
97 | - ['exception' => $exc] |
|
98 | - ); |
|
93 | + ->triggerLogEvent( |
|
94 | + 'Yapeal.Log.log', |
|
95 | + Logger::WARNING, |
|
96 | + $this->createEveApiMessage($mess, $data), |
|
97 | + ['exception' => $exc] |
|
98 | + ); |
|
99 | 99 | $this->getPdo() |
100 | - ->rollBack(); |
|
100 | + ->rollBack(); |
|
101 | 101 | return $event; |
102 | 102 | } |
103 | 103 | return $event->setHandledSufficiently(); |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | $sql = $this->getCsq() |
116 | 116 | ->getDeleteFromTableWithOwnerID($tableName, $ownerID); |
117 | 117 | $this->getYem() |
118 | - ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $sql); |
|
118 | + ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $sql); |
|
119 | 119 | $this->getPdo() |
120 | - ->exec($sql); |
|
120 | + ->exec($sql); |
|
121 | 121 | $columnDefaults = [ |
122 | 122 | 'createDate' => '1970-01-01 00:00:01', |
123 | 123 | 'logonCount' => null, |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | $sql = $this->getCsq() |
143 | 143 | ->getDeleteFromTableWithOwnerID($tableName, $ownerID); |
144 | 144 | $this->getYem() |
145 | - ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $sql); |
|
145 | + ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $sql); |
|
146 | 146 | $this->getPdo() |
147 | - ->exec($sql); |
|
147 | + ->exec($sql); |
|
148 | 148 | $columnDefaults = [ |
149 | 149 | 'ownerID' => $ownerID, |
150 | 150 | 'trainingEnd' => null |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $sql = $this->getCsq() |
166 | 166 | ->getDeleteFromTableWithOwnerID($tableName, $ownerID); |
167 | 167 | $this->getYem() |
168 | - ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $sql); |
|
168 | + ->triggerLogEvent('Yapeal.Log.log', Logger::INFO, $sql); |
|
169 | 169 | $this->getPdo() |
170 | - ->exec($sql); |
|
170 | + ->exec($sql); |
|
171 | 171 | $columnDefaults = [ |
172 | 172 | 'from' => null, |
173 | 173 | 'ISK' => '0.0', |