@@ -24,11 +24,11 @@ |
||
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Includes config files using a simple caching. |
|
| 28 | - * |
|
| 29 | - * @param string $file Path and file name of a config file |
|
| 30 | - * @return array Value of the requested config file |
|
| 31 | - **/ |
|
| 27 | + * Includes config files using a simple caching. |
|
| 28 | + * |
|
| 29 | + * @param string $file Path and file name of a config file |
|
| 30 | + * @return array Value of the requested config file |
|
| 31 | + **/ |
|
| 32 | 32 | protected function includeFile( $file ) |
| 33 | 33 | { |
| 34 | 34 | if( !isset( $this->includeCache[$file] ) ) { |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | foreach( $this->getTranslations( $domain ) as $content ) |
| 68 | 68 | { |
| 69 | - if ( isset( $content[$string][0] ) && is_array( $content[$string] ) ) { |
|
| 69 | + if( isset( $content[$string][0] ) && is_array( $content[$string] ) ) { |
|
| 70 | 70 | return $content[$string][0]; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( isset( $content[$string] ) && is_string( $content[$string] ) ) { |
|
| 73 | + if( isset( $content[$string] ) && is_string( $content[$string] ) ) { |
|
| 74 | 74 | return $content[$string]; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | - catch( \Exception $e ) { ; } // no translation found |
|
| 78 | + catch( \Exception $e ) {; } // no translation found |
|
| 79 | 79 | |
| 80 | 80 | return (string) $string; |
| 81 | 81 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | foreach( $this->getTranslations( $domain ) as $content ) |
| 101 | 101 | { |
| 102 | - if ( isset( $content[$singular][$index] ) && is_array( $content[$singular] ) ) { |
|
| 102 | + if( isset( $content[$singular][$index] ) && is_array( $content[$singular] ) ) { |
|
| 103 | 103 | return $content[$singular][$index]; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - catch( \Exception $e ) { ; } // no translation found |
|
| 107 | + catch( \Exception $e ) {; } // no translation found |
|
| 108 | 108 | |
| 109 | 109 | if( $index > 0 ) { |
| 110 | 110 | return (string) $plural; |
@@ -75,7 +75,9 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | - catch( \Exception $e ) { ; } // no translation found |
|
| 78 | + catch( \Exception $e ) |
|
| 79 | + { |
|
| 80 | +; } // no translation found |
|
| 79 | 81 | |
| 80 | 82 | return (string) $string; |
| 81 | 83 | } |
@@ -104,7 +106,9 @@ discard block |
||
| 104 | 106 | } |
| 105 | 107 | } |
| 106 | 108 | } |
| 107 | - catch( \Exception $e ) { ; } // no translation found |
|
| 109 | + catch( \Exception $e ) |
|
| 110 | + { |
|
| 111 | +; } // no translation found |
|
| 108 | 112 | |
| 109 | 113 | if( $index > 0 ) { |
| 110 | 114 | return (string) $plural; |
@@ -201,8 +201,7 @@ discard block |
||
| 201 | 201 | if( $level === \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) { |
| 202 | 202 | return $node; |
| 203 | 203 | } |
| 204 | - } |
|
| 205 | - else |
|
| 204 | + } else |
|
| 206 | 205 | { |
| 207 | 206 | $node = $this->getNodeById( $id ); |
| 208 | 207 | |
@@ -276,15 +275,13 @@ discard block |
||
| 276 | 275 | $node->left = $refNode->left; |
| 277 | 276 | $node->right = $refNode->left + 1; |
| 278 | 277 | $node->level = $refNode->level; |
| 279 | - } |
|
| 280 | - else if( $parentId !== null ) |
|
| 278 | + } else if( $parentId !== null ) |
|
| 281 | 279 | { |
| 282 | 280 | $parentNode = $this->getNode( $parentId, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
| 283 | 281 | $node->left = $parentNode->right; |
| 284 | 282 | $node->right = $parentNode->right + 1; |
| 285 | 283 | $node->level = $parentNode->level + 1; |
| 286 | - } |
|
| 287 | - else |
|
| 284 | + } else |
|
| 288 | 285 | { |
| 289 | 286 | $node->left = 1; |
| 290 | 287 | $node->right = 2; |
@@ -375,8 +372,7 @@ discard block |
||
| 375 | 372 | $moveNodeRightBegin = $node->left + $diff + 1; |
| 376 | 373 | $moveNodeRightEnd = $node->right + $diff; |
| 377 | 374 | $movesize = $refNode->left - $node->left - $diff; |
| 378 | - } |
|
| 379 | - else |
|
| 375 | + } else |
|
| 380 | 376 | { |
| 381 | 377 | $moveNodeLeftBegin = $node->left; |
| 382 | 378 | $moveNodeLeftEnd = $node->right - 1; |
@@ -387,8 +383,7 @@ discard block |
||
| 387 | 383 | |
| 388 | 384 | $closeNodeLeftBegin = $node->left + $diff; |
| 389 | 385 | $closeNodeRightBegin = $node->left + $diff; |
| 390 | - } |
|
| 391 | - else |
|
| 386 | + } else |
|
| 392 | 387 | { |
| 393 | 388 | $refNode = $this->getNode( $newParentId, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
| 394 | 389 | |
@@ -414,8 +409,7 @@ discard block |
||
| 414 | 409 | $moveNodeRightBegin = $node->left + $diff + 1; |
| 415 | 410 | $moveNodeRightEnd = $node->right + $diff; |
| 416 | 411 | $movesize = $refNode->right - $node->left - $diff; |
| 417 | - } |
|
| 418 | - else |
|
| 412 | + } else |
|
| 419 | 413 | { |
| 420 | 414 | $moveNodeLeftBegin = $node->left; |
| 421 | 415 | $moveNodeLeftEnd = $node->right - 1; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $diff = $node->right - $node->left + 1; |
| 161 | 161 | |
| 162 | 162 | $stmt = $conn->create( $this->config['move-left'] ); |
| 163 | - $stmt->bind( 1, -$diff, $this->searchConfig['left']['internaltype']); |
|
| 163 | + $stmt->bind( 1, -$diff, $this->searchConfig['left']['internaltype'] ); |
|
| 164 | 164 | $stmt->bind( 2, 0, $this->searchConfig['level']['internaltype'] ); |
| 165 | 165 | $stmt->bind( 3, $node->right + 1, $this->searchConfig['left']['internaltype'] ); |
| 166 | 166 | $stmt->bind( 4, 0x7FFFFFFF, $this->searchConfig['left']['internaltype'] ); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $search->getConditions(), |
| 224 | 224 | $condition->getConditions() |
| 225 | 225 | ); |
| 226 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
| 226 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $types = $this->getSearchTypes( $this->searchConfig ); |
@@ -538,14 +538,14 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | public function searchNodes( \Aimeos\MW\Criteria\Iface $search, $id = null ) |
| 540 | 540 | { |
| 541 | - $left = 1; |
|
| 541 | + $left = 1; |
|
| 542 | 542 | $right = 0x7FFFFFFF; |
| 543 | 543 | |
| 544 | 544 | if( $id !== null ) |
| 545 | 545 | { |
| 546 | 546 | $node = $this->getNodeById( $id ); |
| 547 | 547 | |
| 548 | - $left = $node->left; |
|
| 548 | + $left = $node->left; |
|
| 549 | 549 | $right = $node->right; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | |
| 622 | 622 | $results = $this->searchNodes( $search ); |
| 623 | 623 | |
| 624 | - foreach ( $results as $item ) { |
|
| 624 | + foreach( $results as $item ) { |
|
| 625 | 625 | $result[$item->getId()] = $item; |
| 626 | 626 | } |
| 627 | 627 | |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | */ |
| 734 | 734 | protected function isChild( \Aimeos\MW\Tree\Node\Iface $node, \Aimeos\MW\Tree\Node\Iface $parent ) |
| 735 | 735 | { |
| 736 | - return $node->__get('left') > $parent->__get('left') && $node->__get('right') < $parent->__get('right'); |
|
| 736 | + return $node->__get( 'left' ) > $parent->__get( 'left' ) && $node->__get( 'right' ) < $parent->__get( 'right' ); |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return \Aimeos\MW\DB\Statement\Iface \PDO statement object |
| 43 | 43 | * @throws \Aimeos\MW\DB\Exception if type is invalid or the DBAL object throws an exception |
| 44 | 44 | */ |
| 45 | - public function create( $sql, $type = \Aimeos\MW\DB\Connection\Base::TYPE_SIMPLE ) |
|
| 45 | + public function create( $sql, $type = \Aimeos\MW\DB\Connection\Base::TYPE_SIMPLE ) |
|
| 46 | 46 | { |
| 47 | 47 | try |
| 48 | 48 | { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | throw new \Aimeos\MW\DB\Exception( sprintf( 'Invalid value "%1$d" for statement type', $type ) ); |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | - catch( \Exception $e) |
|
| 59 | + catch( \Exception $e ) |
|
| 60 | 60 | { |
| 61 | 61 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode() ); |
| 62 | 62 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | throw new \Aimeos\MW\DB\Exception( sprintf( 'Invalid value "%1$d" for statement type', $type ) ); |
| 57 | 57 | } |
| 58 | 58 | } catch( \PDOException $e ) { |
| 59 | - throw new \Aimeos\MW\DB\Exception($e->getMessage(), $e->getCode(), $e->errorInfo ); |
|
| 59 | + throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -45,7 +45,8 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function create( $sql, $type = \Aimeos\MW\DB\Connection\Base::TYPE_SIMPLE ) |
| 47 | 47 | { |
| 48 | - try { |
|
| 48 | + try |
|
| 49 | + { |
|
| 49 | 50 | switch( $type ) |
| 50 | 51 | { |
| 51 | 52 | case \Aimeos\MW\DB\Connection\Base::TYPE_SIMPLE: |
@@ -55,7 +56,9 @@ discard block |
||
| 55 | 56 | default: |
| 56 | 57 | throw new \Aimeos\MW\DB\Exception( sprintf( 'Invalid value "%1$d" for statement type', $type ) ); |
| 57 | 58 | } |
| 58 | - } catch( \PDOException $e ) { |
|
| 59 | + } |
|
| 60 | + catch( \PDOException $e ) |
|
| 61 | + { |
|
| 59 | 62 | throw new \Aimeos\MW\DB\Exception($e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 60 | 63 | } |
| 61 | 64 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @param integer $type Type of given value defined in \Aimeos\MW\DB\Stmt\Base as constant |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | - public function bind( $position, $value, $type = \Aimeos\MW\DB\Statement\Base::PARAM_STR); |
|
| 31 | + public function bind( $position, $value, $type = \Aimeos\MW\DB\Statement\Base::PARAM_STR ); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Executes the statement. |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | try { |
| 50 | 50 | return $this->statement->rowCount(); |
| 51 | - } catch ( \PDOException $e ) { |
|
| 51 | + } catch( \PDOException $e ) { |
|
| 52 | 52 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | try { |
| 67 | 67 | return $this->statement->fetch( $this->style[$style] ); |
| 68 | - } catch ( \PDOException $e ) { |
|
| 68 | + } catch( \PDOException $e ) { |
|
| 69 | 69 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | try { |
| 82 | 82 | $this->statement->closeCursor(); |
| 83 | - } catch ( \PDOException $e ) { |
|
| 83 | + } catch( \PDOException $e ) { |
|
| 84 | 84 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | try { |
| 97 | 97 | return $this->statement->nextRowset(); |
| 98 | - } catch ( \PDOException $e ) { |
|
| 98 | + } catch( \PDOException $e ) { |
|
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -46,9 +46,12 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function affectedRows() |
| 48 | 48 | { |
| 49 | - try { |
|
| 49 | + try |
|
| 50 | + { |
|
| 50 | 51 | return $this->statement->rowCount(); |
| 51 | - } catch ( \PDOException $e ) { |
|
| 52 | + } |
|
| 53 | + catch ( \PDOException $e ) |
|
| 54 | + { |
|
| 52 | 55 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 53 | 56 | } |
| 54 | 57 | } |
@@ -63,9 +66,12 @@ discard block |
||
| 63 | 66 | */ |
| 64 | 67 | public function fetch( $style = \Aimeos\MW\DB\Result\Base::FETCH_ASSOC ) |
| 65 | 68 | { |
| 66 | - try { |
|
| 69 | + try |
|
| 70 | + { |
|
| 67 | 71 | return $this->statement->fetch( $this->style[$style] ); |
| 68 | - } catch ( \PDOException $e ) { |
|
| 72 | + } |
|
| 73 | + catch ( \PDOException $e ) |
|
| 74 | + { |
|
| 69 | 75 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 70 | 76 | } |
| 71 | 77 | } |
@@ -78,9 +84,12 @@ discard block |
||
| 78 | 84 | */ |
| 79 | 85 | public function finish() |
| 80 | 86 | { |
| 81 | - try { |
|
| 87 | + try |
|
| 88 | + { |
|
| 82 | 89 | $this->statement->closeCursor(); |
| 83 | - } catch ( \PDOException $e ) { |
|
| 90 | + } |
|
| 91 | + catch ( \PDOException $e ) |
|
| 92 | + { |
|
| 84 | 93 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 85 | 94 | } |
| 86 | 95 | } |
@@ -93,9 +102,12 @@ discard block |
||
| 93 | 102 | */ |
| 94 | 103 | public function nextResult() |
| 95 | 104 | { |
| 96 | - try { |
|
| 105 | + try |
|
| 106 | + { |
|
| 97 | 107 | return $this->statement->nextRowset(); |
| 98 | - } catch ( \PDOException $e ) { |
|
| 108 | + } |
|
| 109 | + catch ( \PDOException $e ) |
|
| 110 | + { |
|
| 99 | 111 | return false; |
| 100 | 112 | } |
| 101 | 113 | } |
@@ -88,7 +88,8 @@ |
||
| 88 | 88 | return array_pop( $this->connections[$name] ); |
| 89 | 89 | |
| 90 | 90 | } |
| 91 | - catch( \Exception $e ) { |
|
| 91 | + catch( \Exception $e ) |
|
| 92 | + { |
|
| 92 | 93 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode() ); |
| 93 | 94 | } |
| 94 | 95 | } |
@@ -88,7 +88,8 @@ discard block |
||
| 88 | 88 | return array_pop( $this->connections[$name] ); |
| 89 | 89 | |
| 90 | 90 | } |
| 91 | - catch( \PDOException $e ) { |
|
| 91 | + catch( \PDOException $e ) |
|
| 92 | + { |
|
| 92 | 93 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 93 | 94 | } |
| 94 | 95 | } |
@@ -131,8 +132,7 @@ discard block |
||
| 131 | 132 | { |
| 132 | 133 | $dsn .= isset( $host ) ? ';host=' . $host : ''; |
| 133 | 134 | $dsn .= isset( $port ) ? ';port=' . $port : ''; |
| 134 | - } |
|
| 135 | - else |
|
| 135 | + } else |
|
| 136 | 136 | { |
| 137 | 137 | $dsn .= ';unix_socket=' . $sock; |
| 138 | 138 | } |