@@ -16,7 +16,9 @@ |
||
16 | 16 | { |
17 | 17 | $object = new \Aimeos\MW\Process\None(); |
18 | 18 | |
19 | - $this->assertInstanceOf( '\Aimeos\MW\Process\Iface', $object->start( function() {}, [] ) ); |
|
19 | + $this->assertInstanceOf( '\Aimeos\MW\Process\Iface', $object->start( function() |
|
20 | + { |
|
21 | +}, [] ) ); |
|
20 | 22 | } |
21 | 23 | |
22 | 24 |
@@ -647,9 +647,12 @@ discard block |
||
647 | 647 | |
648 | 648 | foreach( $sitePath as $siteId ) |
649 | 649 | { |
650 | - try { |
|
650 | + try |
|
651 | + { |
|
651 | 652 | $path = $this->createTreeManager( $siteId )->getPath( $id ); |
652 | - } catch( \Exception $e ) { |
|
653 | + } |
|
654 | + catch( \Exception $e ) |
|
655 | + { |
|
653 | 656 | continue; |
654 | 657 | } |
655 | 658 | |
@@ -684,9 +687,12 @@ discard block |
||
684 | 687 | |
685 | 688 | foreach( $sitePath as $siteId ) |
686 | 689 | { |
687 | - try { |
|
690 | + try |
|
691 | + { |
|
688 | 692 | $node = $this->createTreeManager( $siteId )->getNode( $id, $level, $criteria ); |
689 | - } catch( \Exception $e ) { |
|
693 | + } |
|
694 | + catch( \Exception $e ) |
|
695 | + { |
|
690 | 696 | continue; |
691 | 697 | } |
692 | 698 | |
@@ -807,8 +813,7 @@ discard block |
||
807 | 813 | * @see mshop/catalog/manager/standard/insert-usage/ansi |
808 | 814 | */ |
809 | 815 | $path = 'mshop/catalog/manager/standard/update-usage'; |
810 | - } |
|
811 | - else |
|
816 | + } else |
|
812 | 817 | { |
813 | 818 | /** mshop/catalog/manager/standard/insert-usage/mysql |
814 | 819 | * Updates the config, editor, ctime and mtime value of an inserted record |
@@ -864,8 +869,7 @@ discard block |
||
864 | 869 | { |
865 | 870 | $stmt->bind( 5, $siteid, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
866 | 871 | $stmt->bind( 6, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
867 | - } |
|
868 | - else |
|
872 | + } else |
|
869 | 873 | { |
870 | 874 | $stmt->bind( 5, $date ); // ctime |
871 | 875 | $stmt->bind( 6, $siteid, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
@@ -612,7 +612,7 @@ |
||
612 | 612 | $cfgPathCount = 'mshop/catalog/manager/standard/count'; |
613 | 613 | |
614 | 614 | if( $search->getSortations() === [] ) { |
615 | - $search->setSortations( [$search->sort( '+', 'catalog.left')] ); |
|
615 | + $search->setSortations( [$search->sort( '+', 'catalog.left' )] ); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | /** |
272 | 272 | * Deletes the item specified by its ID. |
273 | 273 | * |
274 | - * @param mixed $id ID of the item object |
|
274 | + * @param string $id ID of the item object |
|
275 | 275 | */ |
276 | 276 | public function deleteItem( $id ) |
277 | 277 | { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | /** |
295 | 295 | * Removes multiple items specified by ids in the array. |
296 | 296 | * |
297 | - * @param array $ids List of IDs |
|
297 | + * @param integer[] $ids List of IDs |
|
298 | 298 | */ |
299 | 299 | public function deleteItems( array $ids ) |
300 | 300 | { |
@@ -478,6 +478,7 @@ discard block |
||
478 | 478 | * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
479 | 479 | * @param string[] $ref List of domains to fetch list items and referenced items for |
480 | 480 | * @param integer|null &$total Number of items that are available in total |
481 | + * @param integer $total |
|
481 | 482 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
482 | 483 | */ |
483 | 484 | public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | $this->editor = \TestHelperMShop::getContext()->getEditor(); |
21 | 21 | $manager = \Aimeos\MShop\Product\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( '==', 'product.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,24 +156,24 @@ discard block |
||
156 | 156 | $expr[] = $search->compare( '>=', 'product.property.type.ctime', '1970-01-01 00:00:00' ); |
157 | 157 | $expr[] = $search->compare( '==', 'product.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 | |
163 | 163 | |
164 | 164 | $search = $this->object->createSearch(); |
165 | 165 | $conditions = array( |
166 | - $search->compare( '=~', 'product.property.type.code', 'package-'), |
|
166 | + $search->compare( '=~', 'product.property.type.code', 'package-' ), |
|
167 | 167 | $search->compare( '==', 'product.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( 4, $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( '==', 'product.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( '~=', 'product.property.value', '25.0'), |
|
112 | + $search->compare( '~=', 'product.property.value', '25.0' ), |
|
113 | 113 | $search->compare( '==', 'product.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 product property item found for value "%1$s".', '25.0' ) ); |
120 | 120 | } |
121 | 121 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $expr[] = $search->compare( '>=', 'product.property.type.ctime', '1970-01-01 00:00:00' ); |
167 | 167 | $expr[] = $search->compare( '==', 'product.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( '==', 'product.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( 8, $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 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | public function testGetItem() |
54 | 54 | { |
55 | 55 | $search = $this->object->createSearch(); |
56 | - $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor) ); |
|
57 | - $results = $this->object->searchItems($search); |
|
56 | + $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor ) ); |
|
57 | + $results = $this->object->searchItems( $search ); |
|
58 | 58 | |
59 | - if( ( $expected = reset($results) ) === false ) { |
|
59 | + if( ( $expected = reset( $results ) ) === false ) { |
|
60 | 60 | throw new \RuntimeException( 'No attribute list type item found' ); |
61 | 61 | } |
62 | 62 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | public function testSaveUpdateDeleteItem() |
75 | 75 | { |
76 | 76 | $search = $this->object->createSearch(); |
77 | - $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor) ); |
|
78 | - $results = $this->object->searchItems($search); |
|
77 | + $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor ) ); |
|
78 | + $results = $this->object->searchItems( $search ); |
|
79 | 79 | |
80 | - if( ( $item = reset($results) ) === false ) { |
|
80 | + if( ( $item = reset( $results ) ) === false ) { |
|
81 | 81 | throw new \RuntimeException( 'No type item found' ); |
82 | 82 | } |
83 | 83 | |
84 | - $item->setId(null); |
|
84 | + $item->setId( null ); |
|
85 | 85 | $item->setCode( 'unitTestSave' ); |
86 | 86 | $resultSaved = $this->object->saveItem( $item ); |
87 | 87 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | $expr[] = $search->compare( '>=', 'supplier.lists.type.ctime', '1970-01-01 00:00:00' ); |
141 | 141 | $expr[] = $search->compare( '==', 'supplier.lists.type.editor', $this->editor ); |
142 | 142 | |
143 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
144 | - $search->setSlice(0, 1); |
|
143 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
144 | + $search->setSlice( 0, 1 ); |
|
145 | 145 | $results = $this->object->searchItems( $search, [], $total ); |
146 | 146 | $this->assertEquals( 1, count( $results ) ); |
147 | 147 | $this->assertEquals( 1, $total ); |
148 | 148 | |
149 | - foreach($results as $itemId => $item) { |
|
149 | + foreach( $results as $itemId => $item ) { |
|
150 | 150 | $this->assertEquals( $itemId, $item->getId() ); |
151 | 151 | } |
152 | 152 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | public function testGetSubManager() |
156 | 156 | { |
157 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
158 | - $this->object->getSubManager('unknown'); |
|
157 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
158 | + $this->object->getSubManager( 'unknown' ); |
|
159 | 159 | } |
160 | 160 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
81 | 81 | $results = $this->object->searchItems( $search ); |
82 | 82 | |
83 | - if( ( $item = reset($results) ) === false ) { |
|
83 | + if( ( $item = reset( $results ) ) === false ) { |
|
84 | 84 | throw new \RuntimeException( 'No list item found' ); |
85 | 85 | } |
86 | 86 | |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | |
92 | 92 | public function testGetSubManager() |
93 | 93 | { |
94 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
95 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
94 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type' ) ); |
|
95 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type', 'Standard' ) ); |
|
96 | 96 | |
97 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
98 | - $this->object->getSubManager('unknown'); |
|
97 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
98 | + $this->object->getSubManager( 'unknown' ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | throw new \RuntimeException( 'No item found' ); |
123 | 123 | } |
124 | 124 | |
125 | - $item->setId(null); |
|
125 | + $item->setId( null ); |
|
126 | 126 | $item->setDomain( 'unittest' ); |
127 | 127 | $resultSaved = $this->object->saveItem( $item ); |
128 | 128 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -301,25 +301,25 @@ discard block |
||
301 | 301 | $expr[] = $search->compare( '>=', 'supplier.lists.ctime', '1970-01-01 00:00:00' ); |
302 | 302 | $expr[] = $search->compare( '==', 'supplier.lists.editor', $this->editor ); |
303 | 303 | |
304 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
304 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
305 | 305 | $results = $this->object->searchItems( $search, [], $total ); |
306 | 306 | $this->assertEquals( 1, count( $results ) ); |
307 | 307 | |
308 | 308 | |
309 | 309 | //search with base criteria |
310 | - $search = $this->object->createSearch(true); |
|
310 | + $search = $this->object->createSearch( true ); |
|
311 | 311 | $expr = array( |
312 | 312 | $search->compare( '==', 'supplier.lists.domain', 'text' ), |
313 | 313 | $search->compare( '==', 'supplier.lists.editor', $this->editor ), |
314 | 314 | $search->getConditions(), |
315 | 315 | ); |
316 | 316 | $search->setConditions( $search->combine( '&&', $expr ) ); |
317 | - $search->setSlice(0, 1); |
|
318 | - $results = $this->object->searchItems($search, [], $total); |
|
317 | + $search->setSlice( 0, 1 ); |
|
318 | + $results = $this->object->searchItems( $search, [], $total ); |
|
319 | 319 | $this->assertEquals( 1, count( $results ) ); |
320 | 320 | $this->assertEquals( 3, $total ); |
321 | 321 | |
322 | - foreach($results as $itemId => $item) { |
|
322 | + foreach( $results as $itemId => $item ) { |
|
323 | 323 | $this->assertEquals( $itemId, $item->getId() ); |
324 | 324 | } |
325 | 325 | } |
@@ -44,9 +44,9 @@ |
||
44 | 44 | $len = strlen( $part ); |
45 | 45 | |
46 | 46 | if( $len > 3 ) { |
47 | - $str .= ' +' . $part . '*'; |
|
47 | + $str .= ' +'.$part.'*'; |
|
48 | 48 | } else if( $len > 0 ) { |
49 | - $str .= ' ' . $part . '*'; |
|
49 | + $str .= ' '.$part.'*'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $regex = '/(\s|\&|\%|\?|\#|\=|\{|\}|\||\\\\|\~|\[|\]|\`|\^|\/|\-|\+|\>|\<|\(|\)|\*|\:|\"|\!|\§|\$|\'|\;|\.|\,|\@)+/'; |
39 | 39 | $search = trim( preg_replace( $regex, ' ', $params[2] ) ); |
40 | 40 | |
41 | - $params[2] = implode( ':* & ', explode( ' ', $search ) ) . ':*'; |
|
41 | + $params[2] = implode( ':* & ', explode( ' ', $search ) ).':*'; |
|
42 | 42 | } |
43 | 43 | break; |
44 | 44 | } |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | $address = $basket->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
79 | 79 | |
80 | 80 | if( ( $fn = $address->getFirstname() ) !== '' && ( $ln = $address->getLastname() ) !== '' ) { |
81 | - $feconfig['directdebit.accountowner']['default'] = $fn . ' ' . $ln; |
|
81 | + $feconfig['directdebit.accountowner']['default'] = $fn.' '.$ln; |
|
82 | 82 | } |
83 | 83 | } |
84 | - catch( \Aimeos\MShop\Order\Exception $e ) { ; } // If address isn't available |
|
84 | + catch( \Aimeos\MShop\Order\Exception $e ) {; } // If address isn't available |
|
85 | 85 | |
86 | 86 | return $this->getConfigItems( $feconfig ); |
87 | 87 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $len = strlen( $value ); |
120 | 120 | $xstr = ( $len > 3 ? str_repeat( 'X', $len - 3 ) : '' ); |
121 | 121 | |
122 | - $attrItem->setValue( $xstr . substr( $value, -3 ) ); |
|
122 | + $attrItem->setValue( $xstr.substr( $value, -3 ) ); |
|
123 | 123 | $orderServiceItem->setAttributeItem( $attrItem ); |
124 | 124 | } |
125 | 125 | } |
@@ -81,7 +81,9 @@ |
||
81 | 81 | $feconfig['directdebit.accountowner']['default'] = $fn . ' ' . $ln; |
82 | 82 | } |
83 | 83 | } |
84 | - catch( \Aimeos\MShop\Order\Exception $e ) { ; } // If address isn't available |
|
84 | + catch( \Aimeos\MShop\Order\Exception $e ) |
|
85 | + { |
|
86 | +; } // If address isn't available |
|
85 | 87 | |
86 | 88 | return $this->getConfigItems( $feconfig ); |
87 | 89 | } |