@@ -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 | } |
@@ -185,12 +185,10 @@ |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | return 'string'; |
188 | - } |
|
189 | - else if( strpos( $item, '.' ) !== false ) |
|
188 | + } else if( strpos( $item, '.' ) !== false ) |
|
190 | 189 | { |
191 | 190 | return 'float'; |
192 | - } |
|
193 | - else if( ctype_digit( $item ) !== false ) |
|
191 | + } else if( ctype_digit( $item ) !== false ) |
|
194 | 192 | { |
195 | 193 | return 'int'; |
196 | 194 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | protected function createTerm( $name, $type, $value ) |
63 | 63 | { |
64 | 64 | $escaped = $this->escape( $this->getOperator(), $type, $value ); |
65 | - return $name . ' ' . self::$operators[$this->getOperator()] . ' ' . $escaped; |
|
65 | + return $name.' '.self::$operators[$this->getOperator()].' '.$escaped; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | switch( $this->getOperator() ) |
78 | 78 | { |
79 | 79 | case '==': |
80 | - return $name . ' === null'; |
|
80 | + return $name.' === null'; |
|
81 | 81 | case '!=': |
82 | - return $name . ' !== null'; |
|
82 | + return $name.' !== null'; |
|
83 | 83 | default: |
84 | 84 | throw new \Aimeos\MW\Common\Exception( sprintf( 'null value not allowed for operator "%1$s"', $this->getOperator() ) ); |
85 | 85 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | foreach( (array) $this->getValue() as $value ) { |
104 | 104 | $list[] = $this->createTerm( $name, $type, $value ); |
105 | 105 | } |
106 | - return '( ' . implode( ' || ', $list ) . ' )'; |
|
106 | + return '( '.implode( ' || ', $list ).' )'; |
|
107 | 107 | |
108 | 108 | case '!=': |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach( (array) $this->getValue() as $value ) { |
112 | 112 | $list[] = $this->createTerm( $name, $type, $value ); |
113 | 113 | } |
114 | - return '( ' . implode( ' && ', $list ) . ' )'; |
|
114 | + return '( '.implode( ' && ', $list ).' )'; |
|
115 | 115 | |
116 | 116 | default: |
117 | 117 | throw new \Aimeos\MW\Common\Exception( sprintf( 'List Term not allowed for operator "%1$s"', $this->getOperator() ) ); |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | $string = $this->escape( $this->getOperator(), $type, $val ); |
136 | 136 | |
137 | 137 | while( ( $val = next( $values ) ) !== false ) { |
138 | - $string .= ',' . $this->escape( $this->getOperator(), $type, $val ); |
|
138 | + $string .= ','.$this->escape( $this->getOperator(), $type, $val ); |
|
139 | 139 | } |
140 | 140 | |
141 | - return 'array(' . $string . ')'; |
|
141 | + return 'array('.$string.')'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | case 'float': |
164 | 164 | $value = (double) $value; break; |
165 | 165 | default: |
166 | - $value = '\'' . addcslashes( $value, '\'' ) . '\''; |
|
166 | + $value = '\''.addcslashes( $value, '\'' ).'\''; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return $value; |
@@ -189,12 +189,10 @@ |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | return \Aimeos\MW\DB\Statement\Base::PARAM_STR; |
192 | - } |
|
193 | - else if( strpos( $item, '.' ) !== false ) |
|
192 | + } else if( strpos( $item, '.' ) !== false ) |
|
194 | 193 | { |
195 | 194 | return \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT; |
196 | - } |
|
197 | - else if( ctype_digit( $item ) !== false ) |
|
195 | + } else if( ctype_digit( $item ) !== false ) |
|
198 | 196 | { |
199 | 197 | return \Aimeos\MW\DB\Statement\Base::PARAM_INT; |
200 | 198 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function createTerm( $name, $type, $value ) |
66 | 66 | { |
67 | - $term = $name . ' ' . self::$operators[$this->getOperator()] . ' ' . $this->escape( $this->getOperator(), $type, $value ); |
|
67 | + $term = $name.' '.self::$operators[$this->getOperator()].' '.$this->escape( $this->getOperator(), $type, $value ); |
|
68 | 68 | |
69 | 69 | if( in_array( $this->getOperator(), array( '=~', '~=' ), true ) ) { |
70 | 70 | $term .= ' ESCAPE \'#\''; |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | switch( $this->getOperator() ) |
86 | 86 | { |
87 | 87 | case '==': |
88 | - return $name . ' IS NULL'; |
|
88 | + return $name.' IS NULL'; |
|
89 | 89 | case '!=': |
90 | - return $name . ' IS NOT NULL'; |
|
90 | + return $name.' IS NOT NULL'; |
|
91 | 91 | default: |
92 | 92 | throw new \Aimeos\MW\Common\Exception( sprintf( 'NULL value not allowed for operator "%1$s"', $this->getOperator() ) ); |
93 | 93 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | switch( $this->getOperator() ) |
107 | 107 | { |
108 | 108 | case '==': |
109 | - return $name . ' IN ' . $this->createValueList( $type, (array) $this->getValue() ); |
|
109 | + return $name.' IN '.$this->createValueList( $type, (array) $this->getValue() ); |
|
110 | 110 | case '!=': |
111 | - return $name . ' NOT IN ' . $this->createValueList( $type, (array) $this->getValue() ); |
|
111 | + return $name.' NOT IN '.$this->createValueList( $type, (array) $this->getValue() ); |
|
112 | 112 | default: |
113 | 113 | $terms = []; |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $terms[] = $this->createTerm( $name, $type, $val ); |
117 | 117 | } |
118 | 118 | |
119 | - return '(' . implode( ' OR ', $terms ) . ')'; |
|
119 | + return '('.implode( ' OR ', $terms ).')'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $values[$key] = $this->escape( $operator, $type, $value ); |
141 | 141 | } |
142 | 142 | |
143 | - return '(' . implode(',', $values) . ')'; |
|
143 | + return '('.implode( ',', $values ).')'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | if( in_array( $operator, array( '~=', '=~' ), true ) ) |
169 | 169 | { |
170 | 170 | $value = str_replace( array( '%', '_', '[' ), array( '#%', '#_', '#[' ), $this->conn->escape( $value ) ); |
171 | - $value = '\'%' . $value . '%\''; break; |
|
171 | + $value = '\'%'.$value.'%\''; break; |
|
172 | 172 | } |
173 | 173 | default: |
174 | - $value = '\'' . $this->conn->escape( $value ) . '\''; |
|
174 | + $value = '\''.$this->conn->escape( $value ).'\''; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $value; |
@@ -143,12 +143,10 @@ |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | return '(string)'; |
146 | - } |
|
147 | - else if( strpos( $item, '.' ) !== false ) |
|
146 | + } else if( strpos( $item, '.' ) !== false ) |
|
148 | 147 | { |
149 | 148 | return '(float)'; |
150 | - } |
|
151 | - else if( ctype_digit( $item ) !== false ) |
|
149 | + } else if( ctype_digit( $item ) !== false ) |
|
152 | 150 | { |
153 | 151 | return '(int)'; |
154 | 152 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid name "%1$s"', $name ) ); |
100 | 100 | } |
101 | 101 | |
102 | - return self::$operators[$this->operator] . '(' . $transname . ');'; |
|
102 | + return self::$operators[$this->operator].'('.$transname.');'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | public function testException1() |
83 | 83 | { |
84 | - $this->setExpectedException('\\Aimeos\\MW\\Common\\Exception'); |
|
84 | + $this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' ); |
|
85 | 85 | new \Aimeos\MW\Criteria\Expression\Sort\PHP( '/', 'test(1,2)' ); |
86 | 86 | } |
87 | 87 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $object = new \Aimeos\MW\Criteria\Expression\Sort\PHP( '+', 'wrongType' ); |
100 | 100 | |
101 | - $this->setExpectedException('\\Aimeos\\MW\\Common\\Exception'); |
|
101 | + $this->setExpectedException( '\\Aimeos\\MW\\Common\\Exception' ); |
|
102 | 102 | $object->toString( $types, $translations ); |
103 | 103 | } |
104 | 104 |
@@ -65,15 +65,13 @@ |
||
65 | 65 | { |
66 | 66 | $options[$name] = (array) $options[$name]; |
67 | 67 | $options[$name][] = substr( $option, $pos + 1 ); |
68 | - } |
|
69 | - else |
|
68 | + } else |
|
70 | 69 | { |
71 | 70 | $options[$name] = substr( $option, $pos + 1 ); |
72 | 71 | } |
73 | 72 | |
74 | 73 | unset( $params[$key] ); |
75 | - } |
|
76 | - else |
|
74 | + } else |
|
77 | 75 | { |
78 | 76 | printf( "Invalid option \"%1\$s\"\n", $option ); |
79 | 77 | usage(); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
149 | 149 | unset( $dbconfig[$rname] ); |
150 | 150 | } else { |
151 | - $conf->set( 'resource/' . $rname . '/limit', 2 ); |
|
151 | + $conf->set( 'resource/'.$rname.'/limit', 2 ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | |
189 | - require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
189 | + require 'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
190 | 190 | |
191 | 191 | $aimeos = new \Aimeos\Bootstrap( ( isset( $options['extdir'] ) ? (array) $options['extdir'] : array() ) ); |
192 | 192 | $taskPaths = $aimeos->getSetupPaths( $tplsite ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'required' => false, |
39 | 39 | ); |
40 | 40 | |
41 | - $this->object = new \Aimeos\MW\Criteria\Attribute\Standard($values); |
|
41 | + $this->object = new \Aimeos\MW\Criteria\Attribute\Standard( $values ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -54,48 +54,48 @@ discard block |
||
54 | 54 | |
55 | 55 | public function testGetType() |
56 | 56 | { |
57 | - $this->assertEquals('attribute_type', $this->object->getType()); |
|
57 | + $this->assertEquals( 'attribute_type', $this->object->getType() ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | public function testGetInternalType() |
62 | 62 | { |
63 | - $this->assertEquals('internaltype', $this->object->getInternalType()); |
|
63 | + $this->assertEquals( 'internaltype', $this->object->getInternalType() ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | public function testGetCode() |
67 | 67 | { |
68 | - $this->assertEquals('attribute_code', $this->object->getCode()); |
|
68 | + $this->assertEquals( 'attribute_code', $this->object->getCode() ); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public function testGetInternalCode() |
72 | 72 | { |
73 | - $this->assertEquals('internalcode', $this->object->getInternalCode()); |
|
73 | + $this->assertEquals( 'internalcode', $this->object->getInternalCode() ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function testGetInternalDeps() |
77 | 77 | { |
78 | - $this->assertEquals(array( 'test' ), $this->object->getInternalDeps()); |
|
78 | + $this->assertEquals( array( 'test' ), $this->object->getInternalDeps() ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function testGetLabel() |
82 | 82 | { |
83 | - $this->assertEquals('labelname', $this->object->getLabel()); |
|
83 | + $this->assertEquals( 'labelname', $this->object->getLabel() ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public function testGetDefault() |
87 | 87 | { |
88 | - $this->assertEquals('default value', $this->object->getDefault()); |
|
88 | + $this->assertEquals( 'default value', $this->object->getDefault() ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function testIsPublic() |
92 | 92 | { |
93 | - $this->assertEquals(false, $this->object->isPublic()); |
|
93 | + $this->assertEquals( false, $this->object->isPublic() ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public function testIsRequired() |
97 | 97 | { |
98 | - $this->assertEquals(false, $this->object->isRequired()); |
|
98 | + $this->assertEquals( false, $this->object->isRequired() ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function testToArray() |
@@ -109,6 +109,6 @@ discard block |
||
109 | 109 | 'required' => false, |
110 | 110 | ); |
111 | 111 | |
112 | - $this->assertEquals($expected, $this->object->toArray()); |
|
112 | + $this->assertEquals( $expected, $this->object->toArray() ); |
|
113 | 113 | } |
114 | 114 | } |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | 'bool' => 't.bool', |
98 | 98 | ); |
99 | 99 | |
100 | - $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'list', array('a', 'b', 'c') ); |
|
100 | + $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'list', array( 'a', 'b', 'c' ) ); |
|
101 | 101 | $this->assertEquals( "t.list IN ('a','b','c')", $expr->toString( $types, $translations ) ); |
102 | 102 | |
103 | - $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'list', array('a', 'b', 'c') ); |
|
103 | + $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'list', array( 'a', 'b', 'c' ) ); |
|
104 | 104 | $this->assertEquals( "t.list NOT IN ('a','b','c')", $expr->toString( $types, $translations ) ); |
105 | 105 | |
106 | 106 | $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '~=', 'string', 'value' ); |
@@ -109,19 +109,19 @@ discard block |
||
109 | 109 | $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '<', 'float', 0.1 ); |
110 | 110 | $this->assertEquals( "t.float < 0.1", $expr->toString( $types, $translations ) ); |
111 | 111 | |
112 | - $expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '>', 'int', 10 ); |
|
112 | + $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '>', 'int', 10 ); |
|
113 | 113 | $this->assertEquals( "t.int > 10", $expr->toString( $types, $translations ) ); |
114 | 114 | |
115 | - $expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'undefined', null ); |
|
115 | + $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '!=', 'undefined', null ); |
|
116 | 116 | $this->assertEquals( "t.undefined IS NOT NULL", $expr->toString( $types, $translations ) ); |
117 | 117 | |
118 | - $expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'bool', true ); |
|
118 | + $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '==', 'bool', true ); |
|
119 | 119 | $this->assertEquals( "t.bool = 1", $expr->toString( $types, $translations ) ); |
120 | 120 | |
121 | - $expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '&', 'int', 0x2 ); |
|
121 | + $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '&', 'int', 0x2 ); |
|
122 | 122 | $this->assertEquals( "t.int & 2", $expr->toString( $types, $translations ) ); |
123 | 123 | |
124 | - $expr= new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '|', 'int', 0x4 ); |
|
124 | + $expr = new \Aimeos\MW\Criteria\Expression\Compare\SQL( $this->conn, '|', 'int', 0x4 ); |
|
125 | 125 | $this->assertEquals( "t.int | 4", $expr->toString( $types, $translations ) ); |
126 | 126 | } |
127 | 127 |