@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function setId( $id ) |
120 | 120 | { |
121 | - if ( $id === null ) { |
|
121 | + if( $id === null ) { |
|
122 | 122 | $this->modified = true; |
123 | 123 | } |
124 | 124 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function setLabel( $name ) |
146 | 146 | { |
147 | - if ( $name == $this->getLabel() ) { return; } |
|
147 | + if( $name == $this->getLabel() ) { return; } |
|
148 | 148 | |
149 | 149 | $this->values['label'] = (string) $name; |
150 | 150 | $this->modified = true; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function setCode( $name ) |
171 | 171 | { |
172 | - if ( $name == $this->getCode() ) { return; } |
|
172 | + if( $name == $this->getCode() ) { return; } |
|
173 | 173 | |
174 | 174 | $this->values['code'] = (string) $name; |
175 | 175 | $this->modified = true; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function setStatus( $status ) |
195 | 195 | { |
196 | - if ( $status == $this->getStatus() ) { return; } |
|
196 | + if( $status == $this->getStatus() ) { return; } |
|
197 | 197 | |
198 | 198 | $this->values['status'] = (int) $status; |
199 | 199 | $this->modified = true; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return \Aimeos\MW\Tree\Node\Iface Selected node |
208 | 208 | * @throws \Aimeos\MW\Tree\Exception If there's no child at the given position |
209 | 209 | */ |
210 | - public function getChild($index) |
|
210 | + public function getChild( $index ) |
|
211 | 211 | { |
212 | 212 | if( isset( $this->children[$index] ) ) { |
213 | 213 | return $this->children[$index]; |
@@ -283,6 +283,6 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function count() |
285 | 285 | { |
286 | - return count($this->children); |
|
286 | + return count( $this->children ); |
|
287 | 287 | } |
288 | 288 | } |
@@ -33,18 +33,18 @@ |
||
33 | 33 | { |
34 | 34 | if( ctype_alnum( $name ) === false ) |
35 | 35 | { |
36 | - $classname = is_string( $name ) ? '\\Aimeos\\MW\\Tree\\Manager\\' . $name : '<not a string>'; |
|
36 | + $classname = is_string( $name ) ? '\\Aimeos\\MW\\Tree\\Manager\\'.$name : '<not a string>'; |
|
37 | 37 | throw new \Aimeos\MW\Tree\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
38 | 38 | } |
39 | 39 | |
40 | 40 | $iface = '\\Aimeos\\MW\\Tree\\Manager\\Iface'; |
41 | - $classname = '\\Aimeos\\MW\\Tree\\Manager\\' . $name; |
|
41 | + $classname = '\\Aimeos\\MW\\Tree\\Manager\\'.$name; |
|
42 | 42 | |
43 | 43 | if( class_exists( $classname ) === false ) { |
44 | 44 | throw new \Aimeos\MW\Tree\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
45 | 45 | } |
46 | 46 | |
47 | - $manager = new $classname( $config, $resource ); |
|
47 | + $manager = new $classname( $config, $resource ); |
|
48 | 48 | |
49 | 49 | if( !( $manager instanceof $iface ) ) { |
50 | 50 | throw new \Aimeos\MW\Tree\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) ); |
@@ -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 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | |
618 | 618 | $results = $this->searchNodes( $search ); |
619 | 619 | |
620 | - foreach ( $results as $item ) { |
|
620 | + foreach( $results as $item ) { |
|
621 | 621 | $result[$item->getId()] = $item; |
622 | 622 | } |
623 | 623 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | */ |
730 | 730 | protected function isChild( \Aimeos\MW\Tree\Node\Iface $node, \Aimeos\MW\Tree\Node\Iface $parent ) |
731 | 731 | { |
732 | - return $node->__get('left') > $parent->__get('left') && $node->__get('right') < $parent->__get('right'); |
|
732 | + return $node->__get( 'left' ) > $parent->__get( 'left' ) && $node->__get( 'right' ) < $parent->__get( 'right' ); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 |
@@ -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; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $response = ''; |
35 | 35 | |
36 | - if( ( $curl = curl_init() )=== false ) { |
|
36 | + if( ( $curl = curl_init() ) === false ) { |
|
37 | 37 | throw new \Aimeos\MW\Communication\Exception( 'Could not initialize curl' ); |
38 | 38 | } |
39 | 39 | |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, strtoupper( $method ) ); |
45 | 45 | curl_setopt( $curl, CURLOPT_POSTFIELDS, $payload ); |
46 | 46 | curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 25 ); |
47 | - curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); // return data as string |
|
47 | + curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); // return data as string |
|
48 | 48 | |
49 | 49 | curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, true ); |
50 | 50 | |
51 | - if ( ( $response = curl_exec( $curl ) ) === false ) { |
|
51 | + if( ( $response = curl_exec( $curl ) ) === false ) { |
|
52 | 52 | throw new \Aimeos\MW\Communication\Exception( sprintf( 'Sending order failed: "%1$s"', curl_error( $curl ) ) ); |
53 | 53 | } |
54 | 54 | |
55 | - if ( curl_errno($curl) ) { |
|
56 | - throw new \Aimeos\MW\Communication\Exception( sprintf( 'Error with nr."%1$s" - "%2$s"', curl_errno($curl), curl_error($curl) ) ); |
|
55 | + if( curl_errno( $curl ) ) { |
|
56 | + throw new \Aimeos\MW\Communication\Exception( sprintf( 'Error with nr."%1$s" - "%2$s"', curl_errno( $curl ), curl_error( $curl ) ) ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | curl_close( $curl ); |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $method = NET_SFTP_STRING; break; |
67 | 67 | } |
68 | 68 | |
69 | - if ( $this->sftp->put( $target, $payload, $method ) === false ) |
|
69 | + if( $this->sftp->put( $target, $payload, $method ) === false ) |
|
70 | 70 | { |
71 | 71 | $msg = sprintf( 'Could not upload payload to "%1$s:%2$s"', $this->config['host'], $target ); |
72 | 72 | throw new \Aimeos\MW\Communication\Exception( $msg ); |
@@ -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 | } |