@@ -26,7 +26,8 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function test() |
| 28 | 28 | { |
| 29 | - try { |
|
| 29 | + try |
|
| 30 | + { |
|
| 30 | 31 | throw new \Aimeos\MShop\Plugin\Provider\Exception( 'msg', 13, null, $this->codes ); |
| 31 | 32 | } |
| 32 | 33 | catch( \Aimeos\MShop\Plugin\Provider\Exception $mppe ) |
@@ -36,7 +37,8 @@ discard block |
||
| 36 | 37 | $this->assertEquals( $this->codes, $mppe->getErrorCodes() ); |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | - try { |
|
| 40 | + try |
|
| 41 | + { |
|
| 40 | 42 | throw new \Aimeos\MShop\Plugin\Provider\Exception( 'msg2', 11 ); |
| 41 | 43 | } |
| 42 | 44 | catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
@@ -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 | } |
@@ -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 |
@@ -206,8 +206,7 @@ |
||
| 206 | 206 | */ |
| 207 | 207 | $path = 'madmin/job/manager/insert'; |
| 208 | 208 | $sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) ); |
| 209 | - } |
|
| 210 | - else |
|
| 209 | + } else |
|
| 211 | 210 | { |
| 212 | 211 | /** madmin/job/manager/update/mysql |
| 213 | 212 | * Updates an existing job record in the database |
@@ -344,7 +344,8 @@ |
||
| 344 | 344 | { |
| 345 | 345 | $stockManager->decrease( [$item->getProductId() => -1 * $how * $item->getQuantity()], $item->getStockType() ); |
| 346 | 346 | |
| 347 | - switch( $item->getType() ) { |
|
| 347 | + switch( $item->getType() ) |
|
| 348 | + { |
|
| 348 | 349 | case 'default': |
| 349 | 350 | $this->updateStockBundle( $item->getParentProductId(), $item->getStockType() ); break; |
| 350 | 351 | case 'select': |
@@ -196,8 +196,7 @@ |
||
| 196 | 196 | { |
| 197 | 197 | $item = $this->deletePreviews( $item, $fsname ); |
| 198 | 198 | $item = $this->addImages( $item, $media, $name, $fsname ); |
| 199 | - } |
|
| 200 | - else |
|
| 199 | + } else |
|
| 201 | 200 | { |
| 202 | 201 | $mimetype = $this->getMimeType( $media, 'files' ); |
| 203 | 202 | $item = $item->setPreviews( [1 => $this->getMimeIcon( $mimetype, $fsname )] ) |
@@ -482,7 +482,7 @@ |
||
| 482 | 482 | $siteId = $this->context->locale()->getSiteId(); |
| 483 | 483 | |
| 484 | 484 | // the "d" after {siteid} is the required extension for Windows (no dots at the and allowed) |
| 485 | - return "${siteId}d/${type}/${filename[0]}/${filename[1]}/${filename}${ext}"; |
|
| 485 | + return "${siteid}d/${type}/${filename[0]}/${filename[1]}/${filename}${ext}"; |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | |