@@ -72,9 +72,12 @@ |
||
72 | 72 | */ |
73 | 73 | public function execute() : \Aimeos\MW\DB\Result\Iface |
74 | 74 | { |
75 | - try { |
|
75 | + try |
|
76 | + { |
|
76 | 77 | $stmt = $this->exec(); |
77 | - } catch( \PDOException $e ) { |
|
78 | + } |
|
79 | + catch( \PDOException $e ) |
|
80 | + { |
|
78 | 81 | throw new \Aimeos\MW\DB\Exception( $e->getMessage() . ': ' . $this->sql . map( $this->binds )->col( 0 )->toJson(), $e->getCode(), $e->errorInfo ); |
79 | 82 | } |
80 | 83 |
@@ -196,8 +196,7 @@ discard block |
||
196 | 196 | $ratio = ( $w < $h ? $width / $w : $height / $h ); |
197 | 197 | $newHeight = (int) $h * $ratio; |
198 | 198 | $newWidth = (int) $w * $ratio; |
199 | - } |
|
200 | - else |
|
199 | + } else |
|
201 | 200 | { |
202 | 201 | list( $newWidth, $newHeight ) = $this->getSizeFitted( $w, $h, $width, $height ); |
203 | 202 | |
@@ -261,8 +260,7 @@ discard block |
||
261 | 260 | |
262 | 261 | imagedestroy( $result ); |
263 | 262 | $newMedia->image = $newImage; |
264 | - } |
|
265 | - else |
|
263 | + } else |
|
266 | 264 | { |
267 | 265 | $newMedia->image = $result; |
268 | 266 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $this->image->setImageAlphaChannel( \Imagick::ALPHACHANNEL_ACTIVATE ); |
52 | 52 | $this->image->setImageBackgroundColor( $options['image']['background'] ?? 'transparent' ); |
53 | - } |
|
54 | - else |
|
53 | + } else |
|
55 | 54 | { |
56 | 55 | $this->image->setImageBackgroundColor( $options['image']['background'] ?? '#ffffff' ); |
57 | 56 | } |
@@ -174,15 +173,13 @@ discard block |
||
174 | 173 | $newMedia->image->cropThumbnailImage( (int) $width, (int) $height ); |
175 | 174 | // see https://www.php.net/manual/en/imagick.cropthumbnailimage.php#106710 |
176 | 175 | $newMedia->image->setImagePage( 0, 0, 0, 0 ); |
177 | - } |
|
178 | - elseif( $fit === 1 && $width && $height ) |
|
176 | + } elseif( $fit === 1 && $width && $height ) |
|
179 | 177 | { |
180 | 178 | $w = ( $width - $newMedia->image->getImageWidth() ) / 2; |
181 | 179 | $h = ( $height - $newMedia->image->getImageHeight() ) / 2; |
182 | 180 | |
183 | 181 | $newMedia->image->extentImage( $width, $height, (int) -$w, (int) -$h ); |
184 | - } |
|
185 | - else |
|
182 | + } else |
|
186 | 183 | { |
187 | 184 | $w = $this->image->getImageWidth(); |
188 | 185 | $h = $this->image->getImageHeight(); |
@@ -267,8 +264,7 @@ discard block |
||
267 | 264 | $wmimage = clone self::$wmimg; |
268 | 265 | $wmimage->resizeImage( $ww, $wh, \Imagick::FILTER_CUBIC, 0.8 ); |
269 | 266 | self::$wmimages[$ww . 'x' . $wh] = $wmimage; |
270 | - } |
|
271 | - else |
|
267 | + } else |
|
272 | 268 | { |
273 | 269 | $wmimage = self::$wmimages[$ww . 'x' . $wh]; |
274 | 270 | } |
@@ -38,25 +38,21 @@ |
||
38 | 38 | if( ( $content = stream_get_contents( $file ) ) === false ) { |
39 | 39 | throw new \Aimeos\MW\Media\Exception( sprintf( 'Unable to read from stream' ) ); |
40 | 40 | } |
41 | - } |
|
42 | - elseif( $file instanceof \Psr\Http\Message\StreamInterface ) |
|
41 | + } elseif( $file instanceof \Psr\Http\Message\StreamInterface ) |
|
43 | 42 | { |
44 | 43 | $content = $file->getContents(); |
45 | - } |
|
46 | - elseif( is_string( $file ) ) |
|
44 | + } elseif( is_string( $file ) ) |
|
47 | 45 | { |
48 | 46 | if( strpos( $file, "\0" ) === false && is_file( $file ) ) |
49 | 47 | { |
50 | 48 | if( ( $content = file_get_contents( $file ) ) === false ) { |
51 | 49 | throw new \Aimeos\MW\Media\Exception( sprintf( 'Unable to read from file "%1$s"', $file ) ); |
52 | 50 | } |
53 | - } |
|
54 | - else |
|
51 | + } else |
|
55 | 52 | { |
56 | 53 | $content = $file; |
57 | 54 | } |
58 | - } |
|
59 | - else |
|
55 | + } else |
|
60 | 56 | { |
61 | 57 | throw new \Aimeos\MW\Media\Exception( 'Unsupported file parameter type' ); |
62 | 58 | } |
@@ -32,9 +32,12 @@ discard block |
||
32 | 32 | { |
33 | 33 | parent::__construct( $config ); |
34 | 34 | |
35 | - try { |
|
35 | + try |
|
36 | + { |
|
36 | 37 | $this->conn = $this->createConnection(); |
37 | - } catch( \Aimeos\MW\DB\Exception $e ) { |
|
38 | + } |
|
39 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
40 | + { |
|
38 | 41 | throw new \Aimeos\MW\MQueue\Exception( $e->getMessage() ); |
39 | 42 | } |
40 | 43 | } |
@@ -111,14 +114,12 @@ discard block |
||
111 | 114 | { |
112 | 115 | $dsn .= 'Database=' . $dbase; |
113 | 116 | $dsn .= isset( $host ) ? ';Server=' . $host . ( isset( $port ) ? ',' . $port : '' ) : ''; |
114 | - } |
|
115 | - elseif( $sock == null ) |
|
117 | + } elseif( $sock == null ) |
|
116 | 118 | { |
117 | 119 | $dsn .= 'dbname=' . $dbase; |
118 | 120 | $dsn .= isset( $host ) ? ';host=' . $host : ''; |
119 | 121 | $dsn .= isset( $port ) ? ';port=' . $port : ''; |
120 | - } |
|
121 | - else |
|
122 | + } else |
|
122 | 123 | { |
123 | 124 | $dsn .= 'dbname=' . $dbase . ';unix_socket=' . $sock; |
124 | 125 | } |
@@ -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 | } |
@@ -139,8 +139,7 @@ |
||
139 | 139 | $list[] = $this->escape( '==', $this->getParamType( $item ), $item ); |
140 | 140 | } |
141 | 141 | $params[$i] = join( ',', $list ); |
142 | - } |
|
143 | - else |
|
142 | + } else |
|
144 | 143 | { |
145 | 144 | $params[$i] = $this->escape( '==', $this->getParamType( $params[$i] ), $params[$i] ); |
146 | 145 | } |
@@ -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; |
@@ -156,9 +156,12 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface |
158 | 158 | { |
159 | - try { |
|
159 | + try |
|
160 | + { |
|
160 | 161 | $values['log.siteid'] = $this->context()->locale()->getSiteId(); |
161 | - } catch( \Exception $e ) { |
|
162 | + } |
|
163 | + catch( \Exception $e ) |
|
164 | + { |
|
162 | 165 | $values['log.siteid'] = null; |
163 | 166 | } |
164 | 167 | |
@@ -181,9 +184,12 @@ discard block |
||
181 | 184 | |
182 | 185 | $context = $this->context(); |
183 | 186 | |
184 | - try { |
|
187 | + try |
|
188 | + { |
|
185 | 189 | $siteid = $context->locale()->getSiteId(); |
186 | - } catch( \Exception $e ) { |
|
190 | + } |
|
191 | + catch( \Exception $e ) |
|
192 | + { |
|
187 | 193 | $siteid = ''; |
188 | 194 | } |
189 | 195 | |
@@ -235,8 +241,7 @@ discard block |
||
235 | 241 | */ |
236 | 242 | $path = 'madmin/log/manager/insert'; |
237 | 243 | $sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) ); |
238 | - } |
|
239 | - else |
|
244 | + } else |
|
240 | 245 | { |
241 | 246 | /** madmin/log/manager/update/mysql |
242 | 247 | * Updates an existing log record in the database |