@@ -108,9 +108,12 @@ |
||
108 | 108 | */ |
109 | 109 | public function scan( string $path = null ) : iterable |
110 | 110 | { |
111 | - try { |
|
111 | + try |
|
112 | + { |
|
112 | 113 | return new \DirectoryIterator( $this->resolve( $path ) ); |
113 | - } catch( \Exception $e ) { |
|
114 | + } |
|
115 | + catch( \Exception $e ) |
|
116 | + { |
|
114 | 117 | throw new Exception( $e->getMessage(), 0, $e ); |
115 | 118 | } |
116 | 119 | } |
@@ -69,9 +69,12 @@ |
||
69 | 69 | */ |
70 | 70 | public function execute() : \Aimeos\MW\DB\Result\Iface |
71 | 71 | { |
72 | - try { |
|
72 | + try |
|
73 | + { |
|
73 | 74 | $result = $this->exec(); |
74 | - } catch( \PDOException $e ) { |
|
75 | + } |
|
76 | + catch( \PDOException $e ) |
|
77 | + { |
|
75 | 78 | throw new \Aimeos\MW\DB\Exception( $e->getMessage() . ': ' . $this->sql, $e->getCode() ); |
76 | 79 | } |
77 | 80 |
@@ -69,9 +69,12 @@ |
||
69 | 69 | */ |
70 | 70 | public function execute() : \Aimeos\MW\DB\Result\Iface |
71 | 71 | { |
72 | - try { |
|
72 | + try |
|
73 | + { |
|
73 | 74 | $result = $this->exec(); |
74 | - } catch( \PDOException $e ) { |
|
75 | + } |
|
76 | + catch( \PDOException $e ) |
|
77 | + { |
|
75 | 78 | throw new \Aimeos\MW\DB\Exception( $e->getMessage() . ': ' . $this->sql, $e->getCode() ); |
76 | 79 | } |
77 | 80 |
@@ -80,8 +80,7 @@ |
||
80 | 80 | $dbm->release( $conn, $rname ); |
81 | 81 | |
82 | 82 | $this->status( 'done' ); |
83 | - } |
|
84 | - else |
|
83 | + } else |
|
85 | 84 | { |
86 | 85 | $this->status( 'OK' ); |
87 | 86 | } |
@@ -250,8 +250,7 @@ |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | $this->status( 'done' ); |
253 | - } |
|
254 | - else |
|
253 | + } else |
|
255 | 254 | { |
256 | 255 | $this->status( 'OK' ); |
257 | 256 | } |
@@ -72,8 +72,7 @@ |
||
72 | 72 | $dbm->release( $conn, $rname ); |
73 | 73 | |
74 | 74 | $this->status( $count > 0 ? 'done' : 'OK' ); |
75 | - } |
|
76 | - else |
|
75 | + } else |
|
77 | 76 | { |
78 | 77 | $this->status( 'OK' ); |
79 | 78 | } |
@@ -51,9 +51,12 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function affectedRows() : int |
53 | 53 | { |
54 | - try { |
|
54 | + try |
|
55 | + { |
|
55 | 56 | return $this->statement->rowCount(); |
56 | - } catch( \PDOException $e ) { |
|
57 | + } |
|
58 | + catch( \PDOException $e ) |
|
59 | + { |
|
57 | 60 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
58 | 61 | } |
59 | 62 | } |
@@ -68,9 +71,12 @@ discard block |
||
68 | 71 | */ |
69 | 72 | public function fetch( int $style = \Aimeos\MW\DB\Result\Base::FETCH_ASSOC ) : ?array |
70 | 73 | { |
71 | - try { |
|
74 | + try |
|
75 | + { |
|
72 | 76 | return $this->statement->fetch( $style ? \PDO::FETCH_ASSOC : \PDO::FETCH_NUM ) ?: null; |
73 | - } catch( \PDOException $e ) { |
|
77 | + } |
|
78 | + catch( \PDOException $e ) |
|
79 | + { |
|
74 | 80 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
75 | 81 | } |
76 | 82 | } |
@@ -84,9 +90,12 @@ discard block |
||
84 | 90 | */ |
85 | 91 | public function finish() : Iface |
86 | 92 | { |
87 | - try { |
|
93 | + try |
|
94 | + { |
|
88 | 95 | $this->statement->closeCursor(); |
89 | - } catch( \PDOException $e ) { |
|
96 | + } |
|
97 | + catch( \PDOException $e ) |
|
98 | + { |
|
90 | 99 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
91 | 100 | } |
92 | 101 | |
@@ -101,9 +110,12 @@ discard block |
||
101 | 110 | */ |
102 | 111 | public function nextResult() : bool |
103 | 112 | { |
104 | - try { |
|
113 | + try |
|
114 | + { |
|
105 | 115 | return $this->statement->nextRowset(); |
106 | - } catch( \PDOException $e ) { |
|
116 | + } |
|
117 | + catch( \PDOException $e ) |
|
118 | + { |
|
107 | 119 | return false; |
108 | 120 | } |
109 | 121 | } |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | foreach( $value as $key => $product ) { |
54 | 54 | $value[$key] = $this->updatePrice( $product ); |
55 | 55 | } |
56 | - } |
|
57 | - else |
|
56 | + } else |
|
58 | 57 | { |
59 | 58 | $value = $this->updatePrice( $value ); |
60 | 59 | } |
@@ -133,8 +132,7 @@ discard block |
||
133 | 132 | { |
134 | 133 | $priceManager = \Aimeos\MShop::create( $this->getContext(), 'price' ); |
135 | 134 | |
136 | - $sortFcn = function( $a, $b ) use( $priceManager, $attrQtys ) |
|
137 | - { |
|
135 | + $sortFcn = function( $a, $b ) use( $priceManager, $attrQtys ) { |
|
138 | 136 | if( ( $pricesA = $a->getRefItems( 'price', 'default', 'default' )->toArray() ) === [] ) { |
139 | 137 | return 1; |
140 | 138 | } |
@@ -197,8 +195,7 @@ discard block |
||
197 | 195 | { |
198 | 196 | $list = $this->sortByPrice( $list, $attrQtys ); |
199 | 197 | $priceItem = $this->addPrices( $priceItem, $list, $attrQtys, (int) $prodConf[$type] ); |
200 | - } |
|
201 | - else |
|
198 | + } else |
|
202 | 199 | { |
203 | 200 | $priceItem = $this->addPrices( $priceItem, $list, $attrQtys, 0 ); |
204 | 201 | } |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | if( in_array( $op, $operators['combine'], true ) ) { |
71 | 71 | return $this->createCombineExpression( $op, (array) $value ); |
72 | - } |
|
73 | - else if( in_array( $op, $operators['compare'], true ) ) { |
|
72 | + } else if( in_array( $op, $operators['compare'], true ) ) { |
|
74 | 73 | return $this->createCompareExpression( $op, (array) $value ); |
75 | 74 | } |
76 | 75 | |
@@ -147,11 +146,9 @@ discard block |
||
147 | 146 | |
148 | 147 | if( in_array( $op, $operators['combine'], true ) ) { |
149 | 148 | $results[] = $this->createCombineExpression( $op, (array) $entry[$op] ); |
150 | - } |
|
151 | - else if( in_array( $op, $operators['compare'], true ) ) { |
|
149 | + } else if( in_array( $op, $operators['compare'], true ) ) { |
|
152 | 150 | $results[] = $this->createCompareExpression( $op, (array) $entry[$op] ); |
153 | - } |
|
154 | - else { |
|
151 | + } else { |
|
155 | 152 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid operator "%1$s"', $op ) ); |
156 | 153 | } |
157 | 154 | } |