@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function checkClass( $name, $object ) |
31 | 31 | { |
32 | - if( ($object instanceof $name) === false ) { |
|
32 | + if( ( $object instanceof $name ) === false ) { |
|
33 | 33 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Object doesn\'t implement "%1$s"', $name ) ); |
34 | 34 | } |
35 | 35 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public static function checkClassList( $name, array $list ) |
46 | 46 | { |
47 | 47 | foreach( $list as $object ) { |
48 | - if( ($object instanceof $name) === false ) { |
|
48 | + if( ( $object instanceof $name ) === false ) { |
|
49 | 49 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Object doesn\'t implement "%1$s"', $name ) ); |
50 | 50 | } |
51 | 51 | } |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | foreach( $attributes as $key => $item ) |
99 | 99 | { |
100 | 100 | if( $item instanceof $iface ) { |
101 | - $translations[ $item->getCode() ] = $item->getInternalCode(); |
|
101 | + $translations[$item->getCode()] = $item->getInternalCode(); |
|
102 | 102 | } else if( isset( $item['code'] ) ) { |
103 | - $translations[ $item['code'] ] = $item['internalcode']; |
|
103 | + $translations[$item['code']] = $item['internalcode']; |
|
104 | 104 | } else { |
105 | 105 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid attribute at position "%1$d"', $key ) ); |
106 | 106 | } |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | foreach( $attributes as $key => $item ) |
127 | 127 | { |
128 | 128 | if( $item instanceof $iface ) { |
129 | - $types[ $item->getCode() ] = $item->getInternalType(); |
|
129 | + $types[$item->getCode()] = $item->getInternalType(); |
|
130 | 130 | } else if( isset( $item['code'] ) ) { |
131 | - $types[ $item['code'] ] = $item['internaltype']; |
|
131 | + $types[$item['code']] = $item['internaltype']; |
|
132 | 132 | } else { |
133 | 133 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid attribute at position "%1$d"', $key ) ); |
134 | 134 | } |
@@ -311,6 +311,9 @@ |
||
311 | 311 | |
312 | 312 | class TestBase extends \Aimeos\MShop\Service\Provider\Base |
313 | 313 | { |
314 | + /** |
|
315 | + * @param integer $ts |
|
316 | + */ |
|
314 | 317 | public function calcDateLimitPublic( $ts, $days = 0, $bd = false, $hd = '' ) |
315 | 318 | { |
316 | 319 | return $this->calcDateLimit( $ts, $days, $bd, $hd ); |
@@ -335,6 +335,9 @@ |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | |
338 | + /** |
|
339 | + * @param string $name |
|
340 | + */ |
|
338 | 341 | protected function access( $name ) |
339 | 342 | { |
340 | 343 | $class = new \ReflectionClass( '\Aimeos\Controller\Common\Media\Standard' ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $file = $this->getMockBuilder( '\Psr\Http\Message\UploadedFileInterface' )->getMock(); |
42 | 42 | $file->expects( $this->once() )->method( 'getStream' ) |
43 | - ->will( $this->returnValue( file_get_contents( __DIR__ . '/testfiles/test.gif' ) ) ); |
|
43 | + ->will( $this->returnValue( file_get_contents( __DIR__.'/testfiles/test.gif' ) ) ); |
|
44 | 44 | |
45 | 45 | $item = \Aimeos\MShop\Factory::createManager( $this->context, 'media' )->createItem(); |
46 | 46 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $file = $this->getMockBuilder( '\Psr\Http\Message\UploadedFileInterface' )->getMock(); |
62 | 62 | $file->expects( $this->once() )->method( 'getStream' ) |
63 | - ->will( $this->returnValue( file_get_contents( __DIR__ . '/testfiles/test.pdf' ) ) ); |
|
63 | + ->will( $this->returnValue( file_get_contents( __DIR__.'/testfiles/test.pdf' ) ) ); |
|
64 | 64 | |
65 | 65 | $item = \Aimeos\MShop\Factory::createManager( $this->context, 'media' )->createItem(); |
66 | 66 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ->getMock(); |
109 | 109 | |
110 | 110 | $object->expects( $this->once() )->method( 'getFileContent' ) |
111 | - ->will( $this->returnValue( file_get_contents( __DIR__ . '/testfiles/test.png' ) ) ); |
|
111 | + ->will( $this->returnValue( file_get_contents( __DIR__.'/testfiles/test.png' ) ) ); |
|
112 | 112 | |
113 | 113 | $object->expects( $this->exactly( 2 ) )->method( 'storeFile' ); |
114 | 114 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | public function testGetFileContent() |
206 | 206 | { |
207 | - $dest = dirname( dirname( dirname( __DIR__ ) ) ) . '/tmp/'; |
|
207 | + $dest = dirname( dirname( dirname( __DIR__ ) ) ).'/tmp/'; |
|
208 | 208 | if( !is_dir( $dest ) ) { mkdir( $dest, 0755, true ); } |
209 | - copy( __DIR__ . '/testfiles/test.gif', $dest . 'test.gif' ); |
|
209 | + copy( __DIR__.'/testfiles/test.gif', $dest.'test.gif' ); |
|
210 | 210 | |
211 | 211 | $result = $this->access( 'getFileContent' )->invokeArgs( $this->object, array( 'test.gif', 'fs-media' ) ); |
212 | 212 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | public function testGetMimeType() |
298 | 298 | { |
299 | - $file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.png' ); |
|
299 | + $file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.png' ); |
|
300 | 300 | |
301 | 301 | $result = $this->access( 'getMimeType' )->invokeArgs( $this->object, array( $file, 'files' ) ); |
302 | 302 | $this->assertEquals( 'image/png', $result ); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | public function testGetMimeTypeNotAllowed() |
307 | 307 | { |
308 | - $file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.gif' ); |
|
308 | + $file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.gif' ); |
|
309 | 309 | $this->context->getConfig()->set( 'controller/common/media/standard/files/allowedtypes', array( 'image/jpeg' ) ); |
310 | 310 | |
311 | 311 | $result = $this->access( 'getMimeType' )->invokeArgs( $this->object, array( $file, 'files' ) ); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | public function testGetMimeTypeNoTypes() |
317 | 317 | { |
318 | - $file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.gif' ); |
|
318 | + $file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.gif' ); |
|
319 | 319 | $this->context->getConfig()->set( 'controller/common/media/standard/files/allowedtypes', [] ); |
320 | 320 | |
321 | 321 | $this->setExpectedException( '\Aimeos\Controller\Common\Exception' ); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | public function testScaleImage() |
327 | 327 | { |
328 | - $file = \Aimeos\MW\Media\Factory::get( __DIR__ . '/testfiles/test.gif' ); |
|
328 | + $file = \Aimeos\MW\Media\Factory::get( __DIR__.'/testfiles/test.gif' ); |
|
329 | 329 | |
330 | 330 | $this->access( 'scaleImage' )->invokeArgs( $this->object, array( $file, 'files' ) ); |
331 | 331 | } |
@@ -333,18 +333,18 @@ discard block |
||
333 | 333 | |
334 | 334 | public function testStoreFile() |
335 | 335 | { |
336 | - $content = file_get_contents( __DIR__ . '/testfiles/test.gif' ); |
|
336 | + $content = file_get_contents( __DIR__.'/testfiles/test.gif' ); |
|
337 | 337 | |
338 | - $dest = dirname( dirname( dirname( __DIR__ ) ) ) . '/tmp/'; |
|
338 | + $dest = dirname( dirname( dirname( __DIR__ ) ) ).'/tmp/'; |
|
339 | 339 | if( !is_dir( $dest ) ) { mkdir( $dest, 0755, true ); } |
340 | - copy( __DIR__ . '/testfiles/test.gif', $dest . 'test2.gif' ); |
|
340 | + copy( __DIR__.'/testfiles/test.gif', $dest.'test2.gif' ); |
|
341 | 341 | |
342 | 342 | $this->access( 'storeFile' )->invokeArgs( $this->object, array( $content, 'fs-media', 'test.gif', 'test2.gif' ) ); |
343 | 343 | |
344 | - $this->assertFalse( file_exists( $dest . 'test2.gif' ) ); |
|
345 | - $this->assertTrue( file_exists( $dest . 'test.gif' ) ); |
|
344 | + $this->assertFalse( file_exists( $dest.'test2.gif' ) ); |
|
345 | + $this->assertTrue( file_exists( $dest.'test.gif' ) ); |
|
346 | 346 | |
347 | - unlink( $dest . 'test.gif' ); |
|
347 | + unlink( $dest.'test.gif' ); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 |
@@ -86,7 +86,7 @@ |
||
86 | 86 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Basket of the customer |
87 | 87 | * @param string $type Service type constant from \Aimeos\MShop\Order\Item\Base\Service\Base |
88 | 88 | * @param string|null $code Service item code |
89 | - * @return \Aimeos\MShop\Order\Item\Base\Service\Iface|null Order service item if available or null otherwise |
|
89 | + * @return \Aimeos\MShop\Common\Item\Iface|null Order service item if available or null otherwise |
|
90 | 90 | */ |
91 | 91 | protected function getServiceItem( \Aimeos\MShop\Order\Item\Base\Iface $order, $type, $code = null ) |
92 | 92 | { |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * Returns the search results for the given SQL statement. |
606 | 606 | * |
607 | 607 | * @param \Aimeos\MW\DB\Connection\Iface $conn Database connection |
608 | - * @param $sql SQL statement |
|
608 | + * @param string $sql SQL statement |
|
609 | 609 | * @return \Aimeos\MW\DB\Result\Iface Search result object |
610 | 610 | */ |
611 | 611 | protected function getSearchResults( \Aimeos\MW\DB\Connection\Iface $conn, $sql ) |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * Returns the total number of items found for the conditions |
636 | 636 | * |
637 | 637 | * @param \Aimeos\MW\DB\Connection\Iface $conn Database connection |
638 | - * @param array $find List of markers that should be replaced in the SQL statement |
|
638 | + * @param string[] $find List of markers that should be replaced in the SQL statement |
|
639 | 639 | * @param array $replace List of replacements for the markers in the SQL statement |
640 | 640 | * @throws \Aimeos\MShop\Locale\Exception If no total value was found |
641 | 641 | * @return integer Total number of found items |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $replace = array( |
370 | 370 | $search->getConditionString( $types, $translations ), |
371 | 371 | $search->getSortationString( $types, $translations ), |
372 | - ( $columns ? ', ' . $columns : '' ), |
|
372 | + ( $columns ? ', '.$columns : '' ), |
|
373 | 373 | $search->getSliceStart(), |
374 | 374 | $search->getSliceSize(), |
375 | 375 | ); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @see mshop/locale/manager/currency/decorators/global |
582 | 582 | */ |
583 | 583 | |
584 | - return $this->getSubManagerBase( 'locale', 'currency/' . $manager, $name ); |
|
584 | + return $this->getSubManagerBase( 'locale', 'currency/'.$manager, $name ); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | protected function getSearchResults( \Aimeos\MW\DB\Connection\Iface $conn, $sql ) |
612 | 612 | { |
613 | 613 | $statement = $conn->create( $sql ); |
614 | - $this->getContext()->getLogger()->log( __METHOD__ . ': SQL statement: ' . $statement, \Aimeos\MW\Logger\Base::DEBUG ); |
|
614 | + $this->getContext()->getLogger()->log( __METHOD__.': SQL statement: '.$statement, \Aimeos\MW\Logger\Base::DEBUG ); |
|
615 | 615 | |
616 | 616 | $results = $statement->execute(); |
617 | 617 |
@@ -105,9 +105,12 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function createItem() |
107 | 107 | { |
108 | - try { |
|
108 | + try |
|
109 | + { |
|
109 | 110 | $values = array( 'locale.currency.siteid' => $this->getContext()->getLocale()->getSiteId() ); |
110 | - } catch( \Exception $ex ) { |
|
111 | + } |
|
112 | + catch( \Exception $ex ) |
|
113 | + { |
|
111 | 114 | $values = array( 'locale.currency.siteid' => null ); |
112 | 115 | } |
113 | 116 | |
@@ -177,8 +180,7 @@ discard block |
||
177 | 180 | * @see mshop/locale/manager/currency/standard/count/ansi |
178 | 181 | */ |
179 | 182 | $path = 'mshop/locale/manager/currency/standard/insert'; |
180 | - } |
|
181 | - else |
|
183 | + } else |
|
182 | 184 | { |
183 | 185 | /** mshop/locale/manager/currency/standard/update/mysql |
184 | 186 | * Updates an existing currency record in the database |
@@ -55,9 +55,12 @@ discard block |
||
55 | 55 | $config = $this->getItemBase()->getConfig(); |
56 | 56 | if( !isset( $config['threshold'] ) ) { return true; } |
57 | 57 | |
58 | - try { |
|
58 | + try |
|
59 | + { |
|
59 | 60 | $delivery = $order->getService( 'delivery' ); |
60 | - } catch( \Aimeos\MShop\Order\Exception $oe ) { |
|
61 | + } |
|
62 | + catch( \Aimeos\MShop\Order\Exception $oe ) |
|
63 | + { |
|
61 | 64 | // no delivery item available yet |
62 | 65 | return true; |
63 | 66 | } |
@@ -94,8 +97,7 @@ discard block |
||
94 | 97 | { |
95 | 98 | $price->setRebate( $price->getCosts() ); |
96 | 99 | $price->setCosts( '0.00' ); |
97 | - } |
|
98 | - else if( $sum->getValue() + $sum->getRebate() < $threshold[$currency] && $price->getRebate() > '0.00' ) |
|
100 | + } else if( $sum->getValue() + $sum->getRebate() < $threshold[$currency] && $price->getRebate() > '0.00' ) |
|
99 | 101 | { |
100 | 102 | $price->setCosts( $price->getRebate() ); |
101 | 103 | $price->setRebate( '0.00' ); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @see mshop/index/manager/price/decorators/global |
403 | 403 | */ |
404 | 404 | |
405 | - return $this->getSubManagerBase( 'index', 'price/' . $manager, $name ); |
|
405 | + return $this->getSubManagerBase( 'index', 'price/'.$manager, $name ); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | |
734 | 734 | try { |
735 | 735 | $stmt->execute()->finish(); |
736 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // Ignore duplicates |
|
736 | + } catch( \Aimeos\MW\DB\Exception $e ) {; } // Ignore duplicates |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | } |
@@ -731,9 +731,13 @@ |
||
731 | 731 | $stmt->bind( 13, $editor ); |
732 | 732 | $stmt->bind( 14, $date ); //ctime |
733 | 733 | |
734 | - try { |
|
734 | + try |
|
735 | + { |
|
735 | 736 | $stmt->execute()->finish(); |
736 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // Ignore duplicates |
|
737 | + } |
|
738 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
739 | + { |
|
740 | +; } // Ignore duplicates |
|
737 | 741 | } |
738 | 742 | } |
739 | 743 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @see mshop/index/manager/attribute/decorators/global |
359 | 359 | */ |
360 | 360 | |
361 | - return $this->getSubManagerBase( 'index', 'attribute/' . $manager, $name ); |
|
361 | + return $this->getSubManagerBase( 'index', 'attribute/'.$manager, $name ); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | |
684 | 684 | try { |
685 | 685 | $stmt->execute()->finish(); |
686 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // Ignore duplicates |
|
686 | + } catch( \Aimeos\MW\DB\Exception $e ) {; } // Ignore duplicates |
|
687 | 687 | } |
688 | 688 | } |
689 | 689 | } |
@@ -681,9 +681,13 @@ |
||
681 | 681 | $stmt->bind( 8, $editor ); |
682 | 682 | $stmt->bind( 9, $date ); // ctime |
683 | 683 | |
684 | - try { |
|
684 | + try |
|
685 | + { |
|
685 | 686 | $stmt->execute()->finish(); |
686 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // Ignore duplicates |
|
687 | + } |
|
688 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
689 | + { |
|
690 | +; } // Ignore duplicates |
|
687 | 691 | } |
688 | 692 | } |
689 | 693 | } |