@@ -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 | } |
@@ -103,8 +103,7 @@ |
||
| 103 | 103 | { |
| 104 | 104 | $this->cache[$name] = $value; |
| 105 | 105 | unset( $this->negCache[$name] ); |
| 106 | - } |
|
| 107 | - else |
|
| 106 | + } else |
|
| 108 | 107 | { |
| 109 | 108 | $this->negCache[$name] = true; |
| 110 | 109 | } |
@@ -463,7 +463,7 @@ |
||
| 463 | 463 | |
| 464 | 464 | try { |
| 465 | 465 | $stmt->execute()->finish(); |
| 466 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // Ignore duplicates |
|
| 466 | + } catch( \Aimeos\MW\DB\Exception $e ) {; } // Ignore duplicates |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -497,9 +497,13 @@ |
||
| 497 | 497 | $stmt->bind( 7, $date ); //mtime |
| 498 | 498 | $stmt->bind( 8, $siteid ); |
| 499 | 499 | |
| 500 | - try { |
|
| 500 | + try |
|
| 501 | + { |
|
| 501 | 502 | $stmt->execute()->finish(); |
| 502 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // Ignore duplicates |
|
| 503 | + } |
|
| 504 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 505 | + { |
|
| 506 | +; } // Ignore duplicates |
|
| 503 | 507 | } |
| 504 | 508 | } |
| 505 | 509 | } |
@@ -46,9 +46,12 @@ |
||
| 46 | 46 | |
| 47 | 47 | foreach( $data as $entry ) |
| 48 | 48 | { |
| 49 | - try { |
|
| 49 | + try |
|
| 50 | + { |
|
| 50 | 51 | $manager->find( $entry['catalog.code'] ); |
| 51 | - } catch( \Aimeos\MW\Exception $e ) { |
|
| 52 | + } |
|
| 53 | + catch( \Aimeos\MW\Exception $e ) |
|
| 54 | + { |
|
| 52 | 55 | $manager->insert( $manager->create()->fromArray( $entry ) ); |
| 53 | 56 | } |
| 54 | 57 | } |
@@ -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,7 +50,7 @@ |
||
| 50 | 50 | $item = $item->setId( null )->fromArray( $dataset ); |
| 51 | 51 | $manager->save( $item ); |
| 52 | 52 | } |
| 53 | - catch( \Exception $e ) { ; } // if attribute was already available |
|
| 53 | + catch( \Exception $e ) {; } // if attribute was already available |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | $item = $item->setId( null )->fromArray( $dataset ); |
| 51 | 51 | $manager->save( $item ); |
| 52 | 52 | } |
| 53 | - catch( \Exception $e ) { ; } // if attribute was already available |
|
| 53 | + catch( \Exception $e ) |
|
| 54 | + { |
|
| 55 | +; } // if attribute was already available |
|
| 54 | 56 | } |
| 55 | 57 | } |
| 56 | 58 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | try { |
| 79 | 79 | $domainManager->save( $type ); |
| 80 | 80 | $num++; |
| 81 | - } catch( \Exception $e ) { ; } // if type was already available |
|
| 81 | + } catch( \Exception $e ) {; } // if type was already available |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -75,10 +75,14 @@ |
||
| 75 | 75 | $type->setLabel( $dataset['label'] ); |
| 76 | 76 | $type->setStatus( $dataset['status'] ); |
| 77 | 77 | |
| 78 | - try { |
|
| 78 | + try |
|
| 79 | + { |
|
| 79 | 80 | $domainManager->save( $type ); |
| 80 | 81 | $num++; |
| 81 | - } catch( \Exception $e ) { ; } // if type was already available |
|
| 82 | + } |
|
| 83 | + catch( \Exception $e ) |
|
| 84 | + { |
|
| 85 | +; } // if type was already available |
|
| 82 | 86 | } |
| 83 | 87 | } |
| 84 | 88 | } |
@@ -85,9 +85,13 @@ |
||
| 85 | 85 | $item->setPosition( $dataset['position'] ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - try { |
|
| 88 | + try |
|
| 89 | + { |
|
| 89 | 90 | $pluginManager->save( $item ); |
| 90 | - } catch( \Exception $e ) {; } // if plugin configuration was already available |
|
| 91 | + } |
|
| 92 | + catch( \Exception $e ) |
|
| 93 | + { |
|
| 94 | +; } // if plugin configuration was already available |
|
| 91 | 95 | } |
| 92 | 96 | } |
| 93 | 97 | } |
@@ -46,21 +46,18 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $options[$name] = (array) $options[$name]; |
| 48 | 48 | $options[$name][] = substr( $option, $pos + 1 ); |
| 49 | - } |
|
| 50 | - else |
|
| 49 | + } else |
|
| 51 | 50 | { |
| 52 | 51 | $options[$name] = substr( $option, $pos + 1 ); |
| 53 | 52 | } |
| 54 | 53 | |
| 55 | 54 | unset( $params[$key] ); |
| 56 | - } |
|
| 57 | - else |
|
| 55 | + } else |
|
| 58 | 56 | { |
| 59 | 57 | printf( "Invalid option \"%1\$s\"\n", $option ); |
| 60 | 58 | usage(); |
| 61 | 59 | } |
| 62 | - } |
|
| 63 | - elseif( $option[0] === '-' ) |
|
| 60 | + } elseif( $option[0] === '-' ) |
|
| 64 | 61 | { |
| 65 | 62 | $options[$option[1]] = substr( $option, 1 ); |
| 66 | 63 | unset( $params[$key] ); |