@@ -33,18 +33,18 @@ |
||
33 | 33 | { |
34 | 34 | if( ctype_alnum( $name ) === false ) |
35 | 35 | { |
36 | - $classname = is_string( $name ) ? '\\Aimeos\\MW\\Cache\\' . $name : '<not a string>'; |
|
36 | + $classname = is_string( $name ) ? '\\Aimeos\\MW\\Cache\\'.$name : '<not a string>'; |
|
37 | 37 | throw new \Aimeos\MW\Cache\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
38 | 38 | } |
39 | 39 | |
40 | 40 | $iface = '\\Aimeos\\MW\\Cache\\Iface'; |
41 | - $classname = '\\Aimeos\\MW\\Cache\\' . ucwords( $name ); |
|
41 | + $classname = '\\Aimeos\\MW\\Cache\\'.ucwords( $name ); |
|
42 | 42 | |
43 | 43 | if( class_exists( $classname ) === false ) { |
44 | 44 | throw new \Aimeos\MW\Cache\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
45 | 45 | } |
46 | 46 | |
47 | - $manager = new $classname( $config, $resource ); |
|
47 | + $manager = new $classname( $config, $resource ); |
|
48 | 48 | |
49 | 49 | if( !( $manager instanceof $iface ) ) { |
50 | 50 | throw new \Aimeos\MW\Cache\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | foreach( $paths as $path ) |
67 | 67 | { |
68 | - $location = $path . DIRECTORY_SEPARATOR . $locale; |
|
68 | + $location = $path.DIRECTORY_SEPARATOR.$locale; |
|
69 | 69 | |
70 | 70 | if( file_exists( $location ) ) |
71 | 71 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | if( strlen( $locale ) > 3 ) |
77 | 77 | { |
78 | - $location = $path . DIRECTORY_SEPARATOR . substr( $locale, 0, -strlen( strrchr( $locale, '_' ) ) ); |
|
78 | + $location = $path.DIRECTORY_SEPARATOR.substr( $locale, 0, -strlen( strrchr( $locale, '_' ) ) ); |
|
79 | 79 | |
80 | 80 | if( file_exists( $location ) ) { |
81 | 81 | $locations[] = $location; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $locale = substr( $locale, 0, -strlen( strrchr( $locale, '_' ) ) ); |
110 | 110 | } |
111 | 111 | |
112 | - switch ( $locale ) |
|
112 | + switch( $locale ) |
|
113 | 113 | { |
114 | 114 | case 'af': |
115 | 115 | case 'az': |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | case 'tk': |
163 | 163 | case 'ur': |
164 | 164 | case 'zu': |
165 | - return ($number == 1) ? 0 : 1; |
|
165 | + return ( $number == 1 ) ? 0 : 1; |
|
166 | 166 | |
167 | 167 | case 'am': |
168 | 168 | case 'bh': |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | case 'xbr': |
177 | 177 | case 'ti': |
178 | 178 | case 'wa': |
179 | - return (($number == 0) || ($number == 1)) ? 0 : 1; |
|
179 | + return ( ( $number == 0 ) || ( $number == 1 ) ) ? 0 : 1; |
|
180 | 180 | |
181 | 181 | case 'be': |
182 | 182 | case 'bs': |
@@ -184,41 +184,41 @@ discard block |
||
184 | 184 | case 'ru': |
185 | 185 | case 'sr': |
186 | 186 | case 'uk': |
187 | - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); |
|
187 | + return ( ( $number % 10 == 1 ) && ( $number % 100 != 11 ) ) ? 0 : ( ( ( $number % 10 >= 2 ) && ( $number % 10 <= 4 ) && ( ( $number % 100 < 10 ) || ( $number % 100 >= 20 ) ) ) ? 1 : 2 ); |
|
188 | 188 | |
189 | 189 | case 'cs': |
190 | 190 | case 'sk': |
191 | - return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); |
|
191 | + return ( $number == 1 ) ? 0 : ( ( ( $number >= 2 ) && ( $number <= 4 ) ) ? 1 : 2 ); |
|
192 | 192 | |
193 | 193 | case 'ar': |
194 | - return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number >= 3) && ($number <= 10)) ? 3 : ((($number >= 11) && ($number <= 99)) ? 4 : 5)))); |
|
194 | + return ( $number == 0 ) ? 0 : ( ( $number == 1 ) ? 1 : ( ( $number == 2 ) ? 2 : ( ( ( $number >= 3 ) && ( $number <= 10 ) ) ? 3 : ( ( ( $number >= 11 ) && ( $number <= 99 ) ) ? 4 : 5 ) ) ) ); |
|
195 | 195 | |
196 | 196 | case 'cy': |
197 | - return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); |
|
197 | + return ( $number == 1 ) ? 0 : ( ( $number == 2 ) ? 1 : ( ( ( $number == 8 ) || ( $number == 11 ) ) ? 2 : 3 ) ); |
|
198 | 198 | |
199 | 199 | case 'ga': |
200 | - return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); |
|
200 | + return ( $number == 1 ) ? 0 : ( ( $number == 2 ) ? 1 : 2 ); |
|
201 | 201 | |
202 | 202 | case 'lt': |
203 | - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); |
|
203 | + return ( ( $number % 10 == 1 ) && ( $number % 100 != 11 ) ) ? 0 : ( ( ( $number % 10 >= 2 ) && ( ( $number % 100 < 10 ) || ( $number % 100 >= 20 ) ) ) ? 1 : 2 ); |
|
204 | 204 | |
205 | 205 | case 'lv': |
206 | - return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); |
|
206 | + return ( $number == 0 ) ? 0 : ( ( ( $number % 10 == 1 ) && ( $number % 100 != 11 ) ) ? 1 : 2 ); |
|
207 | 207 | |
208 | 208 | case 'mk': |
209 | - return ($number % 10 == 1) ? 0 : 1; |
|
209 | + return ( $number % 10 == 1 ) ? 0 : 1; |
|
210 | 210 | |
211 | 211 | case 'mt': |
212 | - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); |
|
212 | + return ( $number == 1 ) ? 0 : ( ( ( $number == 0 ) || ( ( $number % 100 > 1 ) && ( $number % 100 < 11 ) ) ) ? 1 : ( ( ( $number % 100 > 10 ) && ( $number % 100 < 20 ) ) ? 2 : 3 ) ); |
|
213 | 213 | |
214 | 214 | case 'pl': |
215 | - return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); |
|
215 | + return ( $number == 1 ) ? 0 : ( ( ( $number % 10 >= 2 ) && ( $number % 10 <= 4 ) && ( ( $number % 100 < 12 ) || ( $number % 100 > 14 ) ) ) ? 1 : 2 ); |
|
216 | 216 | |
217 | 217 | case 'ro': |
218 | - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); |
|
218 | + return ( $number == 1 ) ? 0 : ( ( ( $number == 0 ) || ( ( $number % 100 > 0 ) && ( $number % 100 < 20 ) ) ) ? 1 : 2 ); |
|
219 | 219 | |
220 | 220 | case 'sl': |
221 | - return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); |
|
221 | + return ( $number % 100 == 1 ) ? 0 : ( ( $number % 100 == 2 ) ? 1 : ( ( ( $number % 100 == 3 ) || ( $number % 100 == 4 ) ) ? 2 : 3 ) ); |
|
222 | 222 | |
223 | 223 | default: |
224 | 224 | return 0; |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | { |
67 | 67 | foreach( $this->getTranslations( $domain ) as $content ) |
68 | 68 | { |
69 | - if ( isset( $content[$string][0] ) && is_array( $content[$string] ) ) { |
|
69 | + if( isset( $content[$string][0] ) && is_array( $content[$string] ) ) { |
|
70 | 70 | return $content[$string][0]; |
71 | 71 | } |
72 | 72 | |
73 | - if ( isset( $content[$string] ) && is_string( $content[$string] ) ) { |
|
73 | + if( isset( $content[$string] ) && is_string( $content[$string] ) ) { |
|
74 | 74 | return $content[$string]; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | - catch( \Exception $e ) { ; } // no translation found |
|
78 | + catch( \Exception $e ) {; } // no translation found |
|
79 | 79 | |
80 | 80 | return (string) $string; |
81 | 81 | } |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | { |
100 | 100 | foreach( $this->getTranslations( $domain ) as $content ) |
101 | 101 | { |
102 | - if ( isset( $content[$singular][$index] ) && is_array( $content[$singular] ) ) { |
|
102 | + if( isset( $content[$singular][$index] ) && is_array( $content[$singular] ) ) { |
|
103 | 103 | return $content[$singular][$index]; |
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | - catch( \Exception $e ) { ; } // no translation found |
|
107 | + catch( \Exception $e ) {; } // no translation found |
|
108 | 108 | |
109 | 109 | if( $index > 0 ) { |
110 | 110 | return (string) $plural; |
@@ -75,7 +75,9 @@ discard block |
||
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | - catch( \Exception $e ) { ; } // no translation found |
|
78 | + catch( \Exception $e ) |
|
79 | + { |
|
80 | +; } // no translation found |
|
79 | 81 | |
80 | 82 | return (string) $string; |
81 | 83 | } |
@@ -104,7 +106,9 @@ discard block |
||
104 | 106 | } |
105 | 107 | } |
106 | 108 | } |
107 | - catch( \Exception $e ) { ; } // no translation found |
|
109 | + catch( \Exception $e ) |
|
110 | + { |
|
111 | +; } // no translation found |
|
108 | 112 | |
109 | 113 | if( $index > 0 ) { |
110 | 114 | return (string) $plural; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function setId( $id ) |
120 | 120 | { |
121 | - if ( $id === null ) { |
|
121 | + if( $id === null ) { |
|
122 | 122 | $this->modified = true; |
123 | 123 | } |
124 | 124 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function setLabel( $name ) |
146 | 146 | { |
147 | - if ( $name == $this->getLabel() ) { return; } |
|
147 | + if( $name == $this->getLabel() ) { return; } |
|
148 | 148 | |
149 | 149 | $this->values['label'] = (string) $name; |
150 | 150 | $this->modified = true; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function setCode( $name ) |
171 | 171 | { |
172 | - if ( $name == $this->getCode() ) { return; } |
|
172 | + if( $name == $this->getCode() ) { return; } |
|
173 | 173 | |
174 | 174 | $this->values['code'] = (string) $name; |
175 | 175 | $this->modified = true; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function setStatus( $status ) |
195 | 195 | { |
196 | - if ( $status == $this->getStatus() ) { return; } |
|
196 | + if( $status == $this->getStatus() ) { return; } |
|
197 | 197 | |
198 | 198 | $this->values['status'] = (int) $status; |
199 | 199 | $this->modified = true; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return \Aimeos\MW\Tree\Node\Iface Selected node |
208 | 208 | * @throws \Aimeos\MW\Tree\Exception If there's no child at the given position |
209 | 209 | */ |
210 | - public function getChild($index) |
|
210 | + public function getChild( $index ) |
|
211 | 211 | { |
212 | 212 | if( isset( $this->children[$index] ) ) { |
213 | 213 | return $this->children[$index]; |
@@ -283,6 +283,6 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function count() |
285 | 285 | { |
286 | - return count($this->children); |
|
286 | + return count( $this->children ); |
|
287 | 287 | } |
288 | 288 | } |
@@ -33,18 +33,18 @@ |
||
33 | 33 | { |
34 | 34 | if( ctype_alnum( $name ) === false ) |
35 | 35 | { |
36 | - $classname = is_string( $name ) ? '\\Aimeos\\MW\\Tree\\Manager\\' . $name : '<not a string>'; |
|
36 | + $classname = is_string( $name ) ? '\\Aimeos\\MW\\Tree\\Manager\\'.$name : '<not a string>'; |
|
37 | 37 | throw new \Aimeos\MW\Tree\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
38 | 38 | } |
39 | 39 | |
40 | 40 | $iface = '\\Aimeos\\MW\\Tree\\Manager\\Iface'; |
41 | - $classname = '\\Aimeos\\MW\\Tree\\Manager\\' . $name; |
|
41 | + $classname = '\\Aimeos\\MW\\Tree\\Manager\\'.$name; |
|
42 | 42 | |
43 | 43 | if( class_exists( $classname ) === false ) { |
44 | 44 | throw new \Aimeos\MW\Tree\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
45 | 45 | } |
46 | 46 | |
47 | - $manager = new $classname( $config, $resource ); |
|
47 | + $manager = new $classname( $config, $resource ); |
|
48 | 48 | |
49 | 49 | if( !( $manager instanceof $iface ) ) { |
50 | 50 | throw new \Aimeos\MW\Tree\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) ); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $search->getConditions(), |
224 | 224 | $condition->getConditions() |
225 | 225 | ); |
226 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
226 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $types = $this->getSearchTypes( $this->searchConfig ); |
@@ -538,14 +538,14 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function searchNodes( \Aimeos\MW\Criteria\Iface $search, $id = null ) |
540 | 540 | { |
541 | - $left = 1; |
|
541 | + $left = 1; |
|
542 | 542 | $right = 0x7FFFFFFF; |
543 | 543 | |
544 | 544 | if( $id !== null ) |
545 | 545 | { |
546 | 546 | $node = $this->getNodeById( $id ); |
547 | 547 | |
548 | - $left = $node->left; |
|
548 | + $left = $node->left; |
|
549 | 549 | $right = $node->right; |
550 | 550 | } |
551 | 551 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | |
618 | 618 | $results = $this->searchNodes( $search ); |
619 | 619 | |
620 | - foreach ( $results as $item ) { |
|
620 | + foreach( $results as $item ) { |
|
621 | 621 | $result[$item->getId()] = $item; |
622 | 622 | } |
623 | 623 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | */ |
730 | 730 | protected function isChild( \Aimeos\MW\Tree\Node\Iface $node, \Aimeos\MW\Tree\Node\Iface $parent ) |
731 | 731 | { |
732 | - return $node->__get('left') > $parent->__get('left') && $node->__get('right') < $parent->__get('right'); |
|
732 | + return $node->__get( 'left' ) > $parent->__get( 'left' ) && $node->__get( 'right' ) < $parent->__get( 'right' ); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 |
@@ -201,8 +201,7 @@ discard block |
||
201 | 201 | if( $level === \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) { |
202 | 202 | return $node; |
203 | 203 | } |
204 | - } |
|
205 | - else |
|
204 | + } else |
|
206 | 205 | { |
207 | 206 | $node = $this->getNodeById( $id ); |
208 | 207 | |
@@ -276,15 +275,13 @@ discard block |
||
276 | 275 | $node->left = $refNode->left; |
277 | 276 | $node->right = $refNode->left + 1; |
278 | 277 | $node->level = $refNode->level; |
279 | - } |
|
280 | - else if( $parentId !== null ) |
|
278 | + } else if( $parentId !== null ) |
|
281 | 279 | { |
282 | 280 | $parentNode = $this->getNode( $parentId, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
283 | 281 | $node->left = $parentNode->right; |
284 | 282 | $node->right = $parentNode->right + 1; |
285 | 283 | $node->level = $parentNode->level + 1; |
286 | - } |
|
287 | - else |
|
284 | + } else |
|
288 | 285 | { |
289 | 286 | $node->left = 1; |
290 | 287 | $node->right = 2; |
@@ -375,8 +372,7 @@ discard block |
||
375 | 372 | $moveNodeRightBegin = $node->left + $diff + 1; |
376 | 373 | $moveNodeRightEnd = $node->right + $diff; |
377 | 374 | $movesize = $refNode->left - $node->left - $diff; |
378 | - } |
|
379 | - else |
|
375 | + } else |
|
380 | 376 | { |
381 | 377 | $moveNodeLeftBegin = $node->left; |
382 | 378 | $moveNodeLeftEnd = $node->right - 1; |
@@ -387,8 +383,7 @@ discard block |
||
387 | 383 | |
388 | 384 | $closeNodeLeftBegin = $node->left + $diff; |
389 | 385 | $closeNodeRightBegin = $node->left + $diff; |
390 | - } |
|
391 | - else |
|
386 | + } else |
|
392 | 387 | { |
393 | 388 | $refNode = $this->getNode( $newParentId, \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
394 | 389 | |
@@ -414,8 +409,7 @@ discard block |
||
414 | 409 | $moveNodeRightBegin = $node->left + $diff + 1; |
415 | 410 | $moveNodeRightEnd = $node->right + $diff; |
416 | 411 | $movesize = $refNode->right - $node->left - $diff; |
417 | - } |
|
418 | - else |
|
412 | + } else |
|
419 | 413 | { |
420 | 414 | $moveNodeLeftBegin = $node->left; |
421 | 415 | $moveNodeLeftEnd = $node->right - 1; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $response = ''; |
35 | 35 | |
36 | - if( ( $curl = curl_init() )=== false ) { |
|
36 | + if( ( $curl = curl_init() ) === false ) { |
|
37 | 37 | throw new \Aimeos\MW\Communication\Exception( 'Could not initialize curl' ); |
38 | 38 | } |
39 | 39 | |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, strtoupper( $method ) ); |
45 | 45 | curl_setopt( $curl, CURLOPT_POSTFIELDS, $payload ); |
46 | 46 | curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 25 ); |
47 | - curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); // return data as string |
|
47 | + curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); // return data as string |
|
48 | 48 | |
49 | 49 | curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, true ); |
50 | 50 | |
51 | - if ( ( $response = curl_exec( $curl ) ) === false ) { |
|
51 | + if( ( $response = curl_exec( $curl ) ) === false ) { |
|
52 | 52 | throw new \Aimeos\MW\Communication\Exception( sprintf( 'Sending order failed: "%1$s"', curl_error( $curl ) ) ); |
53 | 53 | } |
54 | 54 | |
55 | - if ( curl_errno($curl) ) { |
|
56 | - throw new \Aimeos\MW\Communication\Exception( sprintf( 'Error with nr."%1$s" - "%2$s"', curl_errno($curl), curl_error($curl) ) ); |
|
55 | + if( curl_errno( $curl ) ) { |
|
56 | + throw new \Aimeos\MW\Communication\Exception( sprintf( 'Error with nr."%1$s" - "%2$s"', curl_errno( $curl ), curl_error( $curl ) ) ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | curl_close( $curl ); |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $method = NET_SFTP_STRING; break; |
67 | 67 | } |
68 | 68 | |
69 | - if ( $this->sftp->put( $target, $payload, $method ) === false ) |
|
69 | + if( $this->sftp->put( $target, $payload, $method ) === false ) |
|
70 | 70 | { |
71 | 71 | $msg = sprintf( 'Could not upload payload to "%1$s:%2$s"', $this->config['host'], $target ); |
72 | 72 | throw new \Aimeos\MW\Communication\Exception( $msg ); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return \Aimeos\MW\DB\Statement\Iface \PDO statement object |
43 | 43 | * @throws \Aimeos\MW\DB\Exception if type is invalid or the DBAL object throws an exception |
44 | 44 | */ |
45 | - public function create( $sql, $type = \Aimeos\MW\DB\Connection\Base::TYPE_SIMPLE ) |
|
45 | + public function create( $sql, $type = \Aimeos\MW\DB\Connection\Base::TYPE_SIMPLE ) |
|
46 | 46 | { |
47 | 47 | try |
48 | 48 | { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | throw new \Aimeos\MW\DB\Exception( sprintf( 'Invalid value "%1$d" for statement type', $type ) ); |
57 | 57 | } |
58 | 58 | } |
59 | - catch( \Exception $e) |
|
59 | + catch( \Exception $e ) |
|
60 | 60 | { |
61 | 61 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode() ); |
62 | 62 | } |