@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | parent::__construct( $mimetype ); |
42 | 42 | |
43 | 43 | if( ( $this->image = @imagecreatefromstring( $content ) ) === false ) { |
44 | - throw new \Aimeos\MW\Media\Exception( sprintf( 'The image type isn\'t supported by GDlib.') ); |
|
44 | + throw new \Aimeos\MW\Media\Exception( sprintf( 'The image type isn\'t supported by GDlib.' ) ); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | if( ( $this->info = getimagesizefromstring( $content ) ) === false ) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if( imagealphablending( $this->image, false ) === false ) { |
52 | - throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagealphablending)') ); |
|
52 | + throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagealphablending)' ) ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $this->options = $options; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | case 'image/png': |
116 | 116 | |
117 | 117 | if( imagesavealpha( $this->image, true ) === false ) { |
118 | - throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagesavealpha)') ); |
|
118 | + throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagesavealpha)' ) ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if( @imagepng( $this->image, $filename, (int) 10 - $quality / 10 ) === false ) { |
@@ -198,15 +198,15 @@ discard block |
||
198 | 198 | try |
199 | 199 | { |
200 | 200 | if( imagealphablending( $newImage, false ) === false ) { |
201 | - throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagealphablending)') ); |
|
201 | + throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagealphablending)' ) ); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | if( ( $transparent = imagecolorallocatealpha( $newImage, 255, 255, 255, 127 ) ) === false ) { |
205 | - throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagecolorallocatealpha)') ); |
|
205 | + throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagecolorallocatealpha)' ) ); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | if( imagefilledrectangle( $newImage, 0, 0, $destWidth, $destHeight, $transparent ) === false ) { |
209 | - throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagefilledrectangle)') ); |
|
209 | + throw new \Aimeos\MW\Media\Exception( sprintf( 'GD library failed (imagefilledrectangle)' ) ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | if( imagecopyresampled( $newImage, $image, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight ) === false ) { |
@@ -166,8 +166,7 @@ |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | $this->image = $result; |
169 | - } |
|
170 | - else |
|
169 | + } else |
|
171 | 170 | { |
172 | 171 | $this->image = $this->resample( $this->image, $this->info[0], $this->info[1], $width, $height ); |
173 | 172 | } |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | { |
32 | 32 | $l = new TestListener(); |
33 | 33 | |
34 | - $this->object->addListener($l, 'test'); |
|
34 | + $this->object->addListener( $l, 'test' ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function testRemoveListener() |
38 | 38 | { |
39 | 39 | $l = new TestListener(); |
40 | 40 | |
41 | - $this->object->addListener($l, 'test'); |
|
42 | - $this->object->removeListener($l, 'test'); |
|
41 | + $this->object->addListener( $l, 'test' ); |
|
42 | + $this->object->removeListener( $l, 'test' ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function testclearListeners() |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | public function testnotifyListeners() |
51 | 51 | { |
52 | 52 | $l = new TestListener(); |
53 | - $this->object->addListener($l, 'test'); |
|
54 | - $this->object->addListener($l, 'testagain'); |
|
53 | + $this->object->addListener( $l, 'test' ); |
|
54 | + $this->object->addListener( $l, 'testagain' ); |
|
55 | 55 | |
56 | - $this->object->notifyListenersPublic('test', 'warn'); |
|
57 | - $this->object->notifyListenersPublic('testagain', 'warn'); |
|
56 | + $this->object->notifyListenersPublic( 'test', 'warn' ); |
|
57 | + $this->object->notifyListenersPublic( 'testagain', 'warn' ); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | * @param string $action |
66 | 66 | * @param string|null $value |
67 | 67 | */ |
68 | - public function notifyListenersPublic($action, $value = null) |
|
68 | + public function notifyListenersPublic( $action, $value = null ) |
|
69 | 69 | { |
70 | - $this->notifyListeners($action, $value); |
|
70 | + $this->notifyListeners( $action, $value ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | public function clearListenersPublic() |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function update( \Aimeos\MW\Observer\Publisher\Iface $p, $action, $value = null ) |
87 | 87 | { |
88 | - if ($action == 'test') { |
|
88 | + if( $action == 'test' ) { |
|
89 | 89 | return false; |
90 | 90 | } |
91 | 91 | } |
@@ -266,10 +266,13 @@ |
||
266 | 266 | |
267 | 267 | $conn = $this->object->acquire(); |
268 | 268 | |
269 | - try { |
|
269 | + try |
|
270 | + { |
|
270 | 271 | $stmt = $conn->create( $sqlinsert ); |
271 | 272 | $stmt->execute(); |
272 | - } catch ( \Aimeos\MW\DB\Exception $de ) { |
|
273 | + } |
|
274 | + catch ( \Aimeos\MW\DB\Exception $de ) |
|
275 | + { |
|
273 | 276 | $this->object->release( $conn ); |
274 | 277 | return; |
275 | 278 | } |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | |
249 | 249 | public function testStmtSimpleBindTwo() |
250 | 250 | { |
251 | - $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
251 | + $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
252 | 252 | |
253 | 253 | $conn = $this->object->acquire(); |
254 | 254 | |
255 | 255 | $stmt2 = $conn->create( $sqlinsert2 ); |
256 | - $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
256 | + $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
257 | 257 | $stmt2->bind( 2, 0.12 ); |
258 | 258 | $stmt2->execute()->finish(); |
259 | 259 | |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | |
266 | 266 | public function testStmtSimpleBindThree() |
267 | 267 | { |
268 | - $sqlinsert3 = 'INSERT INTO "mw_unit_test" ("name", "id") VALUES (\'?te?st?\', ?)'; |
|
268 | + $sqlinsert3 = 'INSERT INTO "mw_unit_test" ("name", "id") VALUES (\'?te?st?\', ?)'; |
|
269 | 269 | |
270 | 270 | $conn = $this->object->acquire(); |
271 | 271 | |
272 | 272 | $stmt2 = $conn->create( $sqlinsert3 ); |
273 | - $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
273 | + $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
274 | 274 | $stmt2->execute()->finish(); |
275 | 275 | |
276 | 276 | $this->object->release( $conn ); |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | |
282 | 282 | public function testStmtSimpleInvalidBindParamType() |
283 | 283 | { |
284 | - $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
284 | + $sqlinsert2 = 'INSERT INTO "mw_unit_test" ("id", "name") VALUES (?, ?)'; |
|
285 | 285 | |
286 | 286 | $conn = $this->object->acquire(); |
287 | 287 | |
288 | 288 | try |
289 | 289 | { |
290 | 290 | $stmt2 = $conn->create( $sqlinsert2 ); |
291 | - $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
292 | - $stmt2->bind( 2, 0.15, 123); |
|
291 | + $stmt2->bind( 1, 1, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
292 | + $stmt2->bind( 2, 0.15, 123 ); |
|
293 | 293 | $stmt2->execute(); |
294 | 294 | } |
295 | 295 | catch( \Aimeos\MW\DB\Exception $de ) |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | $this->object->release( $conn ); |
302 | - $this->fail('An expected exception has not been raised'); |
|
302 | + $this->fail( 'An expected exception has not been raised' ); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -312,13 +312,13 @@ discard block |
||
312 | 312 | try { |
313 | 313 | $stmt = $conn->create( $sqlinsert ); |
314 | 314 | $stmt->execute(); |
315 | - } catch ( \Aimeos\MW\DB\Exception $de ) { |
|
315 | + } catch( \Aimeos\MW\DB\Exception $de ) { |
|
316 | 316 | $this->object->release( $conn ); |
317 | 317 | return; |
318 | 318 | } |
319 | 319 | |
320 | 320 | $this->object->release( $conn ); |
321 | - $this->fail('An expected exception has not been raised'); |
|
321 | + $this->fail( 'An expected exception has not been raised' ); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $stmt->bind( 2, 'test', 123 ); |
434 | 434 | $stmt->execute(); |
435 | 435 | } |
436 | - catch ( \Aimeos\MW\DB\Exception $e ) |
|
436 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
437 | 437 | { |
438 | 438 | $this->object->release( $conn ); |
439 | 439 | throw $e; |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | { |
464 | 464 | $conn->create( $sql )->execute()->finish(); |
465 | 465 | } |
466 | - catch ( \Aimeos\MW\DB\Exception $e ) |
|
466 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
467 | 467 | { |
468 | 468 | $this->object->release( $conn ); |
469 | 469 | throw $e; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | { |
482 | 482 | $conn->create( 'SELECT *' )->execute()->finish(); |
483 | 483 | } |
484 | - catch ( \Aimeos\MW\DB\Exception $e ) |
|
484 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
485 | 485 | { |
486 | 486 | $this->object->release( $conn ); |
487 | 487 | throw $e; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | { |
502 | 502 | $conn->create( $sql, 123 ); |
503 | 503 | } |
504 | - catch (\Aimeos\MW\DB\Exception $e) |
|
504 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
505 | 505 | { |
506 | 506 | $this->object->release( $conn ); |
507 | 507 | throw $e; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | |
521 | 521 | public function testDBFactory() |
522 | 522 | { |
523 | - $this->assertInstanceOf(\Aimeos\MW\DB\Manager\Iface::class, $this->object); |
|
523 | + $this->assertInstanceOf( \Aimeos\MW\DB\Manager\Iface::class, $this->object ); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * Undo all schema changes and migrate data back |
64 | 64 | * |
65 | 65 | * @return void |
66 | - */ |
|
66 | + */ |
|
67 | 67 | public function rollback() |
68 | 68 | { |
69 | 69 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * Cleans up old data required for roll back |
74 | 74 | * |
75 | 75 | * @return void |
76 | - */ |
|
76 | + */ |
|
77 | 77 | public function clean() |
78 | 78 | { |
79 | 79 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return \Aimeos\MW\DB\Connection\Iface Database connection |
110 | 110 | */ |
111 | - protected function acquire( $name = 'db') |
|
111 | + protected function acquire( $name = 'db' ) |
|
112 | 112 | { |
113 | 113 | return $this->dbm->acquire( $name ); |
114 | 114 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | protected function msg( $msg, $level = 0, $status = null ) |
238 | 238 | { |
239 | 239 | $pre = ''; |
240 | - for( $i = 0; $i < 2*$level; $i++ ) { |
|
240 | + for( $i = 0; $i < 2 * $level; $i++ ) { |
|
241 | 241 | $pre .= ' '; |
242 | 242 | } |
243 | 243 | |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | $matches = []; |
269 | 269 | |
270 | 270 | $regex = '/CREATE TABLE \"?([a-zA-Z0-9_]+)\"? .*(\n\n|$)/sU'; |
271 | - if ( preg_match_all($regex, $content, $matches, PREG_SET_ORDER) === false ) { |
|
272 | - throw new \Aimeos\MW\Setup\Exception('Unable to get table definitions'); |
|
271 | + if( preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) === false ) { |
|
272 | + throw new \Aimeos\MW\Setup\Exception( 'Unable to get table definitions' ); |
|
273 | 273 | } |
274 | 274 | |
275 | - foreach ( $matches as $match ) { |
|
275 | + foreach( $matches as $match ) { |
|
276 | 276 | $defs[$match[1]] = $match[0]; |
277 | 277 | } |
278 | 278 | |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $defs = []; |
292 | 292 | $matches = []; |
293 | 293 | |
294 | - if ( preg_match_all('/CREATE [a-zA-Z]* ?INDEX \"?([a-zA-Z0-9_]+)\"? ON \"?([a-zA-Z0-9_]+)\"? .+(\n\n|$)/sU', $content, $matches, PREG_SET_ORDER) === false ) { |
|
295 | - throw new \Aimeos\MW\Setup\Exception('Unable to get index definitions'); |
|
294 | + if( preg_match_all( '/CREATE [a-zA-Z]* ?INDEX \"?([a-zA-Z0-9_]+)\"? ON \"?([a-zA-Z0-9_]+)\"? .+(\n\n|$)/sU', $content, $matches, PREG_SET_ORDER ) === false ) { |
|
295 | + throw new \Aimeos\MW\Setup\Exception( 'Unable to get index definitions' ); |
|
296 | 296 | } |
297 | 297 | |
298 | - foreach ( $matches as $match ) { |
|
298 | + foreach( $matches as $match ) { |
|
299 | 299 | $name = $match[2] . '.' . $match[1]; |
300 | 300 | $defs[$name] = $match[0]; |
301 | 301 | } |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | $matches = []; |
317 | 317 | |
318 | 318 | $regex = '/CREATE TRIGGER \"?([a-zA-Z0-9_]+)\"? .*(\n\n|$)/sU'; |
319 | - if ( preg_match_all($regex, $content, $matches, PREG_SET_ORDER) === false ) { |
|
320 | - throw new \Aimeos\MW\Setup\Exception('Unable to get trigger definitions'); |
|
319 | + if( preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) === false ) { |
|
320 | + throw new \Aimeos\MW\Setup\Exception( 'Unable to get trigger definitions' ); |
|
321 | 321 | } |
322 | 322 | |
323 | - foreach ( $matches as $match ) { |
|
323 | + foreach( $matches as $match ) { |
|
324 | 324 | $defs[$match[1]] = $match[0]; |
325 | 325 | } |
326 | 326 |
@@ -112,9 +112,12 @@ |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - try { |
|
115 | + try |
|
116 | + { |
|
116 | 117 | $this->image->resizeImage( $width, $height, \Imagick::FILTER_CUBIC, 0.8 ); |
117 | - } catch( \Exception $e ) { |
|
118 | + } |
|
119 | + catch( \Exception $e ) |
|
120 | + { |
|
118 | 121 | throw new \Aimeos\MW\Media\Exception( $e->getMessage() ); |
119 | 122 | } |
120 | 123 |
@@ -104,9 +104,12 @@ |
||
104 | 104 | */ |
105 | 105 | public function scan( $path = null ) |
106 | 106 | { |
107 | - try { |
|
107 | + try |
|
108 | + { |
|
108 | 109 | return new \DirectoryIterator( $this->resolve( $path ) ); |
109 | - } catch( \Exception $e ) { |
|
110 | + } |
|
111 | + catch( \Exception $e ) |
|
112 | + { |
|
110 | 113 | throw new Exception( $e->getMessage(), 0, $e ); |
111 | 114 | } |
112 | 115 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | * @param string $data Value to escape |
38 | 38 | * @return string Escaped string |
39 | 39 | */ |
40 | - public function escape($data) |
|
40 | + public function escape( $data ) |
|
41 | 41 | { |
42 | 42 | $quoted = $this->getRawObject()->quote( $data ); |
43 | 43 |
@@ -189,12 +189,10 @@ |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | return \Aimeos\MW\DB\Statement\Base::PARAM_STR; |
192 | - } |
|
193 | - else if( strpos( $item, '.' ) !== false ) |
|
192 | + } else if( strpos( $item, '.' ) !== false ) |
|
194 | 193 | { |
195 | 194 | return \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT; |
196 | - } |
|
197 | - else if( ctype_digit( $item ) !== false ) |
|
195 | + } else if( ctype_digit( $item ) !== false ) |
|
198 | 196 | { |
199 | 197 | return \Aimeos\MW\DB\Statement\Base::PARAM_INT; |
200 | 198 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param mixed $default Value returned if requested key isn't found |
28 | 28 | * @return mixed Value associated to the requested key |
29 | 29 | */ |
30 | - public function get($name, $default = null); |
|
30 | + public function get( $name, $default = null ); |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Sets the value for the specified key. |
@@ -36,5 +36,5 @@ discard block |
||
36 | 36 | * @param mixed $value Value that should be associated with the given path |
37 | 37 | * @return null |
38 | 38 | */ |
39 | - public function set($name, $value); |
|
39 | + public function set( $name, $value ); |
|
40 | 40 | } |
41 | 41 | \ No newline at end of file |