@@ -50,9 +50,12 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function affectedRows() : int |
52 | 52 | { |
53 | - try { |
|
53 | + try |
|
54 | + { |
|
54 | 55 | return $this->result->rowCount(); |
55 | - } catch( \Doctrine\DBAL\Driver\Exception $e ) { |
|
56 | + } |
|
57 | + catch( \Doctrine\DBAL\Driver\Exception $e ) |
|
58 | + { |
|
56 | 59 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode() ); |
57 | 60 | } |
58 | 61 | } |
@@ -90,9 +93,12 @@ discard block |
||
90 | 93 | */ |
91 | 94 | public function finish() : Iface |
92 | 95 | { |
93 | - try { |
|
96 | + try |
|
97 | + { |
|
94 | 98 | $this->result->free(); |
95 | - } catch( \Doctrine\DBAL\Driver\Exception $e ) { |
|
99 | + } |
|
100 | + catch( \Doctrine\DBAL\Driver\Exception $e ) |
|
101 | + { |
|
96 | 102 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode() ); |
97 | 103 | } |
98 | 104 |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | foreach( $value as $key => $product ) { |
60 | 60 | $value[$key] = $this->updatePrice( $product ); |
61 | 61 | } |
62 | - } |
|
63 | - else |
|
62 | + } else |
|
64 | 63 | { |
65 | 64 | $value = $this->updatePrice( $value ); |
66 | 65 | } |
@@ -139,8 +138,7 @@ discard block |
||
139 | 138 | { |
140 | 139 | $priceManager = \Aimeos\MShop::create( $this->context(), 'price' ); |
141 | 140 | |
142 | - $sortFcn = function( $a, $b ) use( $priceManager, $attrQtys ) |
|
143 | - { |
|
141 | + $sortFcn = function( $a, $b ) use( $priceManager, $attrQtys ) { |
|
144 | 142 | if( ( $pricesA = $a->getRefItems( 'price', 'default', 'default' )->toArray() ) === [] ) { |
145 | 143 | return 1; |
146 | 144 | } |
@@ -203,8 +201,7 @@ discard block |
||
203 | 201 | { |
204 | 202 | $list = $this->sortByPrice( $list, $attrQtys ); |
205 | 203 | $priceItem = $this->addPrices( $priceItem, $list, $attrQtys, (int) $prodConf[$type] ); |
206 | - } |
|
207 | - else |
|
204 | + } else |
|
208 | 205 | { |
209 | 206 | $priceItem = $this->addPrices( $priceItem, $list, $attrQtys, 0 ); |
210 | 207 | } |
@@ -165,7 +165,7 @@ |
||
165 | 165 | $manager = \Aimeos\MShop::create( $context, 'attribute' ); |
166 | 166 | $refItem = $manager->find( $refItem->getCode(), [], $domain, $refItem->getType() ); |
167 | 167 | } |
168 | - catch( \Exception $e ) { ; } // attribute doesn't exist yet |
|
168 | + catch( \Exception $e ) {; } // attribute doesn't exist yet |
|
169 | 169 | |
170 | 170 | $refItem = $this->addRefItems( $refItem, $data ); |
171 | 171 | $item->addListItem( 'attribute', $listItem, $refItem ); |
@@ -165,7 +165,9 @@ |
||
165 | 165 | $manager = \Aimeos\MShop::create( $context, 'attribute' ); |
166 | 166 | $refItem = $manager->find( $refItem->getCode(), [], $domain, $refItem->getType() ); |
167 | 167 | } |
168 | - catch( \Exception $e ) { ; } // attribute doesn't exist yet |
|
168 | + catch( \Exception $e ) |
|
169 | + { |
|
170 | +; } // attribute doesn't exist yet |
|
169 | 171 | |
170 | 172 | $refItem = $this->addRefItems( $refItem, $data ); |
171 | 173 | $item->addListItem( 'attribute', $listItem, $refItem ); |
@@ -63,7 +63,7 @@ |
||
63 | 63 | $this->removeItems( $item->getId(), 'catalog/lists', 'catalog', 'text' ); |
64 | 64 | $this->removeListItems( $item->getId(), 'catalog/lists', 'product' ); |
65 | 65 | } |
66 | - catch( \Exception $e ) { ; } // If no root node was already inserted into the database |
|
66 | + catch( \Exception $e ) {; } // If no root node was already inserted into the database |
|
67 | 67 | |
68 | 68 | $search = $manager->filter(); |
69 | 69 | $search->setConditions( $search->compare( '=~', 'catalog.code', 'demo-' ) ); |
@@ -63,7 +63,9 @@ |
||
63 | 63 | $this->removeItems( $item->getId(), 'catalog/lists', 'catalog', 'text' ); |
64 | 64 | $this->removeListItems( $item->getId(), 'catalog/lists', 'product' ); |
65 | 65 | } |
66 | - catch( \Exception $e ) { ; } // If no root node was already inserted into the database |
|
66 | + catch( \Exception $e ) |
|
67 | + { |
|
68 | +; } // If no root node was already inserted into the database |
|
67 | 69 | |
68 | 70 | $search = $manager->filter(); |
69 | 71 | $search->setConditions( $search->compare( '=~', 'catalog.code', 'demo-' ) ); |
@@ -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 |
@@ -112,9 +112,12 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface |
114 | 114 | { |
115 | - try { |
|
115 | + try |
|
116 | + { |
|
116 | 117 | $values['locale.language.siteid'] = $this->context()->locale()->getSiteId(); |
117 | - } catch( \Exception $ex ) { |
|
118 | + } |
|
119 | + catch( \Exception $ex ) |
|
120 | + { |
|
118 | 121 | $values['locale.language.siteid'] = null; |
119 | 122 | } |
120 | 123 | |
@@ -181,8 +184,7 @@ discard block |
||
181 | 184 | */ |
182 | 185 | $path = 'mshop/locale/manager/language/insert'; |
183 | 186 | $sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) ); |
184 | - } |
|
185 | - else |
|
187 | + } else |
|
186 | 188 | { |
187 | 189 | /** mshop/locale/manager/language/update/mysql |
188 | 190 | * Updates an existing language record in the database |
@@ -112,9 +112,12 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface |
114 | 114 | { |
115 | - try { |
|
115 | + try |
|
116 | + { |
|
116 | 117 | $values['locale.currency.siteid'] = $this->context()->locale()->getSiteId(); |
117 | - } catch( \Exception $e ) { |
|
118 | + } |
|
119 | + catch( \Exception $e ) |
|
120 | + { |
|
118 | 121 | $values['locale.currency.siteid'] = null; |
119 | 122 | } |
120 | 123 | |
@@ -181,8 +184,7 @@ discard block |
||
181 | 184 | */ |
182 | 185 | $path = 'mshop/locale/manager/currency/insert'; |
183 | 186 | $sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) ); |
184 | - } |
|
185 | - else |
|
187 | + } else |
|
186 | 188 | { |
187 | 189 | /** mshop/locale/manager/currency/update/mysql |
188 | 190 | * Updates an existing currency record in the database |
@@ -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 | } |
@@ -169,7 +169,7 @@ |
||
169 | 169 | |
170 | 170 | try { |
171 | 171 | $localeManager->save( $item ); |
172 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // if locale combination was already available |
|
172 | + } catch( \Aimeos\MW\DB\Exception $e ) {; } // if locale combination was already available |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -52,9 +52,12 @@ discard block |
||
52 | 52 | $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $this->context(), 'Standard' ); |
53 | 53 | $siteManager = $localeManager->getSubManager( 'site' ); |
54 | 54 | |
55 | - try { |
|
55 | + try |
|
56 | + { |
|
56 | 57 | $siteItem = $siteManager->insert( $siteManager->create()->setLabel( $code )->setCode( $code ) ); |
57 | - } catch( \Aimeos\MW\DB\Exception $e ) { |
|
58 | + } |
|
59 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
60 | + { |
|
58 | 61 | $siteItem = $siteManager->find( $code ); |
59 | 62 | } |
60 | 63 | |
@@ -69,7 +72,9 @@ discard block |
||
69 | 72 | |
70 | 73 | $localeManager->save( $localeItem, false ); |
71 | 74 | } |
72 | - catch( \Aimeos\MW\DB\Exception $e ) {} // already in the database |
|
75 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
76 | + { |
|
77 | +} // already in the database |
|
73 | 78 | } |
74 | 79 | |
75 | 80 | |
@@ -91,9 +96,12 @@ discard block |
||
91 | 96 | |
92 | 97 | foreach( $data as $key => $dataset ) |
93 | 98 | { |
94 | - try { |
|
99 | + try |
|
100 | + { |
|
95 | 101 | $item = $manager->insert( $manager->create()->fromArray( $dataset ), $parentId ); |
96 | - } catch( \Aimeos\MW\DB\Exception $e ) { |
|
102 | + } |
|
103 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
104 | + { |
|
97 | 105 | $item = $manager->find( $key ); |
98 | 106 | } |
99 | 107 | |
@@ -162,9 +170,13 @@ discard block |
||
162 | 170 | ->set( 'site_id', $siteIds[$dataset['site']]['id'] ) |
163 | 171 | ->setSiteId( $siteIds[$dataset['site']]['site'] ); |
164 | 172 | |
165 | - try { |
|
173 | + try |
|
174 | + { |
|
166 | 175 | $localeManager->save( $item ); |
167 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // if locale combination was already available |
|
176 | + } |
|
177 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
178 | + { |
|
179 | +; } // if locale combination was already available |
|
168 | 180 | } |
169 | 181 | } |
170 | 182 | } |