@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Log messages to a database table. |
| 17 | - * |
|
| 17 | + * |
|
| 18 | 18 | * @package MW |
| 19 | 19 | * @subpackage Logger |
| 20 | 20 | */ |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $this->facilities = $facilities; |
| 46 | 46 | |
| 47 | 47 | if( $requestid === null ) { |
| 48 | - $requestid = md5( php_uname('n') . getmypid() . date( 'Y-m-d H:i:s' ) ); |
|
| 48 | + $requestid = md5( php_uname( 'n' ) . getmypid() . date( 'Y-m-d H:i:s' ) ); |
|
| 49 | 49 | } |
| 50 | 50 | $this->requestid = $requestid; |
| 51 | 51 | } |
@@ -100,10 +100,14 @@ |
||
| 100 | 100 | $type->setLabel( $dataset['label'] ); |
| 101 | 101 | $type->setStatus( $dataset['status'] ); |
| 102 | 102 | |
| 103 | - try { |
|
| 103 | + try |
|
| 104 | + { |
|
| 104 | 105 | $domainManager->saveItem( $type ); |
| 105 | 106 | $num++; |
| 106 | - } catch( \Exception $e ) { ; } // if type was already available |
|
| 107 | + } |
|
| 108 | + catch( \Exception $e ) |
|
| 109 | + { |
|
| 110 | +; } // if type was already available |
|
| 107 | 111 | } |
| 108 | 112 | |
| 109 | 113 | $this->status( $num > 0 ? $num . '/' . $total : 'OK' ); |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | try { |
| 101 | 101 | $domainManager->saveItem( $type ); |
| 102 | 102 | $num++; |
| 103 | - } catch( \Exception $e ) { ; } // if type was already available |
|
| 103 | + } catch( \Exception $e ) {; } // if type was already available |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $this->status( $num > 0 ? $num . '/' . $total : 'OK' ); |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | |
| 162 | 162 | $stmt->bind( 1, $date ); |
| 163 | 163 | $stmt->bind( 2, substr( $date, 0, 7 ) ); |
| 164 | - $stmt->bind( 3, date_create_from_format( 'Y-m-d', $date )->format( 'Y-W' ) ); |
|
| 164 | + $stmt->bind( 3, date_create_from_format( 'Y-m-d', $date )->format( 'Y-W' ) ); |
|
| 165 | 165 | $stmt->bind( 4, substr( $time, 0, 2 ) ); |
| 166 | 166 | $stmt->bind( 5, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
| 167 | 167 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | return array( |
| 10 | 10 | 'table' => array( |
| 11 | - 'mshop_stock_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
| 11 | + 'mshop_stock_type' => function( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
| 12 | 12 | |
| 13 | 13 | $table = $schema->createTable( 'mshop_stock_type' ); |
| 14 | 14 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | return $schema; |
| 32 | 32 | }, |
| 33 | 33 | |
| 34 | - 'mshop_stock' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
| 34 | + 'mshop_stock' => function( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
| 35 | 35 | |
| 36 | 36 | $table = $schema->createTable( 'mshop_stock' ); |
| 37 | 37 | |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $this->execute( $stmt ); |
| 74 | 74 | $this->status( 'done' ); |
| 75 | - } |
|
| 76 | - else |
|
| 75 | + } else |
|
| 77 | 76 | { |
| 78 | 77 | $this->status( 'OK' ); |
| 79 | 78 | } |
@@ -86,8 +85,7 @@ discard block |
||
| 86 | 85 | { |
| 87 | 86 | $this->executeList( $this->updates ); |
| 88 | 87 | $this->status( 'done' ); |
| 89 | - } |
|
| 90 | - else |
|
| 88 | + } else |
|
| 91 | 89 | { |
| 92 | 90 | $this->status( 'OK' ); |
| 93 | 91 | } |
@@ -101,8 +99,7 @@ discard block |
||
| 101 | 99 | { |
| 102 | 100 | $this->execute( $stmt ); |
| 103 | 101 | $this->status( 'done' ); |
| 104 | - } |
|
| 105 | - else |
|
| 102 | + } else |
|
| 106 | 103 | { |
| 107 | 104 | $this->status( 'OK' ); |
| 108 | 105 | } |
@@ -114,8 +111,7 @@ discard block |
||
| 114 | 111 | { |
| 115 | 112 | $this->execute( $this->column ); |
| 116 | 113 | $this->status( 'done' ); |
| 117 | - } |
|
| 118 | - else |
|
| 114 | + } else |
|
| 119 | 115 | { |
| 120 | 116 | $this->status( 'OK' ); |
| 121 | 117 | } |
@@ -266,10 +266,13 @@ |
||
| 266 | 266 | |
| 267 | 267 | $conn = $this->object->acquire(); |
| 268 | 268 | |
| 269 | - try { |
|
| 269 | + try |
|
| 270 | + { |
|
| 270 | 271 | $stmt = $conn->create( $sqlinsert ); |
| 271 | 272 | $stmt->execute(); |
| 272 | - } catch ( \Aimeos\MW\DB\Exception $de ) { |
|
| 273 | + } |
|
| 274 | + catch ( \Aimeos\MW\DB\Exception $de ) |
|
| 275 | + { |
|
| 273 | 276 | $this->object->release( $conn ); |
| 274 | 277 | return; |
| 275 | 278 | } |
@@ -248,12 +248,12 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | public function testStmtSimpleBindTwo() |
| 250 | 250 | { |
| 251 | - $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
| 251 | + $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
| 252 | 252 | |
| 253 | 253 | $conn = $this->object->acquire(); |
| 254 | 254 | |
| 255 | 255 | $stmt2 = $conn->create( $sqlinsert2 ); |
| 256 | - $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 256 | + $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 257 | 257 | $stmt2->bind( 2, 0.12 ); |
| 258 | 258 | $stmt2->execute()->finish(); |
| 259 | 259 | |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | public function testStmtSimpleBindThree() |
| 267 | 267 | { |
| 268 | - $sqlinsert3 = 'INSERT INTO "mw_unit_test" ("name", "id") VALUES (\'?te?st?\', ?)'; |
|
| 268 | + $sqlinsert3 = 'INSERT INTO "mw_unit_test" ("name", "id") VALUES (\'?te?st?\', ?)'; |
|
| 269 | 269 | |
| 270 | 270 | $conn = $this->object->acquire(); |
| 271 | 271 | |
| 272 | 272 | $stmt2 = $conn->create( $sqlinsert3 ); |
| 273 | - $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 273 | + $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 274 | 274 | $stmt2->execute()->finish(); |
| 275 | 275 | |
| 276 | 276 | $this->object->release( $conn ); |
@@ -281,15 +281,15 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | public function testStmtSimpleInvalidBindParamType() |
| 283 | 283 | { |
| 284 | - $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
| 284 | + $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
| 285 | 285 | |
| 286 | 286 | $conn = $this->object->acquire(); |
| 287 | 287 | |
| 288 | 288 | try |
| 289 | 289 | { |
| 290 | 290 | $stmt2 = $conn->create( $sqlinsert2 ); |
| 291 | - $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 292 | - $stmt2->bind( 2, 0.15, 123); |
|
| 291 | + $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 292 | + $stmt2->bind( 2, 0.15, 123 ); |
|
| 293 | 293 | $stmt2->execute(); |
| 294 | 294 | } |
| 295 | 295 | catch( \Aimeos\MW\DB\Exception $de ) |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | $this->object->release( $conn ); |
| 302 | - $this->fail('An expected exception has not been raised'); |
|
| 302 | + $this->fail( 'An expected exception has not been raised' ); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
@@ -312,13 +312,13 @@ discard block |
||
| 312 | 312 | try { |
| 313 | 313 | $stmt = $conn->create( $sqlinsert ); |
| 314 | 314 | $stmt->execute(); |
| 315 | - } catch ( \Aimeos\MW\DB\Exception $de ) { |
|
| 315 | + } catch( \Aimeos\MW\DB\Exception $de ) { |
|
| 316 | 316 | $this->object->release( $conn ); |
| 317 | 317 | return; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | $this->object->release( $conn ); |
| 321 | - $this->fail('An expected exception has not been raised'); |
|
| 321 | + $this->fail( 'An expected exception has not been raised' ); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $stmt->bind( 2, 'test', 123 ); |
| 434 | 434 | $stmt->execute(); |
| 435 | 435 | } |
| 436 | - catch ( \Aimeos\MW\DB\Exception $e ) |
|
| 436 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 437 | 437 | { |
| 438 | 438 | $this->object->release( $conn ); |
| 439 | 439 | throw $e; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | { |
| 464 | 464 | $conn->create( $sql )->execute()->finish(); |
| 465 | 465 | } |
| 466 | - catch ( \Aimeos\MW\DB\Exception $e ) |
|
| 466 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 467 | 467 | { |
| 468 | 468 | $this->object->release( $conn ); |
| 469 | 469 | throw $e; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | { |
| 482 | 482 | $conn->create( 'SELECT *' )->execute()->finish(); |
| 483 | 483 | } |
| 484 | - catch ( \Aimeos\MW\DB\Exception $e ) |
|
| 484 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 485 | 485 | { |
| 486 | 486 | $this->object->release( $conn ); |
| 487 | 487 | throw $e; |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | { |
| 502 | 502 | $conn->create( $sql, 123 ); |
| 503 | 503 | } |
| 504 | - catch ( \Aimeos\MW\DB\Exception $e ) |
|
| 504 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 505 | 505 | { |
| 506 | 506 | $this->object->release( $conn ); |
| 507 | 507 | throw $e; |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | public function testDBFactory() |
| 522 | 522 | { |
| 523 | - $this->assertInstanceOf(\Aimeos\MW\DB\Manager\Iface::class, $this->object); |
|
| 523 | + $this->assertInstanceOf( \Aimeos\MW\DB\Manager\Iface::class, $this->object ); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * Undo all schema changes and migrate data back |
| 64 | 64 | * |
| 65 | 65 | * @return void |
| 66 | - */ |
|
| 66 | + */ |
|
| 67 | 67 | public function rollback() |
| 68 | 68 | { |
| 69 | 69 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * Cleans up old data required for roll back |
| 74 | 74 | * |
| 75 | 75 | * @return void |
| 76 | - */ |
|
| 76 | + */ |
|
| 77 | 77 | public function clean() |
| 78 | 78 | { |
| 79 | 79 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | protected function msg( $msg, $level = 0, $status = null ) |
| 235 | 235 | { |
| 236 | 236 | $pre = ''; |
| 237 | - for( $i = 0; $i < 2*$level; $i++ ) { |
|
| 237 | + for( $i = 0; $i < 2 * $level; $i++ ) { |
|
| 238 | 238 | $pre .= ' '; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | $matches = []; |
| 266 | 266 | |
| 267 | 267 | $regex = '/CREATE TABLE \"?([a-zA-Z0-9_]+)\"? .*(\n\n|$)/sU'; |
| 268 | - if ( preg_match_all($regex, $content, $matches, PREG_SET_ORDER) === false ) { |
|
| 269 | - throw new \Aimeos\MW\Setup\Exception('Unable to get table definitions'); |
|
| 268 | + if( preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) === false ) { |
|
| 269 | + throw new \Aimeos\MW\Setup\Exception( 'Unable to get table definitions' ); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - foreach ( $matches as $match ) { |
|
| 272 | + foreach( $matches as $match ) { |
|
| 273 | 273 | $defs[$match[1]] = $match[0]; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -288,11 +288,11 @@ discard block |
||
| 288 | 288 | $defs = []; |
| 289 | 289 | $matches = []; |
| 290 | 290 | |
| 291 | - if ( preg_match_all('/CREATE [a-zA-Z]* ?INDEX \"?([a-zA-Z0-9_]+)\"? ON \"?([a-zA-Z0-9_]+)\"? .+(\n\n|$)/sU', $content, $matches, PREG_SET_ORDER) === false ) { |
|
| 292 | - throw new \Aimeos\MW\Setup\Exception('Unable to get index definitions'); |
|
| 291 | + if( preg_match_all( '/CREATE [a-zA-Z]* ?INDEX \"?([a-zA-Z0-9_]+)\"? ON \"?([a-zA-Z0-9_]+)\"? .+(\n\n|$)/sU', $content, $matches, PREG_SET_ORDER ) === false ) { |
|
| 292 | + throw new \Aimeos\MW\Setup\Exception( 'Unable to get index definitions' ); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - foreach ( $matches as $match ) { |
|
| 295 | + foreach( $matches as $match ) { |
|
| 296 | 296 | $name = $match[2] . '.' . $match[1]; |
| 297 | 297 | $defs[$name] = $match[0]; |
| 298 | 298 | } |
@@ -313,11 +313,11 @@ discard block |
||
| 313 | 313 | $matches = []; |
| 314 | 314 | |
| 315 | 315 | $regex = '/CREATE TRIGGER \"?([a-zA-Z0-9_]+)\"? .*(\n\n|$)/sU'; |
| 316 | - if ( preg_match_all($regex, $content, $matches, PREG_SET_ORDER) === false ) { |
|
| 317 | - throw new \Aimeos\MW\Setup\Exception('Unable to get trigger definitions'); |
|
| 316 | + if( preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) === false ) { |
|
| 317 | + throw new \Aimeos\MW\Setup\Exception( 'Unable to get trigger definitions' ); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - foreach ( $matches as $match ) { |
|
| 320 | + foreach( $matches as $match ) { |
|
| 321 | 321 | $defs[$match[1]] = $match[0]; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @param string $version HTTP protocol version |
| 105 | 105 | * @return self |
| 106 | - */ |
|
| 106 | + */ |
|
| 107 | 107 | public function withProtocolVersion( $version ) |
| 108 | 108 | { |
| 109 | 109 | $this->response = $this->response->withProtocolVersion( $version ); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return string[][] Returns an associative array of the message's headers. |
| 118 | 118 | * Each key MUST be a header name, and each value MUST be an array of |
| 119 | 119 | * strings for that header. |
| 120 | - */ |
|
| 120 | + */ |
|
| 121 | 121 | public function getHeaders() |
| 122 | 122 | { |
| 123 | 123 | return $this->response->getHeaders(); |
@@ -104,9 +104,12 @@ |
||
| 104 | 104 | */ |
| 105 | 105 | public function scan( $path = null ) |
| 106 | 106 | { |
| 107 | - try { |
|
| 107 | + try |
|
| 108 | + { |
|
| 108 | 109 | return new \DirectoryIterator( $this->resolve( $path ) ); |
| 109 | - } catch( \Exception $e ) { |
|
| 110 | + } |
|
| 111 | + catch( \Exception $e ) |
|
| 112 | + { |
|
| 110 | 113 | throw new Exception( $e->getMessage(), 0, $e ); |
| 111 | 114 | } |
| 112 | 115 | } |