@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | $this->editor = \TestHelperMShop::getContext()->getEditor(); |
21 | 21 | $manager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( \TestHelperMShop::getContext() ); |
22 | - $this->object = $manager->getSubManager( 'property' )->getSubManager('type'); |
|
22 | + $this->object = $manager->getSubManager( 'property' )->getSubManager( 'type' ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | protected function tearDown() |
27 | 27 | { |
28 | - unset($this->object); |
|
28 | + unset( $this->object ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | $results = $this->object->searchItems( $search ); |
70 | 70 | |
71 | - if( ($expected = reset($results) ) === false ) |
|
71 | + if( ( $expected = reset( $results ) ) === false ) |
|
72 | 72 | { |
73 | 73 | throw new \RuntimeException( 'No property type item found.' ); |
74 | 74 | } |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | { |
91 | 91 | $search = $this->object->createSearch(); |
92 | 92 | $search->setConditions( $search->compare( '==', 'attribute.property.type.editor', $this->editor ) ); |
93 | - $results = $this->object->searchItems($search); |
|
93 | + $results = $this->object->searchItems( $search ); |
|
94 | 94 | |
95 | - if( ( $item = reset($results) ) === false ) { |
|
95 | + if( ( $item = reset( $results ) ) === false ) { |
|
96 | 96 | throw new \RuntimeException( 'No type item found' ); |
97 | 97 | } |
98 | 98 | |
99 | - $item->setId(null); |
|
99 | + $item->setId( null ); |
|
100 | 100 | $item->setCode( 'unitTestSave' ); |
101 | 101 | $resultSaved = $this->object->saveItem( $item ); |
102 | 102 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $expr[] = $search->compare( '>=', 'attribute.property.type.ctime', '1970-01-01 00:00:00' ); |
157 | 157 | $expr[] = $search->compare( '==', 'attribute.property.type.editor', $this->editor ); |
158 | 158 | |
159 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
159 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
160 | 160 | $results = $this->object->searchItems( $search, [], $total ); |
161 | 161 | $this->assertEquals( 1, count( $results ) ); |
162 | 162 | |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | $search->compare( '=~', 'attribute.property.type.code', '' ), |
167 | 167 | $search->compare( '==', 'attribute.property.type.editor', $this->editor ) |
168 | 168 | ); |
169 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
170 | - $search->setSlice(0, 1); |
|
171 | - $items = $this->object->searchItems( $search, [], $total); |
|
169 | + $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
170 | + $search->setSlice( 0, 1 ); |
|
171 | + $items = $this->object->searchItems( $search, [], $total ); |
|
172 | 172 | |
173 | 173 | $this->assertEquals( 1, count( $items ) ); |
174 | 174 | $this->assertEquals( 3, $total ); |
175 | 175 | |
176 | - foreach($items as $itemId => $item) { |
|
176 | + foreach( $items as $itemId => $item ) { |
|
177 | 177 | $this->assertEquals( $itemId, $item->getId() ); |
178 | 178 | } |
179 | 179 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | public function testGetSubManager() |
183 | 183 | { |
184 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
185 | - $this->object->getSubManager('unknown'); |
|
184 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
185 | + $this->object->getSubManager( 'unknown' ); |
|
186 | 186 | } |
187 | 187 | } |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $search->setConditions( $search->compare( '==', 'attribute.property.editor', $this->editor ) ); |
55 | 55 | $results = $this->object->searchItems( $search ); |
56 | 56 | |
57 | - if( ( $item = reset($results) ) === false ) { |
|
57 | + if( ( $item = reset( $results ) ) === false ) { |
|
58 | 58 | throw new \RuntimeException( 'No property item found' ); |
59 | 59 | } |
60 | 60 | |
61 | - $item->setId(null); |
|
61 | + $item->setId( null ); |
|
62 | 62 | $item->setLanguageId( 'en' ); |
63 | 63 | $resultSaved = $this->object->saveItem( $item ); |
64 | 64 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | { |
110 | 110 | $search = $this->object->createSearch(); |
111 | 111 | $conditions = array( |
112 | - $search->compare( '~=', 'attribute.property.value', '1024'), |
|
112 | + $search->compare( '~=', 'attribute.property.value', '1024' ), |
|
113 | 113 | $search->compare( '==', 'attribute.property.editor', $this->editor ) |
114 | 114 | ); |
115 | 115 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
116 | 116 | $results = $this->object->searchItems( $search ); |
117 | 117 | |
118 | - if( ($expected = reset($results)) === false ) { |
|
118 | + if( ( $expected = reset( $results ) ) === false ) { |
|
119 | 119 | throw new \RuntimeException( sprintf( 'No attribute property item found for value "%1$s".', '1024' ) ); |
120 | 120 | } |
121 | 121 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $expr[] = $search->compare( '>=', 'attribute.property.type.ctime', '1970-01-01 00:00:00' ); |
167 | 167 | $expr[] = $search->compare( '==', 'attribute.property.type.editor', $this->editor ); |
168 | 168 | |
169 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
169 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
170 | 170 | $results = $this->object->searchItems( $search, [], $total ); |
171 | 171 | $this->assertEquals( 1, count( $results ) ); |
172 | 172 | |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | $search->compare( '==', 'attribute.property.editor', $this->editor ) |
178 | 178 | ); |
179 | 179 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
180 | - $search->setSlice(0, 1); |
|
180 | + $search->setSlice( 0, 1 ); |
|
181 | 181 | $items = $this->object->searchItems( $search, [], $total ); |
182 | 182 | |
183 | 183 | $this->assertEquals( 1, count( $items ) ); |
184 | 184 | $this->assertEquals( 3, $total ); |
185 | 185 | |
186 | - foreach($items as $itemId => $item) { |
|
186 | + foreach( $items as $itemId => $item ) { |
|
187 | 187 | $this->assertEquals( $itemId, $item->getId() ); |
188 | 188 | } |
189 | 189 | } |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | |
192 | 192 | public function testGetSubManager() |
193 | 193 | { |
194 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
195 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
194 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type' ) ); |
|
195 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type', 'Standard' ) ); |
|
196 | 196 | |
197 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
198 | - $this->object->getSubManager('unknown'); |
|
197 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
198 | + $this->object->getSubManager( 'unknown' ); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | 202 | public function testGetSubManagerInvalidName() |
203 | 203 | { |
204 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
205 | - $this->object->getSubManager('type', 'unknown'); |
|
204 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
205 | + $this->object->getSubManager( 'type', 'unknown' ); |
|
206 | 206 | } |
207 | 207 | } |
@@ -132,6 +132,9 @@ |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | + /** |
|
136 | + * @param string $name |
|
137 | + */ |
|
135 | 138 | protected function access( $name ) |
136 | 139 | { |
137 | 140 | $class = new \ReflectionClass( '\Aimeos\MShop\Plugin\Provider\Order\ProductFreeOptions' ); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $attribute->setQuantity( 2 ); |
55 | 55 | $attribute->setCode( 'size' ); |
56 | 56 | $attribute->setType( 'config' ); |
57 | - $attribute->setAttributeId( $attrManager->findItem( 'xs', [], 'product', 'size')->getId() ); |
|
57 | + $attribute->setAttributeId( $attrManager->findItem( 'xs', [], 'product', 'size' )->getId() ); |
|
58 | 58 | |
59 | 59 | $product->setAttributeItem( $attribute ); |
60 | 60 | $product->setProductId( $prodManager->findItem( 'CNE' )->getId() ); |
@@ -78,8 +78,7 @@ |
||
78 | 78 | { |
79 | 79 | $list = $this->sortByPrice( $list, $attrQtys ); |
80 | 80 | $priceItem = $this->addPrices( $priceItem, $list, $attrQtys, (int) $prodConf[$type] ); |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | $priceItem = $this->addPrices( $priceItem, $list, $attrQtys, 0 ); |
85 | 84 | } |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | $filepath = $this->getFilePath( $file->getClientFilename(), 'preview', $mimeprev ); |
62 | 62 | $this->storeFile( $media->save( null, $mimetype ), $fsname, $filepath, $item->getPreview() ); |
63 | 63 | $item->setPreview( $filepath ); |
64 | - } |
|
65 | - else |
|
64 | + } else |
|
66 | 65 | { |
67 | 66 | $mimetype = $media->getMimeType(); |
68 | 67 | $item->setPreview( $this->getMimeIcon( $mimetype ) ); |
@@ -103,7 +102,9 @@ discard block |
||
103 | 102 | $fs->rm( $path ); |
104 | 103 | } |
105 | 104 | } |
106 | - catch( \Exception $e ) { ; } // Can be a mime icon with relative path |
|
105 | + catch( \Exception $e ) |
|
106 | + { |
|
107 | +; } // Can be a mime icon with relative path |
|
107 | 108 | |
108 | 109 | $item->setPreview( '' ); |
109 | 110 | } |
@@ -486,7 +487,9 @@ discard block |
||
486 | 487 | $fs->rm( $oldpath ); |
487 | 488 | } |
488 | 489 | } |
489 | - catch( \Aimeos\MW\Filesystem\Exception $e ) {} // continue if removing file fails |
|
490 | + catch( \Aimeos\MW\Filesystem\Exception $e ) |
|
491 | + { |
|
492 | +} // continue if removing file fails |
|
490 | 493 | |
491 | 494 | $fs->write( $filepath, $content ); |
492 | 495 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $fs->rm( $path ); |
104 | 104 | } |
105 | 105 | } |
106 | - catch( \Exception $e ) { ; } // Can be a mime icon with relative path |
|
106 | + catch( \Exception $e ) {; } // Can be a mime icon with relative path |
|
107 | 107 | |
108 | 108 | $item->setPreview( '' ); |
109 | 109 | } |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | $list = $this->context->getConfig()->get( 'controller/common/media/standard/extensions', [] ); |
226 | 226 | |
227 | 227 | if( isset( $list[$mimetype] ) ) { |
228 | - $ext = '.' . $list[$mimetype]; |
|
228 | + $ext = '.'.$list[$mimetype]; |
|
229 | 229 | } |
230 | 230 | |
231 | - $filename = md5( $filename . getmypid() . microtime( true ) ); |
|
231 | + $filename = md5( $filename.getmypid().microtime( true ) ); |
|
232 | 232 | |
233 | 233 | return "${type}/${filename[0]}/${filename[1]}/${filename}${ext}"; |
234 | 234 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | $ext = $config->get( 'controller/common/media/standard/mimeicon/extension', '.png' ); |
319 | 319 | |
320 | - return $mimedir . DIRECTORY_SEPARATOR . $mimetype . $ext; |
|
320 | + return $mimedir.DIRECTORY_SEPARATOR.$mimetype.$ext; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @category User |
362 | 362 | */ |
363 | 363 | $default = array( 'image/jpeg', 'image/png', 'image/gif' ); |
364 | - $allowed = $config->get( 'controller/common/media/standard/' . $type . '/allowedtypes', $default ); |
|
364 | + $allowed = $config->get( 'controller/common/media/standard/'.$type.'/allowedtypes', $default ); |
|
365 | 365 | |
366 | 366 | if( in_array( $mimetype, $allowed ) === false ) |
367 | 367 | { |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @category Developer |
423 | 423 | * @category User |
424 | 424 | */ |
425 | - $maxwidth = $config->get( 'controller/common/media/standard/' . $type . '/maxwidth', null ); |
|
425 | + $maxwidth = $config->get( 'controller/common/media/standard/'.$type.'/maxwidth', null ); |
|
426 | 426 | |
427 | 427 | /** controller/common/media/standard/files/maxheight |
428 | 428 | * Maximum height of the uploaded images |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @category Developer |
460 | 460 | * @category User |
461 | 461 | */ |
462 | - $maxheight = $config->get( 'controller/common/media/standard/' . $type . '/maxheight', null ); |
|
462 | + $maxheight = $config->get( 'controller/common/media/standard/'.$type.'/maxheight', null ); |
|
463 | 463 | |
464 | 464 | return $media->scale( $maxwidth, $maxheight ); |
465 | 465 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | public function testRun() |
24 | 24 | { |
25 | 25 | $object = new \Aimeos\MW\Process\Pcntl(); |
26 | - $fcn = function() { sleep( 1 ); }; |
|
26 | + $fcn = function() |
|
27 | + { |
|
28 | +sleep( 1 ); }; |
|
27 | 29 | |
28 | 30 | $start = microtime( true ); |
29 | 31 | $return = $object->start( $fcn, [] )->start( $fcn, [] )->wait(); |
@@ -37,7 +39,9 @@ discard block |
||
37 | 39 | |
38 | 40 | public function testRunException() |
39 | 41 | { |
40 | - $fcn = function() { throw new \Exception(); }; |
|
42 | + $fcn = function() |
|
43 | + { |
|
44 | +throw new \Exception(); }; |
|
41 | 45 | |
42 | 46 | try |
43 | 47 | { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * Processes the order |
181 | 181 | * |
182 | 182 | * @param \Aimeos\MShop\Order\Item\Iface $order Order invoice object to process |
183 | - * @param array $params Request parameter if available |
|
183 | + * @param string[] $params Request parameter if available |
|
184 | 184 | * @return \Aimeos\MShop\Common\Item\Helper\Form\Standard|null Form object or null |
185 | 185 | */ |
186 | 186 | public function process( \Aimeos\MShop\Order\Item\Iface $order, array $params = [] ) |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | /** |
266 | 266 | * Updates the orders for whose status updates have been received by the confirmation page |
267 | 267 | * |
268 | - * @param ServerRequestInterface $request Request object with parameters and request body |
|
268 | + * @param \Psr\Http\Message\ServerRequestInterface $request Request object with parameters and request body |
|
269 | 269 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item that should be updated |
270 | 270 | * @return \Aimeos\MShop\Order\Item\Iface Updated order item |
271 | 271 | * @throws \Aimeos\MShop\Service\Exception If updating the orders failed |
@@ -146,7 +146,7 @@ |
||
146 | 146 | /** |
147 | 147 | * Updates the orders for whose status updates have been received by the confirmation page |
148 | 148 | * |
149 | - * @param ServerRequestInterface $request Request object with parameters and request body |
|
149 | + * @param \Psr\Http\Message\ServerRequestInterface $request Request object with parameters and request body |
|
150 | 150 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item that should be updated |
151 | 151 | * @return \Aimeos\MShop\Order\Item\Iface Updated order item |
152 | 152 | * @throws \Aimeos\MShop\Service\Exception If updating the orders failed |
@@ -33,6 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @param \Aimeos\MW\Observer\Publisher\Iface $publisher Publisher object |
35 | 35 | * @param string $type Plugin type code |
36 | + * @return void |
|
36 | 37 | */ |
37 | 38 | public function register( \Aimeos\MW\Observer\Publisher\Iface $publisher, $type ); |
38 | 39 | } |