@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | |
28 | 28 | public function test() |
29 | 29 | { |
30 | - try { |
|
30 | + try |
|
31 | + { |
|
31 | 32 | throw new \Aimeos\MShop\Plugin\Provider\Exception( 'msg', 13, null, $this->codes ); |
32 | 33 | } |
33 | 34 | catch( \Aimeos\MShop\Plugin\Provider\Exception $mppe ) |
@@ -38,11 +39,12 @@ discard block |
||
38 | 39 | |
39 | 40 | } |
40 | 41 | |
41 | - try { |
|
42 | + try |
|
43 | + { |
|
42 | 44 | throw new \Aimeos\MShop\Plugin\Provider\Exception( 'msg2', 11 ); |
43 | 45 | } |
44 | - catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
45 | - { |
|
46 | + catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
47 | + { |
|
46 | 48 | $this->assertEquals( array(), $e->getErrorCodes() ); |
47 | 49 | } |
48 | 50 | } |
@@ -19,8 +19,8 @@ |
||
19 | 19 | |
20 | 20 | $servManager = \Aimeos\MShop\Service\Manager\Factory::createManager( $this->context ); |
21 | 21 | $search = $servManager->createSearch(); |
22 | - $search->setConditions($search->compare('==', 'service.provider', 'Standard')); |
|
23 | - $result = $servManager->searchItems($search, array('price')); |
|
22 | + $search->setConditions( $search->compare( '==', 'service.provider', 'Standard' ) ); |
|
23 | + $result = $servManager->searchItems( $search, array( 'price' ) ); |
|
24 | 24 | |
25 | 25 | if( ( $item = reset( $result ) ) === false ) { |
26 | 26 | throw new \Exception( 'No order base item found' ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
96 | 96 | $results = $this->object->searchItems( $search ); |
97 | 97 | |
98 | - if( ( $item = reset($results) ) === false ) { |
|
98 | + if( ( $item = reset( $results ) ) === false ) { |
|
99 | 99 | throw new \Exception( 'No list item found' ); |
100 | 100 | } |
101 | 101 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | |
106 | 106 | public function testGetSubManager() |
107 | 107 | { |
108 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
109 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
108 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type' ) ); |
|
109 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'type', 'Standard' ) ); |
|
110 | 110 | |
111 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
112 | - $this->object->getSubManager('unknown'); |
|
111 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
112 | + $this->object->getSubManager( 'unknown' ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | throw new \Exception( 'No item found' ); |
130 | 130 | } |
131 | 131 | |
132 | - $item->setId(null); |
|
132 | + $item->setId( null ); |
|
133 | 133 | $item->setDomain( 'unittest' ); |
134 | 134 | $this->object->saveItem( $item ); |
135 | 135 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -305,25 +305,25 @@ discard block |
||
305 | 305 | $expr[] = $search->compare( '>=', 'supplier.lists.ctime', '1970-01-01 00:00:00' ); |
306 | 306 | $expr[] = $search->compare( '==', 'supplier.lists.editor', $this->editor ); |
307 | 307 | |
308 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
308 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
309 | 309 | $results = $this->object->searchItems( $search, array(), $total ); |
310 | 310 | $this->assertEquals( 1, count( $results ) ); |
311 | 311 | |
312 | 312 | |
313 | 313 | //search with base criteria |
314 | - $search = $this->object->createSearch(true); |
|
314 | + $search = $this->object->createSearch( true ); |
|
315 | 315 | $expr = array( |
316 | 316 | $search->compare( '==', 'supplier.lists.domain', 'text' ), |
317 | 317 | $search->compare( '==', 'supplier.lists.editor', $this->editor ), |
318 | 318 | $search->getConditions(), |
319 | 319 | ); |
320 | 320 | $search->setConditions( $search->combine( '&&', $expr ) ); |
321 | - $search->setSlice(0, 1); |
|
322 | - $results = $this->object->searchItems($search, array(), $total); |
|
321 | + $search->setSlice( 0, 1 ); |
|
322 | + $results = $this->object->searchItems( $search, array(), $total ); |
|
323 | 323 | $this->assertEquals( 1, count( $results ) ); |
324 | 324 | $this->assertEquals( 3, $total ); |
325 | 325 | |
326 | - foreach($results as $itemId => $item) { |
|
326 | + foreach( $results as $itemId => $item ) { |
|
327 | 327 | $this->assertEquals( $itemId, $item->getId() ); |
328 | 328 | } |
329 | 329 | } |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | public function testGetItem() |
68 | 68 | { |
69 | 69 | $search = $this->object->createSearch(); |
70 | - $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor) ); |
|
71 | - $results = $this->object->searchItems($search); |
|
70 | + $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor ) ); |
|
71 | + $results = $this->object->searchItems( $search ); |
|
72 | 72 | |
73 | - if( ( $expected = reset($results) ) === false ) { |
|
73 | + if( ( $expected = reset( $results ) ) === false ) { |
|
74 | 74 | throw new \Exception( 'No attribute list type item found' ); |
75 | 75 | } |
76 | 76 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | public function testSaveUpdateDeleteItem() |
81 | 81 | { |
82 | 82 | $search = $this->object->createSearch(); |
83 | - $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor) ); |
|
84 | - $results = $this->object->searchItems($search); |
|
83 | + $search->setConditions( $search->compare( '==', 'supplier.lists.type.editor', $this->editor ) ); |
|
84 | + $results = $this->object->searchItems( $search ); |
|
85 | 85 | |
86 | - if( ( $item = reset($results) ) === false ) { |
|
86 | + if( ( $item = reset( $results ) ) === false ) { |
|
87 | 87 | throw new \Exception( 'No type item found' ); |
88 | 88 | } |
89 | 89 | |
90 | - $item->setId(null); |
|
90 | + $item->setId( null ); |
|
91 | 91 | $item->setCode( 'unitTestSave' ); |
92 | 92 | $this->object->saveItem( $item ); |
93 | 93 | $itemSaved = $this->object->getItem( $item->getId() ); |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | $expr[] = $search->compare( '>=', 'supplier.lists.type.ctime', '1970-01-01 00:00:00' ); |
144 | 144 | $expr[] = $search->compare( '==', 'supplier.lists.type.editor', $this->editor ); |
145 | 145 | |
146 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
147 | - $search->setSlice(0, 1); |
|
146 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
147 | + $search->setSlice( 0, 1 ); |
|
148 | 148 | $results = $this->object->searchItems( $search, array(), $total ); |
149 | 149 | $this->assertEquals( 1, count( $results ) ); |
150 | 150 | $this->assertEquals( 1, $total ); |
151 | 151 | |
152 | - foreach($results as $itemId => $item) { |
|
152 | + foreach( $results as $itemId => $item ) { |
|
153 | 153 | $this->assertEquals( $itemId, $item->getId() ); |
154 | 154 | } |
155 | 155 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function testGetSubManager() |
159 | 159 | { |
160 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
161 | - $this->object->getSubManager('unknown'); |
|
160 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
161 | + $this->object->getSubManager( 'unknown' ); |
|
162 | 162 | } |
163 | 163 | } |
@@ -90,8 +90,8 @@ |
||
90 | 90 | |
91 | 91 | foreach( $required as $entry ) |
92 | 92 | { |
93 | - if ( !isset($params[$entry]) ) { |
|
94 | - throw new \Aimeos\MW\Common\Exception( sprintf('Required parameter "%1$s" is missing', $entry) ); |
|
93 | + if( !isset( $params[$entry] ) ) { |
|
94 | + throw new \Aimeos\MW\Common\Exception( sprintf( 'Required parameter "%1$s" is missing', $entry ) ); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | if( in_array( $op, $operators['combine'] ) ) { |
73 | 73 | return $this->createCombineExpression( $op, (array) $value ); |
74 | - } |
|
75 | - else if( in_array( $op, $operators['compare'] ) ) { |
|
74 | + } else if( in_array( $op, $operators['compare'] ) ) { |
|
76 | 75 | return $this->createCompareExpression( $op, (array) $value ); |
77 | 76 | } |
78 | 77 | |
@@ -126,11 +125,9 @@ discard block |
||
126 | 125 | |
127 | 126 | if( in_array( $op, $operators['combine'] ) ) { |
128 | 127 | $results[] = $this->createCombineExpression( $op, (array) $entry[$op] ); |
129 | - } |
|
130 | - else if( in_array( $op, $operators['compare'] ) ) { |
|
128 | + } else if( in_array( $op, $operators['compare'] ) ) { |
|
131 | 129 | $results[] = $this->createCompareExpression( $op, (array) $entry[$op] ); |
132 | - } |
|
133 | - else { |
|
130 | + } else { |
|
134 | 131 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid operator "%1$s"', $op ) ); |
135 | 132 | } |
136 | 133 | } |
@@ -226,8 +226,7 @@ |
||
226 | 226 | |
227 | 227 | $params[] = implode( ',', $list ); |
228 | 228 | } |
229 | - } |
|
230 | - else |
|
229 | + } else |
|
231 | 230 | { |
232 | 231 | $params[] = $this->escape( '==', $this->getParamType( $string ), $string ); |
233 | 232 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public static function createFunction( $name, array $params ) |
34 | 34 | { |
35 | - return $name . '(' . self::createSignature( $params ) . ')'; |
|
35 | + return $name.'('.self::createSignature( $params ).')'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | case 'double': |
56 | 56 | $list[] = $param; break; |
57 | 57 | case 'array': |
58 | - $list[] = '[' . self::createSignature( $param ) . ']'; break; |
|
58 | + $list[] = '['.self::createSignature( $param ).']'; break; |
|
59 | 59 | default: |
60 | - $list[] = '"' . $param . '"'; |
|
60 | + $list[] = '"'.$param.'"'; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | protected function isFunction( &$name, array &$params ) |
78 | 78 | { |
79 | 79 | $len = strlen( $name ); |
80 | - if( $len === 0 || $name[$len-1] !== ')' ) { return false; } |
|
80 | + if( $len === 0 || $name[$len - 1] !== ')' ) { return false; } |
|
81 | 81 | |
82 | 82 | if( ( $pos = strpos( $name, '(' ) ) === false ) { |
83 | 83 | throw new \Aimeos\MW\Common\Exception( 'Missing opening bracket for function syntax' ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $params = $this->extractParams( $matches[1] ); |
103 | 103 | } |
104 | 104 | |
105 | - $name = $namestr . '()'; |
|
105 | + $name = $namestr.'()'; |
|
106 | 106 | return true; |
107 | 107 | } |
108 | 108 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $count = count( $params ); |
131 | 131 | |
132 | 132 | for( $i = 0; $i < $count; $i++ ) { |
133 | - $find[$i] = '$' . ( $i + 1 ); |
|
133 | + $find[$i] = '$'.( $i + 1 ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return str_replace( $find, $params, $transname ); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function setPlugins( array $plugins ) |
170 | 170 | { |
171 | - \Aimeos\MW\Common\Base::checkClassList('\\Aimeos\\MW\\Criteria\\Plugin\\Iface', $plugins); |
|
171 | + \Aimeos\MW\Common\Base::checkClassList( '\\Aimeos\\MW\\Criteria\\Plugin\\Iface', $plugins ); |
|
172 | 172 | |
173 | 173 | $this->plugins = $plugins; |
174 | 174 | } |
@@ -154,12 +154,10 @@ |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | return \Aimeos\MW\DB\Statement\Base::PARAM_STR; |
157 | - } |
|
158 | - else if( strpos( $item, '.' ) !== false ) |
|
157 | + } else if( strpos( $item, '.' ) !== false ) |
|
159 | 158 | { |
160 | 159 | return \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT; |
161 | - } |
|
162 | - else if( ctype_digit( $item ) !== false ) |
|
160 | + } else if( ctype_digit( $item ) !== false ) |
|
163 | 161 | { |
164 | 162 | return \Aimeos\MW\DB\Statement\Base::PARAM_INT; |
165 | 163 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid name "%1$s"', $name ) ); |
103 | 103 | } |
104 | 104 | |
105 | - return $transname . ' ' . self::$operators[$this->operator]; |
|
105 | + return $transname.' '.self::$operators[$this->operator]; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | $value = (float) $value; break; |
129 | 129 | case \Aimeos\MW\DB\Statement\Base::PARAM_STR: |
130 | 130 | if( $operator == '~=' ) { |
131 | - $value = '\'%' . $this->conn->escape( $value ) . '%\''; break; |
|
131 | + $value = '\'%'.$this->conn->escape( $value ).'%\''; break; |
|
132 | 132 | } |
133 | 133 | default: |
134 | - $value = '\'' . $this->conn->escape( $value ) . '\''; |
|
134 | + $value = '\''.$this->conn->escape( $value ).'\''; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return (string) $value; |
@@ -72,7 +72,7 @@ |
||
72 | 72 | ); |
73 | 73 | |
74 | 74 | $expr1 = array(); |
75 | - $expr1[] = new \Aimeos\MW\Criteria\Expression\Compare\PHP( '==', 'listitem', array('a', 'b', 'c') ); |
|
75 | + $expr1[] = new \Aimeos\MW\Criteria\Expression\Compare\PHP( '==', 'listitem', array( 'a', 'b', 'c' ) ); |
|
76 | 76 | $expr1[] = new \Aimeos\MW\Criteria\Expression\Compare\PHP( '==', 'stringvar', 'value' ); |
77 | 77 | |
78 | 78 |