@@ -88,7 +88,8 @@ |
||
88 | 88 | return array_pop( $this->connections[$name] ); |
89 | 89 | |
90 | 90 | } |
91 | - catch( \Exception $e ) { |
|
91 | + catch( \Exception $e ) |
|
92 | + { |
|
92 | 93 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode() ); |
93 | 94 | } |
94 | 95 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | try |
74 | 74 | { |
75 | - $adapter = $this->config->get( 'resource/' . $name . '/adapter', 'mysql' ); |
|
75 | + $adapter = $this->config->get( 'resource/'.$name.'/adapter', 'mysql' ); |
|
76 | 76 | |
77 | 77 | if( !isset( $this->connections[$name] ) || empty( $this->connections[$name] ) ) |
78 | 78 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $this->count[$name] = 0; |
81 | 81 | } |
82 | 82 | |
83 | - $limit = $this->config->get( 'resource/' . $name . '/limit', -1 ); |
|
83 | + $limit = $this->config->get( 'resource/'.$name.'/limit', -1 ); |
|
84 | 84 | |
85 | 85 | if( $limit >= 0 && $this->count[$name] >= $limit ) |
86 | 86 | { |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected function createConnection( $name, $adapter ) |
128 | 128 | { |
129 | - $params = $this->config->get( 'resource/' . $name ); |
|
129 | + $params = $this->config->get( 'resource/'.$name ); |
|
130 | 130 | |
131 | - $params['user'] = $this->config->get( 'resource/' . $name . '/username' ); |
|
132 | - $params['dbname'] = $this->config->get( 'resource/' . $name . '/database' ); |
|
131 | + $params['user'] = $this->config->get( 'resource/'.$name.'/username' ); |
|
132 | + $params['dbname'] = $this->config->get( 'resource/'.$name.'/database' ); |
|
133 | 133 | |
134 | - if( ( $socket = $this->config->get( 'resource/' . $name . '/socket' ) ) != null ) { |
|
134 | + if( ( $socket = $this->config->get( 'resource/'.$name.'/socket' ) ) != null ) { |
|
135 | 135 | $params['unix_socket'] = $socket; |
136 | 136 | } |
137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | default: $params['driver'] = $adapter; |
145 | 145 | } |
146 | 146 | |
147 | - $stmts = $this->config->get( 'resource/' . $name . '/stmt', [] ); |
|
147 | + $stmts = $this->config->get( 'resource/'.$name.'/stmt', [] ); |
|
148 | 148 | |
149 | 149 | return new \Aimeos\MW\DB\Connection\DBAL( $params, $stmts ); |
150 | 150 | } |
@@ -88,7 +88,8 @@ discard block |
||
88 | 88 | return array_pop( $this->connections[$name] ); |
89 | 89 | |
90 | 90 | } |
91 | - catch( \PDOException $e ) { |
|
91 | + catch( \PDOException $e ) |
|
92 | + { |
|
92 | 93 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
93 | 94 | } |
94 | 95 | } |
@@ -131,8 +132,7 @@ discard block |
||
131 | 132 | { |
132 | 133 | $dsn .= isset( $host ) ? ';host=' . $host : ''; |
133 | 134 | $dsn .= isset( $port ) ? ';port=' . $port : ''; |
134 | - } |
|
135 | - else |
|
135 | + } else |
|
136 | 136 | { |
137 | 137 | $dsn .= ';unix_socket=' . $sock; |
138 | 138 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | try |
75 | 75 | { |
76 | - $adapter = $this->config->get( 'resource/' . $name . '/adapter', 'mysql' ); |
|
76 | + $adapter = $this->config->get( 'resource/'.$name.'/adapter', 'mysql' ); |
|
77 | 77 | |
78 | 78 | if( !isset( $this->connections[$name] ) || empty( $this->connections[$name] ) ) |
79 | 79 | { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $this->count[$name] = 0; |
82 | 82 | } |
83 | 83 | |
84 | - $limit = $this->config->get( 'resource/' . $name . '/limit', -1 ); |
|
84 | + $limit = $this->config->get( 'resource/'.$name.'/limit', -1 ); |
|
85 | 85 | |
86 | 86 | if( $limit >= 0 && $this->count[$name] >= $limit ) |
87 | 87 | { |
@@ -127,27 +127,27 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function createConnection( $name, $adapter ) |
129 | 129 | { |
130 | - $host = $this->config->get( 'resource/' . $name . '/host' ); |
|
131 | - $port = $this->config->get( 'resource/' . $name . '/port' ); |
|
132 | - $user = $this->config->get( 'resource/' . $name . '/username' ); |
|
133 | - $pass = $this->config->get( 'resource/' . $name . '/password' ); |
|
134 | - $sock = $this->config->get( 'resource/' . $name . '/socket' ); |
|
135 | - $dbase = $this->config->get( 'resource/' . $name . '/database' ); |
|
136 | - $persist = $this->config->get( 'resource/' . $name . '/opt-persistent', false ); |
|
137 | - |
|
138 | - $dsn = $adapter . ':dbname=' . $dbase; |
|
130 | + $host = $this->config->get( 'resource/'.$name.'/host' ); |
|
131 | + $port = $this->config->get( 'resource/'.$name.'/port' ); |
|
132 | + $user = $this->config->get( 'resource/'.$name.'/username' ); |
|
133 | + $pass = $this->config->get( 'resource/'.$name.'/password' ); |
|
134 | + $sock = $this->config->get( 'resource/'.$name.'/socket' ); |
|
135 | + $dbase = $this->config->get( 'resource/'.$name.'/database' ); |
|
136 | + $persist = $this->config->get( 'resource/'.$name.'/opt-persistent', false ); |
|
137 | + |
|
138 | + $dsn = $adapter.':dbname='.$dbase; |
|
139 | 139 | if( $sock == null ) |
140 | 140 | { |
141 | - $dsn .= isset( $host ) ? ';host=' . $host : ''; |
|
142 | - $dsn .= isset( $port ) ? ';port=' . $port : ''; |
|
141 | + $dsn .= isset( $host ) ? ';host='.$host : ''; |
|
142 | + $dsn .= isset( $port ) ? ';port='.$port : ''; |
|
143 | 143 | } |
144 | 144 | else |
145 | 145 | { |
146 | - $dsn .= ';unix_socket=' . $sock; |
|
146 | + $dsn .= ';unix_socket='.$sock; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $params = array( $dsn, $user, $pass, array( \PDO::ATTR_PERSISTENT => $persist ) ); |
150 | - $stmts = $this->config->get( 'resource/' . $name . '/stmt', array() ); |
|
150 | + $stmts = $this->config->get( 'resource/'.$name.'/stmt', array() ); |
|
151 | 151 | |
152 | 152 | return new \Aimeos\MW\DB\Connection\PDO( $params, $stmts ); |
153 | 153 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | $message = json_encode( $message ); |
72 | 72 | } |
73 | 73 | |
74 | - if( error_log( '<' . $facility . '> ' . $level . ' ' . $message ) === false ) { |
|
74 | + if( error_log( '<'.$facility.'> '.$level.' '.$message ) === false ) { |
|
75 | 75 | throw new \Aimeos\MW\Logger\Exception( sprintf( |
76 | 76 | 'Unable to log message with priority "%1$d": %2$s', $priority, $message ) ); |
77 | 77 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Log messages to a database table. |
17 | - * |
|
17 | + * |
|
18 | 18 | * @package MW |
19 | 19 | * @subpackage Logger |
20 | 20 | */ |
@@ -45,7 +45,7 @@ |
||
45 | 45 | $this->facilities = $facilities; |
46 | 46 | |
47 | 47 | if( $requestid === null ) { |
48 | - $requestid = md5( php_uname('n') . getmypid() . date( 'Y-m-d H:i:s' ) ); |
|
48 | + $requestid = md5( php_uname( 'n' ).getmypid().date( 'Y-m-d H:i:s' ) ); |
|
49 | 49 | } |
50 | 50 | $this->requestid = $requestid; |
51 | 51 | } |
@@ -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 |
@@ -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 |