Completed
Push — master ( 6f5720...a297dc )
by Nikolay
07:30
created
services/NorthWind/NorthWindDSExpressionProvider.php 1 patch
Switch Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
     public function onLogicalExpression($expressionType, $left, $right)
90 90
     {
91 91
         switch($expressionType) {
92
-        case ExpressionType::AND_LOGICAL:
93
-            return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
94
-            break;
95
-        case ExpressionType::OR_LOGICAL:
96
-            return $this->_prepareBinaryExpression(self::LOGICAL_OR, $left, $right);
97
-            break;
98
-        default:
99
-            throw new \InvalidArgumentException('onLogicalExpression');
92
+            case ExpressionType::AND_LOGICAL:
93
+                return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
94
+                break;
95
+            case ExpressionType::OR_LOGICAL:
96
+                return $this->_prepareBinaryExpression(self::LOGICAL_OR, $left, $right);
97
+                break;
98
+            default:
99
+                throw new \InvalidArgumentException('onLogicalExpression');
100 100
         }
101 101
     }
102 102
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
     public function onArithmeticExpression($expressionType, $left, $right)
113 113
     {
114 114
         switch($expressionType) {
115
-        case ExpressionType::MULTIPLY:
116
-            return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
117
-            break;
118
-        case ExpressionType::DIVIDE:
119
-            return $this->_prepareBinaryExpression(self::DIVIDE, $left, $right);
120
-            break;
121
-        case ExpressionType::MODULO:
122
-            return $this->_prepareBinaryExpression(self::MODULO, $left, $right);
123
-            break;
124
-        case ExpressionType::ADD:
125
-            return $this->_prepareBinaryExpression(self::ADD, $left, $right);
126
-            break;
127
-        case ExpressionType::SUBTRACT:
128
-            return $this->_prepareBinaryExpression(self::SUBTRACT, $left, $right);
129
-            break;
130
-        default:
131
-            throw new \InvalidArgumentException('onArithmeticExpression');
115
+            case ExpressionType::MULTIPLY:
116
+                return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
117
+                break;
118
+            case ExpressionType::DIVIDE:
119
+                return $this->_prepareBinaryExpression(self::DIVIDE, $left, $right);
120
+                break;
121
+            case ExpressionType::MODULO:
122
+                return $this->_prepareBinaryExpression(self::MODULO, $left, $right);
123
+                break;
124
+            case ExpressionType::ADD:
125
+                return $this->_prepareBinaryExpression(self::ADD, $left, $right);
126
+                break;
127
+            case ExpressionType::SUBTRACT:
128
+                return $this->_prepareBinaryExpression(self::SUBTRACT, $left, $right);
129
+                break;
130
+            default:
131
+                throw new \InvalidArgumentException('onArithmeticExpression');
132 132
         }
133 133
     }
134 134
 
@@ -144,30 +144,30 @@  discard block
 block discarded – undo
144 144
     public function onRelationalExpression($expressionType, $left, $right)
145 145
     {
146 146
         switch($expressionType) {
147
-        case ExpressionType::GREATERTHAN:
148
-            return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
149
-            break;
150
-        case ExpressionType::GREATERTHAN_OR_EQUAL:
151
-            return $this->_prepareBinaryExpression(
152
-                self::GREATERTHAN_OR_EQUAL, $left, $right
153
-            );
154
-            break;
155
-        case ExpressionType::LESSTHAN:
156
-            return $this->_prepareBinaryExpression(self::LESSTHAN, $left, $right);
157
-            break;
158
-        case ExpressionType::LESSTHAN_OR_EQUAL:
159
-            return $this->_prepareBinaryExpression(
160
-                self::LESSTHAN_OR_EQUAL, $left, $right
161
-            );
162
-            break;
163
-        case ExpressionType::EQUAL:
164
-            return $this->_prepareBinaryExpression(self::EQUAL, $left, $right);
165
-            break;
166
-        case ExpressionType::NOTEQUAL:
167
-            return $this->_prepareBinaryExpression(self::NOTEQUAL, $left, $right);
168
-            break;
169
-        default:
170
-            throw new \InvalidArgumentException('onArithmeticExpression');
147
+            case ExpressionType::GREATERTHAN:
148
+                return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
149
+                break;
150
+            case ExpressionType::GREATERTHAN_OR_EQUAL:
151
+                return $this->_prepareBinaryExpression(
152
+                    self::GREATERTHAN_OR_EQUAL, $left, $right
153
+                );
154
+                break;
155
+            case ExpressionType::LESSTHAN:
156
+                return $this->_prepareBinaryExpression(self::LESSTHAN, $left, $right);
157
+                break;
158
+            case ExpressionType::LESSTHAN_OR_EQUAL:
159
+                return $this->_prepareBinaryExpression(
160
+                    self::LESSTHAN_OR_EQUAL, $left, $right
161
+                );
162
+                break;
163
+            case ExpressionType::EQUAL:
164
+                return $this->_prepareBinaryExpression(self::EQUAL, $left, $right);
165
+                break;
166
+            case ExpressionType::NOTEQUAL:
167
+                return $this->_prepareBinaryExpression(self::NOTEQUAL, $left, $right);
168
+                break;
169
+            default:
170
+                throw new \InvalidArgumentException('onArithmeticExpression');
171 171
         }
172 172
     }
173 173
 
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
     public function onUnaryExpression($expressionType, $child)
183 183
     {
184 184
         switch($expressionType) {
185
-        case ExpressionType::NEGATE:
186
-            return $this->_prepareUnaryExpression(self::NEGATE, $child);
187
-            break;
188
-        case ExpressionType::NOT_LOGICAL:
189
-            return $this->_prepareUnaryExpression(self::LOGICAL_NOT, $child);
190
-            break;
191
-        default:
192
-            throw new \InvalidArgumentException('onUnaryExpression');
185
+            case ExpressionType::NEGATE:
186
+                return $this->_prepareUnaryExpression(self::NEGATE, $child);
187
+                break;
188
+            case ExpressionType::NOT_LOGICAL:
189
+                return $this->_prepareUnaryExpression(self::LOGICAL_NOT, $child);
190
+                break;
191
+            default:
192
+                throw new \InvalidArgumentException('onUnaryExpression');
193 193
         }
194 194
     }
195 195
 
@@ -298,103 +298,103 @@  discard block
 block discarded – undo
298 298
     public function onFunctionCallExpression($functionDescription, $params)
299 299
     {
300 300
         switch($functionDescription->functionName) {
301
-        case ODataConstants::STRFUN_COMPARE:
302
-            return "STRCMP($params[0]; $params[1])";
303
-            break;
304
-        case ODataConstants::STRFUN_ENDSWITH:
305
-          return "(($params[1]) = RIGHT(($params[0]), LEN($params[1])))";
306
-            break;
307
-        case ODataConstants::STRFUN_INDEXOF:
308
-          // In SQLServer the index of string starts from 1, but in OData
309
-          // the string start with index 0, so the below subtraction of 1
310
-          return "(CHARINDEX($params[1], $params[0]) - 1)";
311
-            break;
312
-        case ODataConstants::STRFUN_REPLACE:
313
-          return "REPLACE($params[0], $params[1], $params[2])";
314
-            break;
315
-        case ODataConstants::STRFUN_STARTSWITH:
316
-          return "(($params[1]) = LEFT(($params[0]), LEN($params[1])))";
317
-            break;
318
-        case ODataConstants::STRFUN_TOLOWER:
319
-          return "LOWER($params[0])";
320
-            break;
321
-        case ODataConstants::STRFUN_TOUPPER:
322
-          return "UPPER($params[0])";
323
-            break;
324
-        case ODataConstants::STRFUN_TRIM:
325
-          // OData supports trim function
326
-          // We don't have the same function SQL Server, so use SQL functions LTRIM and RTRIM together
327
-          // to achieve TRIM functionality.
328
-          return "RTRIM(LTRIM($params[0]))";
329
-            break;
330
-        case ODataConstants::STRFUN_SUBSTRING:
331
-          if (count($params) == 3) {
332
-            // 3 Param version of OData substring
333
-              return "SUBSTRING($params[0], $params[1] + 1, $params[2])";
334
-          } else {
335
-            // 2 Params version of OData substring
336
-            // We don't have the same function for SQL Server, we have only:
337
-            //
338
-            // SUBSTRING ( value_expression , start_expression , length_expression )
339
-            // http://msdn.microsoft.com/en-us/library/ms187748.aspx
340
-            //
341
-            // If the sum of start_expression and length_expression is greater than the number of characters 
342
-            // in value_expression, the whole value expression beginning at start_expression is returned
343
-            // In OData substring function the index start from 0, in SQL Server its from 1
344
-            return "SUBSTRING($params[0], $params[1] + 1, LEN($params[0]))";        	    
345
-          }
346
-            break;
347
-        case ODataConstants::STRFUN_SUBSTRINGOF:
348
-          return "(CHARINDEX($params[0], $params[1]) != 0)";
349
-            break;
350
-        case ODataConstants::STRFUN_CONCAT:
351
-            return "$params[0] + $params[1]";
352
-            break;
353
-        case ODataConstants::STRFUN_LENGTH:
354
-            return "LEN($params[0])";
355
-            break;
356
-        case ODataConstants::GUIDFUN_EQUAL:
357
-            return "($params[0] = $params[1])";
358
-            break;
359
-        case ODataConstants::DATETIME_COMPARE:
360
-            return "DATETIMECMP($params[0]; $params[1])";
361
-            break;
362
-        case ODataConstants::DATETIME_YEAR:
363
-            return "YEAR($params[0])";
364
-            break;
365
-        case ODataConstants::DATETIME_MONTH:
366
-            return "MONTH($params[0])";
367
-            break;
368
-        case ODataConstants::DATETIME_DAY:
369
-            return "DAY($params[0])";
370
-            break;
371
-        case ODataConstants::DATETIME_HOUR:
372
-            return "DATENAME(HOUR, $params[0])";
373
-            break;
374
-        case ODataConstants::DATETIME_MINUTE:
375
-            return "DATENAME(MINUTE, $params[0])";
376
-            break;
377
-        case ODataConstants::DATETIME_SECOND:
378
-            return "DATENAME(SECOND, $params[0])";
379
-            break;                
380
-        case ODataConstants::MATHFUN_ROUND:
381
-            return "ROUND($params[0], $this->_default_round)";
382
-            break;
383
-        case ODataConstants::MATHFUN_CEILING:
384
-            return "CEILING($params[0])";
385
-            break;
386
-        case ODataConstants::MATHFUN_FLOOR:
387
-            return "FLOOR($params[0])";
388
-            break;
389
-        case ODataConstants::BINFUL_EQUAL:
390
-            return "($params[0] = $params[1])";
391
-            break;
301
+            case ODataConstants::STRFUN_COMPARE:
302
+                return "STRCMP($params[0]; $params[1])";
303
+                break;
304
+            case ODataConstants::STRFUN_ENDSWITH:
305
+              return "(($params[1]) = RIGHT(($params[0]), LEN($params[1])))";
306
+                break;
307
+            case ODataConstants::STRFUN_INDEXOF:
308
+              // In SQLServer the index of string starts from 1, but in OData
309
+              // the string start with index 0, so the below subtraction of 1
310
+              return "(CHARINDEX($params[1], $params[0]) - 1)";
311
+                break;
312
+            case ODataConstants::STRFUN_REPLACE:
313
+              return "REPLACE($params[0], $params[1], $params[2])";
314
+                break;
315
+            case ODataConstants::STRFUN_STARTSWITH:
316
+              return "(($params[1]) = LEFT(($params[0]), LEN($params[1])))";
317
+                break;
318
+            case ODataConstants::STRFUN_TOLOWER:
319
+              return "LOWER($params[0])";
320
+                break;
321
+            case ODataConstants::STRFUN_TOUPPER:
322
+              return "UPPER($params[0])";
323
+                break;
324
+            case ODataConstants::STRFUN_TRIM:
325
+              // OData supports trim function
326
+              // We don't have the same function SQL Server, so use SQL functions LTRIM and RTRIM together
327
+              // to achieve TRIM functionality.
328
+              return "RTRIM(LTRIM($params[0]))";
329
+                break;
330
+            case ODataConstants::STRFUN_SUBSTRING:
331
+              if (count($params) == 3) {
332
+                // 3 Param version of OData substring
333
+                  return "SUBSTRING($params[0], $params[1] + 1, $params[2])";
334
+              } else {
335
+                // 2 Params version of OData substring
336
+                // We don't have the same function for SQL Server, we have only:
337
+                //
338
+                // SUBSTRING ( value_expression , start_expression , length_expression )
339
+                // http://msdn.microsoft.com/en-us/library/ms187748.aspx
340
+                //
341
+                // If the sum of start_expression and length_expression is greater than the number of characters 
342
+                // in value_expression, the whole value expression beginning at start_expression is returned
343
+                // In OData substring function the index start from 0, in SQL Server its from 1
344
+                return "SUBSTRING($params[0], $params[1] + 1, LEN($params[0]))";        	    
345
+              }
346
+                break;
347
+            case ODataConstants::STRFUN_SUBSTRINGOF:
348
+              return "(CHARINDEX($params[0], $params[1]) != 0)";
349
+                break;
350
+            case ODataConstants::STRFUN_CONCAT:
351
+                return "$params[0] + $params[1]";
352
+                break;
353
+            case ODataConstants::STRFUN_LENGTH:
354
+                return "LEN($params[0])";
355
+                break;
356
+            case ODataConstants::GUIDFUN_EQUAL:
357
+                return "($params[0] = $params[1])";
358
+                break;
359
+            case ODataConstants::DATETIME_COMPARE:
360
+                return "DATETIMECMP($params[0]; $params[1])";
361
+                break;
362
+            case ODataConstants::DATETIME_YEAR:
363
+                return "YEAR($params[0])";
364
+                break;
365
+            case ODataConstants::DATETIME_MONTH:
366
+                return "MONTH($params[0])";
367
+                break;
368
+            case ODataConstants::DATETIME_DAY:
369
+                return "DAY($params[0])";
370
+                break;
371
+            case ODataConstants::DATETIME_HOUR:
372
+                return "DATENAME(HOUR, $params[0])";
373
+                break;
374
+            case ODataConstants::DATETIME_MINUTE:
375
+                return "DATENAME(MINUTE, $params[0])";
376
+                break;
377
+            case ODataConstants::DATETIME_SECOND:
378
+                return "DATENAME(SECOND, $params[0])";
379
+                break;                
380
+            case ODataConstants::MATHFUN_ROUND:
381
+                return "ROUND($params[0], $this->_default_round)";
382
+                break;
383
+            case ODataConstants::MATHFUN_CEILING:
384
+                return "CEILING($params[0])";
385
+                break;
386
+            case ODataConstants::MATHFUN_FLOOR:
387
+                return "FLOOR($params[0])";
388
+                break;
389
+            case ODataConstants::BINFUL_EQUAL:
390
+                return "($params[0] = $params[1])";
391
+                break;
392 392
          case 'is_null':
393 393
             return "is_null($params[0])";
394 394
             break;
395 395
 
396
-        default:
397
-            throw new \InvalidArgumentException('onFunctionCallExpression');
396
+            default:
397
+                throw new \InvalidArgumentException('onFunctionCallExpression');
398 398
         }
399 399
     }
400 400
 
Please login to merge, or discard this patch.
services/NorthWind/NorthWindQueryProvider.php 1 patch
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
         }
119 119
         $returnResult = array();
120 120
         switch ($resourceSetName) {
121
-        case 'Customers':
122
-            $returnResult = $this->_serializeCustomers($stmt);
123
-            break;
124
-        case 'Orders':
125
-            $returnResult = $this->_serializeOrders($stmt);
126
-            break;
127
-        case 'Order Details':
128
-            $returnResult = $this->_serializeOrderDetails($stmt);
129
-            break;
130
-        case 'Employees':
131
-            $returnResult = $this->_serializeEmployees($stmt);
132
-            break;
121
+            case 'Customers':
122
+                $returnResult = $this->_serializeCustomers($stmt);
123
+                break;
124
+            case 'Orders':
125
+                $returnResult = $this->_serializeOrders($stmt);
126
+                break;
127
+            case 'Order Details':
128
+                $returnResult = $this->_serializeOrderDetails($stmt);
129
+                break;
130
+            case 'Employees':
131
+                $returnResult = $this->_serializeEmployees($stmt);
132
+                break;
133 133
         }
134 134
         sqlsrv_free_stmt($stmt);
135 135
         return $returnResult;
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
         $result = null;
184 184
         while ( $record = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
185 185
             switch ($resourceSetName) {
186
-            case 'Customers':
187
-                $result = $this->_serializeCustomer($record);
188
-                break;
189
-            case 'Orders':                    
190
-                $result = $this->_serializeOrder($record);
191
-                break;
192
-            case 'Order Details':                    
193
-                $result = $this->_serializeOrderDetail($record);
194
-                break;
195
-            case 'Employees':
196
-                $result = $this->_serializeEmployee($record);
197
-                break;
186
+                case 'Customers':
187
+                    $result = $this->_serializeCustomer($record);
188
+                    break;
189
+                case 'Orders':                    
190
+                    $result = $this->_serializeOrder($record);
191
+                    break;
192
+                case 'Order Details':                    
193
+                    $result = $this->_serializeOrderDetail($record);
194
+                    break;
195
+                case 'Employees':
196
+                    $result = $this->_serializeEmployee($record);
197
+                    break;
198 198
             }
199 199
         }
200 200
         sqlsrv_free_stmt($stmt);
Please login to merge, or discard this patch.
services/WordPress/WordPressDSExpressionProvider.php 1 patch
Switch Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
     public function onLogicalExpression($expressionType, $left, $right)
86 86
     {
87 87
         switch($expressionType) {
88
-        case ExpressionType::AND_LOGICAL:
89
-            return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
90
-            break;
91
-        case ExpressionType::OR_LOGICAL:
92
-            return $this->_prepareBinaryExpression(self::LOGICAL_OR, $left, $right);
93
-            break;
94
-        default:
95
-            throw new \InvalidArgumentException('onLogicalExpression');
88
+            case ExpressionType::AND_LOGICAL:
89
+                return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
90
+                break;
91
+            case ExpressionType::OR_LOGICAL:
92
+                return $this->_prepareBinaryExpression(self::LOGICAL_OR, $left, $right);
93
+                break;
94
+            default:
95
+                throw new \InvalidArgumentException('onLogicalExpression');
96 96
         }
97 97
     }
98 98
 
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
     public function onArithmeticExpression($expressionType, $left, $right)
109 109
     {
110 110
         switch($expressionType) {
111
-        case ExpressionType::MULTIPLY:
112
-            return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
113
-            break;
114
-        case ExpressionType::DIVIDE:
115
-            return $this->_prepareBinaryExpression(self::DIVIDE, $left, $right);
116
-            break;
117
-        case ExpressionType::MODULO:
118
-            return $this->_prepareBinaryExpression(self::MODULO, $left, $right);
119
-            break;
120
-        case ExpressionType::ADD:
121
-            return $this->_prepareBinaryExpression(self::ADD, $left, $right);
122
-            break;
123
-        case ExpressionType::SUBTRACT:
124
-            return $this->_prepareBinaryExpression(self::SUBTRACT, $left, $right);
125
-            break;
126
-        default:
127
-            throw new \InvalidArgumentException('onArithmeticExpression');
111
+            case ExpressionType::MULTIPLY:
112
+                return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
113
+                break;
114
+            case ExpressionType::DIVIDE:
115
+                return $this->_prepareBinaryExpression(self::DIVIDE, $left, $right);
116
+                break;
117
+            case ExpressionType::MODULO:
118
+                return $this->_prepareBinaryExpression(self::MODULO, $left, $right);
119
+                break;
120
+            case ExpressionType::ADD:
121
+                return $this->_prepareBinaryExpression(self::ADD, $left, $right);
122
+                break;
123
+            case ExpressionType::SUBTRACT:
124
+                return $this->_prepareBinaryExpression(self::SUBTRACT, $left, $right);
125
+                break;
126
+            default:
127
+                throw new \InvalidArgumentException('onArithmeticExpression');
128 128
         }
129 129
     }
130 130
 
@@ -140,30 +140,30 @@  discard block
 block discarded – undo
140 140
     public function onRelationalExpression($expressionType, $left, $right)
141 141
     {
142 142
         switch($expressionType) {
143
-        case ExpressionType::GREATERTHAN:
144
-            return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
145
-            break;
146
-        case ExpressionType::GREATERTHAN_OR_EQUAL:
147
-            return $this->_prepareBinaryExpression(
148
-                self::GREATERTHAN_OR_EQUAL, $left, $right
149
-            );
150
-            break;
151
-        case ExpressionType::LESSTHAN:
152
-            return $this->_prepareBinaryExpression(self::LESSTHAN, $left, $right);
153
-            break;
154
-        case ExpressionType::LESSTHAN_OR_EQUAL:
155
-            return $this->_prepareBinaryExpression(
156
-                self::LESSTHAN_OR_EQUAL, $left, $right
157
-            );
158
-            break;
159
-        case ExpressionType::EQUAL:
160
-            return $this->_prepareBinaryExpression(self::EQUAL, $left, $right);
161
-            break;
162
-        case ExpressionType::NOTEQUAL:
163
-            return $this->_prepareBinaryExpression(self::NOTEQUAL, $left, $right);
164
-            break;
165
-        default:
166
-            throw new \InvalidArgumentException('onArithmeticExpression');
143
+            case ExpressionType::GREATERTHAN:
144
+                return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
145
+                break;
146
+            case ExpressionType::GREATERTHAN_OR_EQUAL:
147
+                return $this->_prepareBinaryExpression(
148
+                    self::GREATERTHAN_OR_EQUAL, $left, $right
149
+                );
150
+                break;
151
+            case ExpressionType::LESSTHAN:
152
+                return $this->_prepareBinaryExpression(self::LESSTHAN, $left, $right);
153
+                break;
154
+            case ExpressionType::LESSTHAN_OR_EQUAL:
155
+                return $this->_prepareBinaryExpression(
156
+                    self::LESSTHAN_OR_EQUAL, $left, $right
157
+                );
158
+                break;
159
+            case ExpressionType::EQUAL:
160
+                return $this->_prepareBinaryExpression(self::EQUAL, $left, $right);
161
+                break;
162
+            case ExpressionType::NOTEQUAL:
163
+                return $this->_prepareBinaryExpression(self::NOTEQUAL, $left, $right);
164
+                break;
165
+            default:
166
+                throw new \InvalidArgumentException('onArithmeticExpression');
167 167
         }
168 168
     }
169 169
 
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
     public function onUnaryExpression($expressionType, $child)
179 179
     {
180 180
         switch($expressionType) {
181
-        case ExpressionType::NEGATE:
182
-            return $this->_prepareUnaryExpression(self::NEGATE, $child);
183
-            break;
184
-        case ExpressionType::NOT_LOGICAL:
185
-            return $this->_prepareUnaryExpression(self::LOGICAL_NOT, $child);
186
-            break;
187
-        default:
188
-            throw new \InvalidArgumentException('onUnaryExpression');
181
+            case ExpressionType::NEGATE:
182
+                return $this->_prepareUnaryExpression(self::NEGATE, $child);
183
+                break;
184
+            case ExpressionType::NOT_LOGICAL:
185
+                return $this->_prepareUnaryExpression(self::LOGICAL_NOT, $child);
186
+                break;
187
+            default:
188
+                throw new \InvalidArgumentException('onUnaryExpression');
189 189
         }
190 190
     }
191 191
 
@@ -244,86 +244,86 @@  discard block
 block discarded – undo
244 244
     public function onFunctionCallExpression($functionDescription, $params)
245 245
     {
246 246
         switch($functionDescription->functionName) {
247
-        case ODataConstants::STRFUN_COMPARE:
248
-            return "STRCMP($params[0], $params[1])";
249
-            break;
250
-        case ODataConstants::STRFUN_ENDSWITH:
251
-          return "(STRCMP($params[1],RIGHT($params[0],LENGTH($params[1]))) = 0)";
252
-            break;
253
-        case ODataConstants::STRFUN_INDEXOF:
254
-            return "INSTR($params[0], $params[1]) - 1";
255
-            break;
256
-        case ODataConstants::STRFUN_REPLACE:
257
-          return "REPLACE($params[0],$params[1],$params[2])";
258
-            break;
259
-        case ODataConstants::STRFUN_STARTSWITH:
260
-          return "(STRCMP($params[1],LEFT($params[0],LENGTH($params[1]))) = 0)";
261
-            break; 
262
-        case ODataConstants::STRFUN_TOLOWER:
263
-          return "LOWER($params[0])";
264
-            break;
265
-        case ODataConstants::STRFUN_TOUPPER:
266
-          return "UPPER($params[0])";
267
-            break;
268
-        case ODataConstants::STRFUN_TRIM:
269
-          return "TRIM($params[0])";
270
-            break;
271
-        case ODataConstants::STRFUN_SUBSTRING:
272
-            return count($params) == 3 ?
273
-                "SUBSTRING($params[0], $params[1] + 1, $params[2])" :
274
-                "SUBSTRING($params[0], $params[1] + 1)";
275
-            break;
276
-        case ODataConstants::STRFUN_SUBSTRINGOF:
277
-            return "(LOCATE($params[0], $params[1]) > 0)";
278
-            break;
279
-        case ODataConstants::STRFUN_CONCAT:
280
-            return "CONCAT($params[0],$params[1])";
281
-            break;
282
-        case ODataConstants::STRFUN_LENGTH:
283
-            return "LENGTH($params[0])";
284
-            break;
285
-        case ODataConstants::GUIDFUN_EQUAL:
286
-        	return "STRCMP($params[0], $params[1])";
287
-            break;
288
-        case ODataConstants::DATETIME_COMPARE:
289
-            return "DATETIMECMP($params[0]; $params[1])";
290
-            break;
291
-        case ODataConstants::DATETIME_YEAR:
292
-            return "EXTRACT(YEAR from ".$params[0].")";
293
-            break;
294
-        case ODataConstants::DATETIME_MONTH:
295
-            return "EXTRACT(MONTH from ".$params[0].")";
296
-            break;
297
-        case ODataConstants::DATETIME_DAY:
298
-            return "EXTRACT(DAY from ".$params[0].")";
299
-            break;
300
-        case ODataConstants::DATETIME_HOUR:
301
-            return "EXTRACT(HOUR from ".$params[0].")";
302
-            break;
303
-        case ODataConstants::DATETIME_MINUTE:
304
-            return "EXTRACT(MINUTE from ".$params[0].")";
305
-            break;
306
-        case ODataConstants::DATETIME_SECOND:
307
-            return "EXTRACT(SECOND from ".$params[0].")";
308
-            break;                
309
-        case ODataConstants::MATHFUN_ROUND:
310
-            return "ROUND($params[0])";
311
-            break;
312
-        case ODataConstants::MATHFUN_CEILING:
313
-            return "CEIL($params[0])";
314
-            break;
315
-        case ODataConstants::MATHFUN_FLOOR:
316
-            return "FLOOR($params[0])";
317
-            break;
318
-        case ODataConstants::BINFUL_EQUAL:
319
-            return "($params[0] = $params[1])";
320
-            break;
321
-        case 'is_null':
322
-            return "is_null($params[0])";
323
-            break;
247
+            case ODataConstants::STRFUN_COMPARE:
248
+                return "STRCMP($params[0], $params[1])";
249
+                break;
250
+            case ODataConstants::STRFUN_ENDSWITH:
251
+              return "(STRCMP($params[1],RIGHT($params[0],LENGTH($params[1]))) = 0)";
252
+                break;
253
+            case ODataConstants::STRFUN_INDEXOF:
254
+                return "INSTR($params[0], $params[1]) - 1";
255
+                break;
256
+            case ODataConstants::STRFUN_REPLACE:
257
+              return "REPLACE($params[0],$params[1],$params[2])";
258
+                break;
259
+            case ODataConstants::STRFUN_STARTSWITH:
260
+              return "(STRCMP($params[1],LEFT($params[0],LENGTH($params[1]))) = 0)";
261
+                break; 
262
+            case ODataConstants::STRFUN_TOLOWER:
263
+              return "LOWER($params[0])";
264
+                break;
265
+            case ODataConstants::STRFUN_TOUPPER:
266
+              return "UPPER($params[0])";
267
+                break;
268
+            case ODataConstants::STRFUN_TRIM:
269
+              return "TRIM($params[0])";
270
+                break;
271
+            case ODataConstants::STRFUN_SUBSTRING:
272
+                return count($params) == 3 ?
273
+                    "SUBSTRING($params[0], $params[1] + 1, $params[2])" :
274
+                    "SUBSTRING($params[0], $params[1] + 1)";
275
+                break;
276
+            case ODataConstants::STRFUN_SUBSTRINGOF:
277
+                return "(LOCATE($params[0], $params[1]) > 0)";
278
+                break;
279
+            case ODataConstants::STRFUN_CONCAT:
280
+                return "CONCAT($params[0],$params[1])";
281
+                break;
282
+            case ODataConstants::STRFUN_LENGTH:
283
+                return "LENGTH($params[0])";
284
+                break;
285
+            case ODataConstants::GUIDFUN_EQUAL:
286
+        	    return "STRCMP($params[0], $params[1])";
287
+                break;
288
+            case ODataConstants::DATETIME_COMPARE:
289
+                return "DATETIMECMP($params[0]; $params[1])";
290
+                break;
291
+            case ODataConstants::DATETIME_YEAR:
292
+                return "EXTRACT(YEAR from ".$params[0].")";
293
+                break;
294
+            case ODataConstants::DATETIME_MONTH:
295
+                return "EXTRACT(MONTH from ".$params[0].")";
296
+                break;
297
+            case ODataConstants::DATETIME_DAY:
298
+                return "EXTRACT(DAY from ".$params[0].")";
299
+                break;
300
+            case ODataConstants::DATETIME_HOUR:
301
+                return "EXTRACT(HOUR from ".$params[0].")";
302
+                break;
303
+            case ODataConstants::DATETIME_MINUTE:
304
+                return "EXTRACT(MINUTE from ".$params[0].")";
305
+                break;
306
+            case ODataConstants::DATETIME_SECOND:
307
+                return "EXTRACT(SECOND from ".$params[0].")";
308
+                break;                
309
+            case ODataConstants::MATHFUN_ROUND:
310
+                return "ROUND($params[0])";
311
+                break;
312
+            case ODataConstants::MATHFUN_CEILING:
313
+                return "CEIL($params[0])";
314
+                break;
315
+            case ODataConstants::MATHFUN_FLOOR:
316
+                return "FLOOR($params[0])";
317
+                break;
318
+            case ODataConstants::BINFUL_EQUAL:
319
+                return "($params[0] = $params[1])";
320
+                break;
321
+            case 'is_null':
322
+                return "is_null($params[0])";
323
+                break;
324 324
             
325
-        default:
326
-            throw new \InvalidArgumentException('onFunctionCallExpression');
325
+            default:
326
+                throw new \InvalidArgumentException('onFunctionCallExpression');
327 327
         }
328 328
     }
329 329
 
Please login to merge, or discard this patch.
services/WordPress/WordPressQueryProvider.php 1 patch
Switch Indentation   +385 added lines, -385 removed lines patch added patch discarded remove patch
@@ -99,57 +99,57 @@  discard block
 block discarded – undo
99 99
        
100 100
         $returnResult = array();
101 101
         switch ($resourceSetName) {
102
-        case 'Posts':
103
-            $query = "SELECT * FROM `wp_posts` WHERE"
104
-                   ." wp_posts.post_type = 'post'"
105
-                   ." AND wp_posts.post_status = 'publish'";
106
-            if ($filter !== null) {
107
-                $query .= " AND $filter";
108
-            }
109
-            $stmt = mysql_query($query); 
110
-            $returnResult = $this->_serializePosts($stmt);     
111
-            break;                   
112
-        case 'Tags':
113
-            $query = "SELECT t.*, tt.description"
114
-                   ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
115
-                   ." ON tt.term_id = t.term_id"
116
-                   ." WHERE tt.taxonomy = 'post_tag'";
117
-            if ($filter !== null) {
118
-                $query .= " AND $filter";
119
-            }
120
-            $stmt = mysql_query($query);
121
-            $returnResult = $this->_serializeTags($stmt);       
122
-            break;
123
-        case 'Categories':
124
-            $query = "SELECT t.*, tt.description"
125
-                   ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
126
-                   ." ON tt.term_id = t.term_id"
127
-                   ." WHERE tt.taxonomy = 'category'";
128
-            if ($filter !== null) {
129
-                $query .= " AND $filter";
130
-            }
131
-            $stmt = mysql_query($query);
132
-            $returnResult = $this->_serializeCategories($stmt);       
133
-            break;
134
-        case 'Comments':
135
-            $query = "SELECT * FROM `wp_comments` WHERE"
136
-                   ." wp_comments.comment_approved = 1";
137
-            if ($filter !== null) {
138
-                $query .= " AND $filter";
139
-            }
140
-            $stmt = mysql_query($query);
141
-            $returnResult = $this->_serializeComments($stmt);       
142
-            break;
143
-        case 'Users':
144
-            $query = "SELECT * FROM `wp_users`";
145
-            //print "<br>Filter:".$filter;
146
-            if ($filter !== null) {
147
-                $query .= " AND $filter";
148
-            }
149
-            $stmt = mysql_query($query);
150
-            //$data = mysql_fetch_assoc($stmt);
151
-            $returnResult = $this->_serializeUsers($stmt);
152
-            break;
102
+            case 'Posts':
103
+                $query = "SELECT * FROM `wp_posts` WHERE"
104
+                       ." wp_posts.post_type = 'post'"
105
+                       ." AND wp_posts.post_status = 'publish'";
106
+                if ($filter !== null) {
107
+                    $query .= " AND $filter";
108
+                }
109
+                $stmt = mysql_query($query); 
110
+                $returnResult = $this->_serializePosts($stmt);     
111
+                break;                   
112
+            case 'Tags':
113
+                $query = "SELECT t.*, tt.description"
114
+                       ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
115
+                       ." ON tt.term_id = t.term_id"
116
+                       ." WHERE tt.taxonomy = 'post_tag'";
117
+                if ($filter !== null) {
118
+                    $query .= " AND $filter";
119
+                }
120
+                $stmt = mysql_query($query);
121
+                $returnResult = $this->_serializeTags($stmt);       
122
+                break;
123
+            case 'Categories':
124
+                $query = "SELECT t.*, tt.description"
125
+                       ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
126
+                       ." ON tt.term_id = t.term_id"
127
+                       ." WHERE tt.taxonomy = 'category'";
128
+                if ($filter !== null) {
129
+                    $query .= " AND $filter";
130
+                }
131
+                $stmt = mysql_query($query);
132
+                $returnResult = $this->_serializeCategories($stmt);       
133
+                break;
134
+            case 'Comments':
135
+                $query = "SELECT * FROM `wp_comments` WHERE"
136
+                       ." wp_comments.comment_approved = 1";
137
+                if ($filter !== null) {
138
+                    $query .= " AND $filter";
139
+                }
140
+                $stmt = mysql_query($query);
141
+                $returnResult = $this->_serializeComments($stmt);       
142
+                break;
143
+            case 'Users':
144
+                $query = "SELECT * FROM `wp_users`";
145
+                //print "<br>Filter:".$filter;
146
+                if ($filter !== null) {
147
+                    $query .= " AND $filter";
148
+                }
149
+                $stmt = mysql_query($query);
150
+                //$data = mysql_fetch_assoc($stmt);
151
+                $returnResult = $this->_serializeUsers($stmt);
152
+                break;
153 153
         }
154 154
         mysql_free_result($stmt);
155 155
         return $returnResult;
@@ -185,79 +185,79 @@  discard block
 block discarded – undo
185 185
         $conditionStr = implode(' AND ', $keys);
186 186
         
187 187
         switch ($resourceSetName) {
188
-        case 'Posts':
189
-            $query = "SELECT * FROM `wp_posts` WHERE"
190
-                   ." wp_posts.post_type = 'post'"
191
-                   ." AND wp_posts.post_status = 'publish'"
192
-                   ." AND wp_posts.ID = ".$namedKeyValues['PostID'][0];
193
-            $stmt = mysql_query($query);
188
+            case 'Posts':
189
+                $query = "SELECT * FROM `wp_posts` WHERE"
190
+                       ." wp_posts.post_type = 'post'"
191
+                       ." AND wp_posts.post_status = 'publish'"
192
+                       ." AND wp_posts.ID = ".$namedKeyValues['PostID'][0];
193
+                $stmt = mysql_query($query);
194 194
               
195
-            //If resource not found return null to the library
196
-            if (!mysql_num_rows($stmt)) {
197
-                return null;
198
-            } 
195
+                //If resource not found return null to the library
196
+                if (!mysql_num_rows($stmt)) {
197
+                    return null;
198
+                } 
199 199
               
200
-            $data = mysql_fetch_assoc($stmt);
201
-            $result = $this->_serializePost($data);
202
-            break;
203
-        case 'Tags':
204
-            $query = "SELECT t.*, tt.description"
205
-                   ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
206
-                   ." ON tt.term_id = t.term_id"
207
-                   ." WHERE tt.taxonomy = 'post_tag'"
208
-                   ." AND t.term_id = ".$namedKeyValues['TagID'][0];
209
-            $stmt = mysql_query($query);
200
+                $data = mysql_fetch_assoc($stmt);
201
+                $result = $this->_serializePost($data);
202
+                break;
203
+            case 'Tags':
204
+                $query = "SELECT t.*, tt.description"
205
+                       ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
206
+                       ." ON tt.term_id = t.term_id"
207
+                       ." WHERE tt.taxonomy = 'post_tag'"
208
+                       ." AND t.term_id = ".$namedKeyValues['TagID'][0];
209
+                $stmt = mysql_query($query);
210 210
               
211
-            //If resource not found return null to the library
212
-            if (!mysql_num_rows($stmt)) {
213
-                return null;
214
-            }
211
+                //If resource not found return null to the library
212
+                if (!mysql_num_rows($stmt)) {
213
+                    return null;
214
+                }
215 215
               
216
-            $data = mysql_fetch_assoc($stmt);
217
-            $result = $this->_serializeTag($data);
218
-            break;
219
-        case 'Categories':
220
-            $query = "SELECT t.*, tt.description"
221
-                   ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
222
-                   ." ON tt.term_id = t.term_id"
223
-                   ." WHERE tt.taxonomy = 'category'"
224
-                   ." AND t.term_id = ".$namedKeyValues['CategoryID'][0];
225
-            $stmt = mysql_query($query);
216
+                $data = mysql_fetch_assoc($stmt);
217
+                $result = $this->_serializeTag($data);
218
+                break;
219
+            case 'Categories':
220
+                $query = "SELECT t.*, tt.description"
221
+                       ." FROM `wp_terms` AS t INNER JOIN `wp_term_taxonomy` as tt"
222
+                       ." ON tt.term_id = t.term_id"
223
+                       ." WHERE tt.taxonomy = 'category'"
224
+                       ." AND t.term_id = ".$namedKeyValues['CategoryID'][0];
225
+                $stmt = mysql_query($query);
226 226
               
227
-            //If resource not found return null to the library
228
-            if (!mysql_num_rows($stmt)) {
229
-                return null;
230
-            }
227
+                //If resource not found return null to the library
228
+                if (!mysql_num_rows($stmt)) {
229
+                    return null;
230
+                }
231 231
               
232
-            $data = mysql_fetch_assoc($stmt);
233
-            $result = $this->_serializeCategory($data);
234
-            break;
235
-        case 'Comments':
236
-            $query = "SELECT * FROM `wp_comments`"
237
-                   ." WHERE comment_approved = 1" 
238
-                   ." AND comment_ID = ".$namedKeyValues['CommentID'][0];
239
-            $stmt = mysql_query($query);
232
+                $data = mysql_fetch_assoc($stmt);
233
+                $result = $this->_serializeCategory($data);
234
+                break;
235
+            case 'Comments':
236
+                $query = "SELECT * FROM `wp_comments`"
237
+                       ." WHERE comment_approved = 1" 
238
+                       ." AND comment_ID = ".$namedKeyValues['CommentID'][0];
239
+                $stmt = mysql_query($query);
240 240
               
241
-            //If resource not found return null to the library
242
-            if (!mysql_num_rows($stmt)) {
243
-                return null;
244
-            }
241
+                //If resource not found return null to the library
242
+                if (!mysql_num_rows($stmt)) {
243
+                    return null;
244
+                }
245 245
               
246
-            $data = mysql_fetch_assoc($stmt);
247
-            $result = $this->_serializeComment($data);
248
-            break;
249
-        case 'Users':
250
-            $query = "SELECT * FROM `wp_users` WHERE ID = ".$namedKeyValues['UserID'][0];
251
-            $stmt = mysql_query($query);
246
+                $data = mysql_fetch_assoc($stmt);
247
+                $result = $this->_serializeComment($data);
248
+                break;
249
+            case 'Users':
250
+                $query = "SELECT * FROM `wp_users` WHERE ID = ".$namedKeyValues['UserID'][0];
251
+                $stmt = mysql_query($query);
252 252
               
253
-            //If resource not found return null to the library
254
-            if (!mysql_num_rows($stmt)) {
255
-                return null;
256
-            }
253
+                //If resource not found return null to the library
254
+                if (!mysql_num_rows($stmt)) {
255
+                    return null;
256
+                }
257 257
               
258
-            $data = mysql_fetch_assoc($stmt);
259
-            $result = $this->_serializeUser($data);
260
-            break;
258
+                $data = mysql_fetch_assoc($stmt);
259
+                $result = $this->_serializeUser($data);
260
+                break;
261 261
         }
262 262
         
263 263
         mysql_free_result($stmt);
@@ -293,147 +293,147 @@  discard block
 block discarded – undo
293 293
         $navigationPropName = $targetProperty->getName();
294 294
         
295 295
         switch (true) {
296
-        case ($srcClass == 'Post'):
297
-            if ($navigationPropName == 'Tags') {
298
-                $query = "SELECT t.*, tt.description"
299
-                       ." FROM wp_terms AS t"
300
-                       ." INNER JOIN wp_term_taxonomy AS tt"
301
-                       ." ON tt.term_id = t.term_id"
302
-                       ." INNER JOIN wp_term_relationships AS tr"
303
-                       ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
304
-                       ." WHERE tt.taxonomy IN ('post_tag')"
305
-                       ." AND tr.object_id IN ($sourceEntityInstance->PostID)";
306
-                if ($filter !== null) {
307
-                    $query .= " AND $filter";
308
-                }
309
-                $stmt = mysql_query($query);
310
-                if ( $stmt === false) {
311
-                    die(mysql_error());
312
-                }
296
+            case ($srcClass == 'Post'):
297
+                if ($navigationPropName == 'Tags') {
298
+                    $query = "SELECT t.*, tt.description"
299
+                           ." FROM wp_terms AS t"
300
+                           ." INNER JOIN wp_term_taxonomy AS tt"
301
+                           ." ON tt.term_id = t.term_id"
302
+                           ." INNER JOIN wp_term_relationships AS tr"
303
+                           ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
304
+                           ." WHERE tt.taxonomy IN ('post_tag')"
305
+                           ." AND tr.object_id IN ($sourceEntityInstance->PostID)";
306
+                    if ($filter !== null) {
307
+                        $query .= " AND $filter";
308
+                    }
309
+                    $stmt = mysql_query($query);
310
+                    if ( $stmt === false) {
311
+                        die(mysql_error());
312
+                    }
313 313
                         
314
-                $result = $this->_serializeTags($stmt);
315
-            } elseif ($navigationPropName == 'Categories') {
316
-                $query = "SELECT t.*, tt.description"
317
-                       ." FROM wp_terms AS t"
318
-                       ." INNER JOIN wp_term_taxonomy AS tt"
319
-                       ." ON tt.term_id = t.term_id"
320
-                       ." INNER JOIN wp_term_relationships AS tr"
321
-                       ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
322
-                       ." WHERE tt.taxonomy IN ('category')"
323
-                       ." AND tr.object_id IN ($sourceEntityInstance->PostID)";
324
-                if ($filter !== null) {
325
-                    $query .= " AND $filter";
326
-                }
327
-                $stmt = mysql_query($query);
328
-                if ( $stmt === false) {            
329
-                       die(mysql_error());
330
-                }
314
+                    $result = $this->_serializeTags($stmt);
315
+                } elseif ($navigationPropName == 'Categories') {
316
+                    $query = "SELECT t.*, tt.description"
317
+                           ." FROM wp_terms AS t"
318
+                           ." INNER JOIN wp_term_taxonomy AS tt"
319
+                           ." ON tt.term_id = t.term_id"
320
+                           ." INNER JOIN wp_term_relationships AS tr"
321
+                           ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
322
+                           ." WHERE tt.taxonomy IN ('category')"
323
+                           ." AND tr.object_id IN ($sourceEntityInstance->PostID)";
324
+                    if ($filter !== null) {
325
+                        $query .= " AND $filter";
326
+                    }
327
+                    $stmt = mysql_query($query);
328
+                    if ( $stmt === false) {            
329
+                           die(mysql_error());
330
+                    }
331 331
                         
332
-                $result = $this->_serializeCategories($stmt);
333
-            } else if ($navigationPropName == 'Comments') {
334
-                $query = "SELECT * FROM `wp_comments`"
335
-                       ." WHERE comment_approved = 1" 
336
-                       ." AND comment_post_ID = $sourceEntityInstance->PostID";
337
-                if ($filter !== null) {
338
-                    $query .= " AND $filter";
339
-                }
340
-                $stmt = mysql_query($query);
341
-                if ( $stmt === false) {
342
-                    die(mysql_error());
343
-                }
332
+                    $result = $this->_serializeCategories($stmt);
333
+                } else if ($navigationPropName == 'Comments') {
334
+                    $query = "SELECT * FROM `wp_comments`"
335
+                           ." WHERE comment_approved = 1" 
336
+                           ." AND comment_post_ID = $sourceEntityInstance->PostID";
337
+                    if ($filter !== null) {
338
+                        $query .= " AND $filter";
339
+                    }
340
+                    $stmt = mysql_query($query);
341
+                    if ( $stmt === false) {
342
+                        die(mysql_error());
343
+                    }
344 344
                         
345
-                $result = $this->_serializeComments($stmt);
346
-            } else {
347
-                die('Post does not have navigation porperty with name: ' . $navigationPropName);
348
-            }
349
-            break;
350
-
351
-        case ($srcClass == 'Tag'):
352
-            if ($navigationPropName == 'Posts') {
353
-                $query = "SELECT p . *" 
354
-                         ." FROM wp_posts AS p"
355
-                         ." INNER JOIN wp_term_relationships AS tr"
356
-                         ." ON p.ID = tr.object_id"
357
-                         ." INNER JOIN wp_term_taxonomy AS tt"
358
-                         ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
359
-                         ." WHERE tt.term_id = $sourceEntityInstance->TagID"
360
-                         ." AND p.post_type = 'post'"
361
-                         ." AND p.post_status = 'publish'";
362
-                if ($filter !== null) {
363
-                    $query .= " AND $filter";
364
-                }
365
-                $stmt = mysql_query($query);
366
-                if ( $stmt === false) {
367
-                            die(mysql_error());
345
+                    $result = $this->_serializeComments($stmt);
346
+                } else {
347
+                    die('Post does not have navigation porperty with name: ' . $navigationPropName);
368 348
                 }
349
+                break;
350
+
351
+            case ($srcClass == 'Tag'):
352
+                if ($navigationPropName == 'Posts') {
353
+                    $query = "SELECT p . *" 
354
+                             ." FROM wp_posts AS p"
355
+                             ." INNER JOIN wp_term_relationships AS tr"
356
+                             ." ON p.ID = tr.object_id"
357
+                             ." INNER JOIN wp_term_taxonomy AS tt"
358
+                             ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
359
+                             ." WHERE tt.term_id = $sourceEntityInstance->TagID"
360
+                             ." AND p.post_type = 'post'"
361
+                             ." AND p.post_status = 'publish'";
362
+                    if ($filter !== null) {
363
+                        $query .= " AND $filter";
364
+                    }
365
+                    $stmt = mysql_query($query);
366
+                    if ( $stmt === false) {
367
+                                die(mysql_error());
368
+                    }
369 369
                         
370
-                      $result = $this->_serializePosts($stmt);
371
-            } else {
372
-                die('Tag does not have navigation porperty with name: ' . $navigationPropName);
373
-            }
374
-            break;
375
-                    
376
-        case ($srcClass == 'Category'):
377
-            if ($navigationPropName == 'Posts') {
378
-                $query = "SELECT p . *" 
379
-                         ." FROM wp_posts AS p"
380
-                         ." INNER JOIN wp_term_relationships AS tr"
381
-                         ." ON p.ID = tr.object_id"
382
-                         ." INNER JOIN wp_term_taxonomy AS tt"
383
-                         ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
384
-                         ." WHERE tt.term_id = $sourceEntityInstance->CategoryID"
385
-                         ." AND p.post_type = 'post'"
386
-                         ." AND p.post_status = 'publish'";
387
-                if ($filter !== null) {
388
-                    $query .= " AND $filter";
389
-                }
390
-                $stmt = mysql_query($query);
391
-                if ( $stmt === false) {
392
-                    die(mysql_error());
370
+                          $result = $this->_serializePosts($stmt);
371
+                } else {
372
+                    die('Tag does not have navigation porperty with name: ' . $navigationPropName);
393 373
                 }
374
+                break;
375
+                    
376
+            case ($srcClass == 'Category'):
377
+                if ($navigationPropName == 'Posts') {
378
+                    $query = "SELECT p . *" 
379
+                             ." FROM wp_posts AS p"
380
+                             ." INNER JOIN wp_term_relationships AS tr"
381
+                             ." ON p.ID = tr.object_id"
382
+                             ." INNER JOIN wp_term_taxonomy AS tt"
383
+                             ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
384
+                             ." WHERE tt.term_id = $sourceEntityInstance->CategoryID"
385
+                             ." AND p.post_type = 'post'"
386
+                             ." AND p.post_status = 'publish'";
387
+                    if ($filter !== null) {
388
+                        $query .= " AND $filter";
389
+                    }
390
+                    $stmt = mysql_query($query);
391
+                    if ( $stmt === false) {
392
+                        die(mysql_error());
393
+                    }
394 394
                         
395
-                $result = $this->_serializePosts($stmt);
396
-            } else {
397
-                die('Category does not have navigation porperty with name: ' . $navigationPropName);
398
-            }
399
-            break;
395
+                    $result = $this->_serializePosts($stmt);
396
+                } else {
397
+                    die('Category does not have navigation porperty with name: ' . $navigationPropName);
398
+                }
399
+                break;
400 400
                  
401
-        case ($srcClass == 'Comment'):
402
-            die('Comment does not have navigation porperty with name: ' . $navigationPropName);
403
-            break;
401
+            case ($srcClass == 'Comment'):
402
+                die('Comment does not have navigation porperty with name: ' . $navigationPropName);
403
+                break;
404 404
                     
405
-        case ($srcClass == 'User'):
406
-            if ($navigationPropName == 'Posts') {
407
-                $query = "SELECT * FROM `wp_posts` WHERE"
408
-                       ." wp_posts.post_type = 'post'"
409
-                       ." AND wp_posts.post_status = 'publish'"
410
-                       ." AND wp_posts.post_author = $sourceEntityInstance->UserID";
411
-                if ($filter !== null) {
412
-                    $query .= " AND $filter";
413
-                }
414
-                $stmt = mysql_query($query);
415
-                if ( $stmt === false) {
416
-                    die(mysql_error());
417
-                }
405
+            case ($srcClass == 'User'):
406
+                if ($navigationPropName == 'Posts') {
407
+                    $query = "SELECT * FROM `wp_posts` WHERE"
408
+                           ." wp_posts.post_type = 'post'"
409
+                           ." AND wp_posts.post_status = 'publish'"
410
+                           ." AND wp_posts.post_author = $sourceEntityInstance->UserID";
411
+                    if ($filter !== null) {
412
+                        $query .= " AND $filter";
413
+                    }
414
+                    $stmt = mysql_query($query);
415
+                    if ( $stmt === false) {
416
+                        die(mysql_error());
417
+                    }
418 418
                             
419
-                $result = $this->_serializePosts($stmt);
420
-            } elseif ($navigationPropName == 'Comments') {
421
-                $query = "SELECT * FROM `wp_comments`"
422
-                     ." WHERE comment_approved = 1" 
423
-                     ." AND wp_comments.user_id = $sourceEntityInstance->UserID";
424
-                if ($filter !== null) {
425
-                    $query .= " AND $filter";
426
-                }
427
-                $stmt = mysql_query($query);
428
-                if ( $stmt === false) {            
429
-                    die(mysql_error());
430
-                }
419
+                    $result = $this->_serializePosts($stmt);
420
+                } elseif ($navigationPropName == 'Comments') {
421
+                    $query = "SELECT * FROM `wp_comments`"
422
+                         ." WHERE comment_approved = 1" 
423
+                         ." AND wp_comments.user_id = $sourceEntityInstance->UserID";
424
+                    if ($filter !== null) {
425
+                        $query .= " AND $filter";
426
+                    }
427
+                    $stmt = mysql_query($query);
428
+                    if ( $stmt === false) {            
429
+                        die(mysql_error());
430
+                    }
431 431
                         
432
-                $result = $this->_serializeComments($stmt);
433
-            } else {
434
-                die('User does not have navigation porperty with name: ' . $navigationPropName);
435
-            }
436
-            break;
432
+                    $result = $this->_serializeComments($stmt);
433
+                } else {
434
+                    die('User does not have navigation porperty with name: ' . $navigationPropName);
435
+                }
436
+                break;
437 437
         }
438 438
         
439 439
         mysql_free_result($stmt);
@@ -473,105 +473,105 @@  discard block
 block discarded – undo
473 473
         $conditionStr = implode(' AND ', $keys);
474 474
         
475 475
         switch (true) {
476
-        case ($srcClass == 'Post'):
477
-            if ($navigationPropName == 'Tags') {
478
-                $query = "SELECT t.*, tt.description"
479
-                       ." FROM wp_terms AS t"
480
-                       ." INNER JOIN wp_term_taxonomy AS tt"
481
-                       ." ON tt.term_id = t.term_id"
482
-                       ." INNER JOIN wp_term_relationships AS tr"
483
-                       ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
484
-                       ." WHERE tt.taxonomy IN ('post_tag')"
485
-                       ." AND tr.object_id IN ($sourceEntityInstance->PostID)"
486
-                       ." AND tt.term_id = ".$namedKeyValues['TagID'][0];
487
-                $stmt = mysql_query($query);
488
-                $result = $this->_serializeTags($stmt);
489
-            } elseif ($navigationPropName == 'Categories') {
490
-                $query = "SELECT t.*, tt.description"
491
-                       ." FROM wp_terms AS t"
492
-                       ." INNER JOIN wp_term_taxonomy AS tt"
493
-                       ." ON tt.term_id = t.term_id"
494
-                       ." INNER JOIN wp_term_relationships AS tr"
495
-                       ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
496
-                       ." WHERE tt.taxonomy IN ('category')"
497
-                       ." AND tr.object_id IN ($sourceEntityInstance->PostID)"
498
-                       ." AND tt.term_id = ".$namedKeyValues['CategoryID'][0];
499
-                $stmt = mysql_query($query);
500
-                $result = $this->_serializeCategories($stmt);
501
-            } else if ($navigationPropName == 'Comments') {
502
-                $query = "SELECT * FROM `wp_comments`"
503
-                       ." WHERE comment_approved = 1" 
504
-                       ." AND comment_post_ID = $sourceEntityInstance->PostID"
505
-                       ." AND comment_ID = ".$namedKeyValues['CommentID'][0];
506
-                $stmt = mysql_query($query);
507
-                $result = $this->_serializeComments($stmt);
508
-            } else {
509
-                die('Post does not have navigation porperty with name: ' . $navigationPropName);
510
-            }
511
-            break;
476
+            case ($srcClass == 'Post'):
477
+                if ($navigationPropName == 'Tags') {
478
+                    $query = "SELECT t.*, tt.description"
479
+                           ." FROM wp_terms AS t"
480
+                           ." INNER JOIN wp_term_taxonomy AS tt"
481
+                           ." ON tt.term_id = t.term_id"
482
+                           ." INNER JOIN wp_term_relationships AS tr"
483
+                           ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
484
+                           ." WHERE tt.taxonomy IN ('post_tag')"
485
+                           ." AND tr.object_id IN ($sourceEntityInstance->PostID)"
486
+                           ." AND tt.term_id = ".$namedKeyValues['TagID'][0];
487
+                    $stmt = mysql_query($query);
488
+                    $result = $this->_serializeTags($stmt);
489
+                } elseif ($navigationPropName == 'Categories') {
490
+                    $query = "SELECT t.*, tt.description"
491
+                           ." FROM wp_terms AS t"
492
+                           ." INNER JOIN wp_term_taxonomy AS tt"
493
+                           ." ON tt.term_id = t.term_id"
494
+                           ." INNER JOIN wp_term_relationships AS tr"
495
+                           ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
496
+                           ." WHERE tt.taxonomy IN ('category')"
497
+                           ." AND tr.object_id IN ($sourceEntityInstance->PostID)"
498
+                           ." AND tt.term_id = ".$namedKeyValues['CategoryID'][0];
499
+                    $stmt = mysql_query($query);
500
+                    $result = $this->_serializeCategories($stmt);
501
+                } else if ($navigationPropName == 'Comments') {
502
+                    $query = "SELECT * FROM `wp_comments`"
503
+                           ." WHERE comment_approved = 1" 
504
+                           ." AND comment_post_ID = $sourceEntityInstance->PostID"
505
+                           ." AND comment_ID = ".$namedKeyValues['CommentID'][0];
506
+                    $stmt = mysql_query($query);
507
+                    $result = $this->_serializeComments($stmt);
508
+                } else {
509
+                    die('Post does not have navigation porperty with name: ' . $navigationPropName);
510
+                }
511
+                break;
512 512
 
513
-        case ($srcClass == 'Tag'):
514
-            if ($navigationPropName == 'Posts') {
515
-                $query = "SELECT p . *" 
516
-                         ." FROM wp_posts AS p"
517
-                         ." INNER JOIN wp_term_relationships AS tr"
518
-                         ." ON p.ID = tr.object_id"
519
-                         ." INNER JOIN wp_term_taxonomy AS tt"
520
-                         ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
521
-                         ." WHERE tt.term_id = $sourceEntityInstance->TagID"
522
-                         ." AND p.post_type = 'post'"
523
-                         ." AND p.post_status = 'publish'"
524
-                         ." AND p.ID = ".$namedKeyValues['PostID'][0];
525
-                $stmt = mysql_query($query);
526
-                $result = $this->_serializePosts($stmt);
527
-            } else {
528
-                die('Tag does not have navigation porperty with name: ' . $navigationPropName);
529
-            }
530
-            break;
513
+            case ($srcClass == 'Tag'):
514
+                if ($navigationPropName == 'Posts') {
515
+                    $query = "SELECT p . *" 
516
+                             ." FROM wp_posts AS p"
517
+                             ." INNER JOIN wp_term_relationships AS tr"
518
+                             ." ON p.ID = tr.object_id"
519
+                             ." INNER JOIN wp_term_taxonomy AS tt"
520
+                             ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
521
+                             ." WHERE tt.term_id = $sourceEntityInstance->TagID"
522
+                             ." AND p.post_type = 'post'"
523
+                             ." AND p.post_status = 'publish'"
524
+                             ." AND p.ID = ".$namedKeyValues['PostID'][0];
525
+                    $stmt = mysql_query($query);
526
+                    $result = $this->_serializePosts($stmt);
527
+                } else {
528
+                    die('Tag does not have navigation porperty with name: ' . $navigationPropName);
529
+                }
530
+                break;
531 531
                     
532
-        case ($srcClass == 'Category'):
533
-            if ($navigationPropName == 'Posts') {
534
-                $query = "SELECT p . *" 
535
-                         ." FROM wp_posts AS p"
536
-                         ." INNER JOIN wp_term_relationships AS tr"
537
-                         ." ON p.ID = tr.object_id"
538
-                         ." INNER JOIN wp_term_taxonomy AS tt"
539
-                         ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
540
-                         ." WHERE tt.term_id = $sourceEntityInstance->CategoryID"
541
-                         ." AND p.post_type = 'post'"
542
-                         ." AND p.post_status = 'publish'"
543
-                         ." AND p.ID = ".$namedKeyValues['PostID'][0];
544
-                $stmt = mysql_query($query);
545
-                $result = $this->_serializePosts($stmt);
546
-            } else {
547
-                die('Category does not have navigation porperty with name: ' . $navigationPropName);
548
-            }
549
-            break;
532
+            case ($srcClass == 'Category'):
533
+                if ($navigationPropName == 'Posts') {
534
+                    $query = "SELECT p . *" 
535
+                             ." FROM wp_posts AS p"
536
+                             ." INNER JOIN wp_term_relationships AS tr"
537
+                             ." ON p.ID = tr.object_id"
538
+                             ." INNER JOIN wp_term_taxonomy AS tt"
539
+                             ." ON tr.term_taxonomy_id = tt.term_taxonomy_id"
540
+                             ." WHERE tt.term_id = $sourceEntityInstance->CategoryID"
541
+                             ." AND p.post_type = 'post'"
542
+                             ." AND p.post_status = 'publish'"
543
+                             ." AND p.ID = ".$namedKeyValues['PostID'][0];
544
+                    $stmt = mysql_query($query);
545
+                    $result = $this->_serializePosts($stmt);
546
+                } else {
547
+                    die('Category does not have navigation porperty with name: ' . $navigationPropName);
548
+                }
549
+                break;
550 550
                  
551
-        case ($srcClass == 'Comment'):
552
-            die('Comment does not have navigation porperty with name: ' . $navigationPropName);
553
-            break;
551
+            case ($srcClass == 'Comment'):
552
+                die('Comment does not have navigation porperty with name: ' . $navigationPropName);
553
+                break;
554 554
                     
555
-        case ($srcClass == 'User'):
556
-            if ($navigationPropName == 'Posts') {
557
-                 $query = "SELECT * FROM `wp_posts` WHERE"
558
-                        ." wp_posts.post_type = 'post'"
559
-                        ." AND wp_posts.post_status = 'publish'"
560
-                        ." AND wp_posts.post_author = $sourceEntityInstance->UserID"
561
-                        ." AND wp_posts.ID = ".$namedKeyValues['PostID'][0];
562
-                 $stmt = mysql_query($query);
563
-                 $result = $this->_serializePosts($stmt);
564
-            } elseif ($navigationPropName == 'Comments') {
565
-                 $query = "SELECT * FROM `wp_comments`"
566
-                      ." WHERE comment_approved = 1" 
567
-                      ." AND wp_comments.user_id = $sourceEntityInstance->UserID"
568
-                      ." AND wp_comments.comment_ID = ".$namedKeyValues['CommentID'][0];
569
-                 $stmt = mysql_query($query);
570
-                 $result = $this->_serializeComments($stmt);
571
-            } else {
572
-                 die('User does not have navigation porperty with name: ' . $navigationPropName);
573
-            }
574
-            break;
555
+            case ($srcClass == 'User'):
556
+                if ($navigationPropName == 'Posts') {
557
+                     $query = "SELECT * FROM `wp_posts` WHERE"
558
+                            ." wp_posts.post_type = 'post'"
559
+                            ." AND wp_posts.post_status = 'publish'"
560
+                            ." AND wp_posts.post_author = $sourceEntityInstance->UserID"
561
+                            ." AND wp_posts.ID = ".$namedKeyValues['PostID'][0];
562
+                     $stmt = mysql_query($query);
563
+                     $result = $this->_serializePosts($stmt);
564
+                } elseif ($navigationPropName == 'Comments') {
565
+                     $query = "SELECT * FROM `wp_comments`"
566
+                          ." WHERE comment_approved = 1" 
567
+                          ." AND wp_comments.user_id = $sourceEntityInstance->UserID"
568
+                          ." AND wp_comments.comment_ID = ".$namedKeyValues['CommentID'][0];
569
+                     $stmt = mysql_query($query);
570
+                     $result = $this->_serializeComments($stmt);
571
+                } else {
572
+                     die('User does not have navigation porperty with name: ' . $navigationPropName);
573
+                }
574
+                break;
575 575
         }
576 576
         
577 577
         mysql_free_result($stmt);
@@ -599,60 +599,60 @@  discard block
 block discarded – undo
599 599
         $navigationPropName = $targetProperty->getName();
600 600
         
601 601
         switch (true) {
602
-        case ($srcClass == 'Post'):
603
-            if ($navigationPropName == 'User') {
604
-                $query = "SELECT * FROM `wp_users` WHERE ID = $sourceEntityInstance->Author";
605
-                $stmt = mysql_query($query);
606
-                $stmt = mysql_query($query);
607
-                $data = mysql_fetch_assoc($stmt);
608
-                $result = $this->_serializeUser($data);
609
-                if ( $stmt === false) {            
610
-                    die(mysql_error());
611
-                }
602
+            case ($srcClass == 'Post'):
603
+                if ($navigationPropName == 'User') {
604
+                    $query = "SELECT * FROM `wp_users` WHERE ID = $sourceEntityInstance->Author";
605
+                    $stmt = mysql_query($query);
606
+                    $stmt = mysql_query($query);
607
+                    $data = mysql_fetch_assoc($stmt);
608
+                    $result = $this->_serializeUser($data);
609
+                    if ( $stmt === false) {            
610
+                        die(mysql_error());
611
+                    }
612 612
                         
613
-                if (!mysql_num_rows($stmt)) {
614
-                    $result =  null;
613
+                    if (!mysql_num_rows($stmt)) {
614
+                        $result =  null;
615
+                    }
616
+                } else {
617
+                    die('Post does not have navigation porperty with name: ' . $navigationPropName);
615 618
                 }
616
-            } else {
617
-                die('Post does not have navigation porperty with name: ' . $navigationPropName);
618
-            }
619
-            break;
619
+                break;
620 620
 
621
-        case ($srcClass == 'Comment'):
622
-            if ($navigationPropName == 'User') {
623
-                $query = "SELECT * FROM `wp_users` WHERE ID = $sourceEntityInstance->UserID";
624
-                $stmt = mysql_query($query);
625
-                if ( $stmt === false) {
626
-                    die(mysql_error());
627
-                }
621
+            case ($srcClass == 'Comment'):
622
+                if ($navigationPropName == 'User') {
623
+                    $query = "SELECT * FROM `wp_users` WHERE ID = $sourceEntityInstance->UserID";
624
+                    $stmt = mysql_query($query);
625
+                    if ( $stmt === false) {
626
+                        die(mysql_error());
627
+                    }
628 628
                         
629
-                if (!mysql_num_rows($stmt)) {
630
-                    $result =  null;
631
-                }
629
+                    if (!mysql_num_rows($stmt)) {
630
+                        $result =  null;
631
+                    }
632 632
                         
633
-                $data = mysql_fetch_assoc($stmt);
634
-                $result = $this->_serializeUser($data);
633
+                    $data = mysql_fetch_assoc($stmt);
634
+                    $result = $this->_serializeUser($data);
635 635
                       
636
-            } elseif ($navigationPropName == 'Post') {
637
-                $query = "SELECT * FROM `wp_posts` WHERE"
638
-                       ." wp_posts.post_type = 'post'"
639
-                       ." AND wp_posts.post_status = 'publish'"
640
-                       ." AND wp_posts.ID = $sourceEntityInstance->PostID";
641
-                $stmt = mysql_query($query);
642
-                if ( $stmt === false) {            
643
-                    die(mysql_error());
644
-                }
636
+                } elseif ($navigationPropName == 'Post') {
637
+                    $query = "SELECT * FROM `wp_posts` WHERE"
638
+                           ." wp_posts.post_type = 'post'"
639
+                           ." AND wp_posts.post_status = 'publish'"
640
+                           ." AND wp_posts.ID = $sourceEntityInstance->PostID";
641
+                    $stmt = mysql_query($query);
642
+                    if ( $stmt === false) {            
643
+                        die(mysql_error());
644
+                    }
645 645
                         
646
-                if (!mysql_num_rows($stmt)) {
647
-                    $result =  null;
648
-                }
646
+                    if (!mysql_num_rows($stmt)) {
647
+                        $result =  null;
648
+                    }
649 649
                         
650
-                $data = mysql_fetch_assoc($stmt);
651
-                $result = $this->_serializePost($data);
652
-            } else {
653
-                die('Comment does not have navigation porperty with name: ' . $navigationPropName);
654
-            }
655
-            break;
650
+                    $data = mysql_fetch_assoc($stmt);
651
+                    $result = $this->_serializePost($data);
652
+                } else {
653
+                    die('Comment does not have navigation porperty with name: ' . $navigationPropName);
654
+                }
655
+                break;
656 656
         }
657 657
         
658 658
         mysql_free_result($stmt);
Please login to merge, or discard this patch.
src/POData/Common/HttpStatus.php 1 patch
Switch Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -60,88 +60,88 @@
 block discarded – undo
60 60
     public static function getStatusDescription($statusCode)
61 61
     {
62 62
         switch ($statusCode) {
63
-        case self::CODE_CONTINUE:
64
-                return 'Continue';
65
-        case self::CODE_SWITCHING_PROTOCOLS:
66
-                return  'SwitchingProtocols';
67
-        case self::CODE_OK:
68
-                return  'OK';
69
-        case self::CODE_CREATED;
70
-                return  'Created';
71
-        case self::CODE_ACCEPTED;
72
-                return  'Accepted';
73
-        case self::CODE_NON_AUTHRATIVE_INFORMATION;
74
-                return  'Non-Authrative Information';
75
-        case self::CODE_NOCONTENT;
76
-                return  'No Content';
77
-        case self::CODE_RESET_CONTENT;
78
-                return 'ResetContent';
79
-        case self::CODE_PARTIAL_CONTENT;
80
-                return 'Partial Content';
81
-        case self::CODE_MULTIPLE_CHOICE;
82
-                return 'Multiple Choices';
83
-        case self::CODE_MOVED_PERMANENTLY;
84
-                return 'Moved Permanently';
85
-        case self::CODE_FOUND;
86
-                return 'Found';
87
-        case self::CODE_SEE_OTHER;
88
-                return 'See Other';
89
-        case self::CODE_NOT_MODIFIED;
90
-                return 'Not Modified';
91
-        case self::CODE_USE_PROXY;
92
-                return 'Use Proxy';
93
-        case self::CODE_UNUSED;
94
-                return 'Unused';    
95
-        case self::CODE_TEMP_REDIRECT;
96
-                return 'Temporary Redirect';
97
-        case self::CODE_BAD_REQUEST;
98
-                return 'Bad Request';
99
-        case self::CODE_UNAUTHORIZED;
100
-                return 'Unauthorized';
101
-        case self::CODE_PAYMENT_REQ;
102
-                return 'Payment Required';
103
-        case self::CODE_FORBIDDEN;
104
-                return 'Forbidden';
105
-        case self::CODE_NOT_FOUND;
106
-                return 'Not Found';
107
-        case self::CODE_METHOD_NOT_ALLOWED;
108
-                return 'Method Not Allowed';
109
-        case self::CODE_NOT_ACCEPTABLE;
110
-                return 'Not Acceptable';
111
-        case self::CODE_PROXY_AUTHENTICATION_REQUIRED;
112
-                return 'Proxy Authentication Required';
113
-        case self::CODE_REQUEST_TIMEOUT;
114
-                return 'Request Timeout';
115
-        case self::CODE_CONFLICT;
116
-                return 'Conflict';
117
-        case self::CODE_GONE;
118
-                return 'Gone';
119
-        case self::CODE_LENGTH_REQUIRED;
120
-                return 'Length Required';
121
-        case self::CODE_PRECONDITION_FAILED;
122
-                return 'Precondition Failed';
123
-        case self::CODE_REQUEST_ENTITY_TOOLONG;
124
-                return 'Request Entity Too Large';
125
-        case self::CODE_REQUEST_URI_TOOLONG;
126
-                return 'Request-URI Too Large';
127
-        case self::CODE_UNSUPPORTED_MEDIATYPE;
128
-                return 'Unsupported Media Type';
129
-        case self::CODE_REQUESTED_RANGE_NOT_SATISFIABLE;
130
-                return 'Requested Range NotSatisfiable';
131
-        case self::CODE_EXPECTATION_FAILED;
132
-                return 'Expectation Failed';
133
-        case self::CODE_INTERNAL_SERVER_ERROR;
134
-                return 'Internal Server Error';
135
-        case self::CODE_NOT_IMPLEMENTED;
136
-                return 'Not Implemented';
137
-        case self::CODE_BAD_GATEWAY;
138
-                return 'Bad Gateway';
139
-        case self::CODE_SERVICE_UNAVAILABLE;
140
-                return 'Service Unavailable';
141
-        case self::CODE_GATEWAY_TIMEOUT;
142
-                return 'Gateway Timeout';
143
-        case self::CODE_HTTP_VERSION_NOT_SUPPORTED;
144
-                return 'HTTP Version Not Suppoted';
63
+            case self::CODE_CONTINUE:
64
+                    return 'Continue';
65
+            case self::CODE_SWITCHING_PROTOCOLS:
66
+                    return  'SwitchingProtocols';
67
+            case self::CODE_OK:
68
+                    return  'OK';
69
+            case self::CODE_CREATED;
70
+                    return  'Created';
71
+            case self::CODE_ACCEPTED;
72
+                    return  'Accepted';
73
+            case self::CODE_NON_AUTHRATIVE_INFORMATION;
74
+                    return  'Non-Authrative Information';
75
+            case self::CODE_NOCONTENT;
76
+                    return  'No Content';
77
+            case self::CODE_RESET_CONTENT;
78
+                    return 'ResetContent';
79
+            case self::CODE_PARTIAL_CONTENT;
80
+                    return 'Partial Content';
81
+            case self::CODE_MULTIPLE_CHOICE;
82
+                    return 'Multiple Choices';
83
+            case self::CODE_MOVED_PERMANENTLY;
84
+                    return 'Moved Permanently';
85
+            case self::CODE_FOUND;
86
+                    return 'Found';
87
+            case self::CODE_SEE_OTHER;
88
+                    return 'See Other';
89
+            case self::CODE_NOT_MODIFIED;
90
+                    return 'Not Modified';
91
+            case self::CODE_USE_PROXY;
92
+                    return 'Use Proxy';
93
+            case self::CODE_UNUSED;
94
+                    return 'Unused';    
95
+            case self::CODE_TEMP_REDIRECT;
96
+                    return 'Temporary Redirect';
97
+            case self::CODE_BAD_REQUEST;
98
+                    return 'Bad Request';
99
+            case self::CODE_UNAUTHORIZED;
100
+                    return 'Unauthorized';
101
+            case self::CODE_PAYMENT_REQ;
102
+                    return 'Payment Required';
103
+            case self::CODE_FORBIDDEN;
104
+                    return 'Forbidden';
105
+            case self::CODE_NOT_FOUND;
106
+                    return 'Not Found';
107
+            case self::CODE_METHOD_NOT_ALLOWED;
108
+                    return 'Method Not Allowed';
109
+            case self::CODE_NOT_ACCEPTABLE;
110
+                    return 'Not Acceptable';
111
+            case self::CODE_PROXY_AUTHENTICATION_REQUIRED;
112
+                    return 'Proxy Authentication Required';
113
+            case self::CODE_REQUEST_TIMEOUT;
114
+                    return 'Request Timeout';
115
+            case self::CODE_CONFLICT;
116
+                    return 'Conflict';
117
+            case self::CODE_GONE;
118
+                    return 'Gone';
119
+            case self::CODE_LENGTH_REQUIRED;
120
+                    return 'Length Required';
121
+            case self::CODE_PRECONDITION_FAILED;
122
+                    return 'Precondition Failed';
123
+            case self::CODE_REQUEST_ENTITY_TOOLONG;
124
+                    return 'Request Entity Too Large';
125
+            case self::CODE_REQUEST_URI_TOOLONG;
126
+                    return 'Request-URI Too Large';
127
+            case self::CODE_UNSUPPORTED_MEDIATYPE;
128
+                    return 'Unsupported Media Type';
129
+            case self::CODE_REQUESTED_RANGE_NOT_SATISFIABLE;
130
+                    return 'Requested Range NotSatisfiable';
131
+            case self::CODE_EXPECTATION_FAILED;
132
+                    return 'Expectation Failed';
133
+            case self::CODE_INTERNAL_SERVER_ERROR;
134
+                    return 'Internal Server Error';
135
+            case self::CODE_NOT_IMPLEMENTED;
136
+                    return 'Not Implemented';
137
+            case self::CODE_BAD_GATEWAY;
138
+                    return 'Bad Gateway';
139
+            case self::CODE_SERVICE_UNAVAILABLE;
140
+                    return 'Service Unavailable';
141
+            case self::CODE_GATEWAY_TIMEOUT;
142
+                    return 'Gateway Timeout';
143
+            case self::CODE_HTTP_VERSION_NOT_SUPPORTED;
144
+                    return 'HTTP Version Not Suppoted';
145 145
         }
146 146
 
147 147
         return null;
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/ResourceType.php 1 patch
Switch Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -826,102 +826,102 @@
 block discarded – undo
826 826
     public static function getPrimitiveResourceType($typeCode)
827 827
     {
828 828
         switch($typeCode) {
829
-        case EdmPrimitiveType::BINARY:
830
-            return new ResourceType(
831
-                new Binary(), ResourceTypeKind::PRIMITIVE, 
832
-                'Binary', 'Edm'
833
-            );
834
-            break;
835
-        case EdmPrimitiveType::BOOLEAN:
836
-            return new ResourceType(
837
-                new Boolean(), 
838
-                ResourceTypeKind::PRIMITIVE, 
839
-                'Boolean', 'Edm'
840
-            );
841
-            break;
842
-        case EdmPrimitiveType::BYTE:
843
-            return new ResourceType(
844
-                new Byte(), 
845
-                ResourceTypeKind::PRIMITIVE, 
846
-                'Byte', 'Edm'
847
-            );
848
-            break;
849
-        case EdmPrimitiveType::DATETIME:
850
-            return new ResourceType(
851
-                new DateTime(), 
852
-                ResourceTypeKind::PRIMITIVE, 
853
-                'DateTime', 'Edm'
854
-            );
855
-            break;
856
-        case EdmPrimitiveType::DECIMAL:
857
-            return new ResourceType(
858
-                new Decimal(), 
859
-                ResourceTypeKind::PRIMITIVE, 
860
-                'Decimal', 'Edm'
861
-            );
862
-            break;
863
-        case EdmPrimitiveType::DOUBLE:
864
-            return new ResourceType(
865
-                new Double(), 
866
-                ResourceTypeKind::PRIMITIVE, 
867
-                'Double', 'Edm'
868
-            );
869
-            break;
870
-        case EdmPrimitiveType::GUID:
871
-            return new ResourceType(
872
-                new Guid(), 
873
-                ResourceTypeKind::PRIMITIVE, 
874
-                'Guid', 'Edm'
875
-            );
876
-            break;
877
-        case EdmPrimitiveType::INT16:
878
-            return new ResourceType(
879
-                new Int16(), 
880
-                ResourceTypeKind::PRIMITIVE, 
881
-                'Int16', 'Edm'
882
-            );
883
-            break;
884
-        case EdmPrimitiveType::INT32:
885
-            return new ResourceType(
886
-                new Int32(), 
887
-                ResourceTypeKind::PRIMITIVE, 
888
-                'Int32', 'Edm'
889
-            );
890
-            break;
891
-        case EdmPrimitiveType::INT64:
892
-            return new ResourceType(
893
-                new Int64(), 
894
-                ResourceTypeKind::PRIMITIVE, 
895
-                'Int64', 'Edm'
896
-            );
897
-            break;
898
-        case EdmPrimitiveType::SBYTE:
899
-            return new ResourceType(
900
-                new SByte(), 
901
-                ResourceTypeKind::PRIMITIVE, 
902
-                'SByte', 'Edm'
903
-            );
904
-            break;
905
-        case EdmPrimitiveType::SINGLE:
906
-            return new ResourceType(
907
-                new Single(), 
908
-                ResourceTypeKind::PRIMITIVE, 
909
-                'Single', 'Edm'
910
-            );
911
-            break;
912
-        case EdmPrimitiveType::STRING:
913
-            return new ResourceType(
914
-                new String(), 
915
-                ResourceTypeKind::PRIMITIVE, 
916
-                'String', 'Edm'
917
-            );
918
-            break;
919
-        default:
920
-            throw new \InvalidArgumentException(
921
-                Messages::commonNotValidPrimitiveEDMType(
922
-                    '$typeCode', 'getPrimitiveResourceType'
923
-                )
924
-            );
829
+            case EdmPrimitiveType::BINARY:
830
+                return new ResourceType(
831
+                    new Binary(), ResourceTypeKind::PRIMITIVE, 
832
+                    'Binary', 'Edm'
833
+                );
834
+                break;
835
+            case EdmPrimitiveType::BOOLEAN:
836
+                return new ResourceType(
837
+                    new Boolean(), 
838
+                    ResourceTypeKind::PRIMITIVE, 
839
+                    'Boolean', 'Edm'
840
+                );
841
+                break;
842
+            case EdmPrimitiveType::BYTE:
843
+                return new ResourceType(
844
+                    new Byte(), 
845
+                    ResourceTypeKind::PRIMITIVE, 
846
+                    'Byte', 'Edm'
847
+                );
848
+                break;
849
+            case EdmPrimitiveType::DATETIME:
850
+                return new ResourceType(
851
+                    new DateTime(), 
852
+                    ResourceTypeKind::PRIMITIVE, 
853
+                    'DateTime', 'Edm'
854
+                );
855
+                break;
856
+            case EdmPrimitiveType::DECIMAL:
857
+                return new ResourceType(
858
+                    new Decimal(), 
859
+                    ResourceTypeKind::PRIMITIVE, 
860
+                    'Decimal', 'Edm'
861
+                );
862
+                break;
863
+            case EdmPrimitiveType::DOUBLE:
864
+                return new ResourceType(
865
+                    new Double(), 
866
+                    ResourceTypeKind::PRIMITIVE, 
867
+                    'Double', 'Edm'
868
+                );
869
+                break;
870
+            case EdmPrimitiveType::GUID:
871
+                return new ResourceType(
872
+                    new Guid(), 
873
+                    ResourceTypeKind::PRIMITIVE, 
874
+                    'Guid', 'Edm'
875
+                );
876
+                break;
877
+            case EdmPrimitiveType::INT16:
878
+                return new ResourceType(
879
+                    new Int16(), 
880
+                    ResourceTypeKind::PRIMITIVE, 
881
+                    'Int16', 'Edm'
882
+                );
883
+                break;
884
+            case EdmPrimitiveType::INT32:
885
+                return new ResourceType(
886
+                    new Int32(), 
887
+                    ResourceTypeKind::PRIMITIVE, 
888
+                    'Int32', 'Edm'
889
+                );
890
+                break;
891
+            case EdmPrimitiveType::INT64:
892
+                return new ResourceType(
893
+                    new Int64(), 
894
+                    ResourceTypeKind::PRIMITIVE, 
895
+                    'Int64', 'Edm'
896
+                );
897
+                break;
898
+            case EdmPrimitiveType::SBYTE:
899
+                return new ResourceType(
900
+                    new SByte(), 
901
+                    ResourceTypeKind::PRIMITIVE, 
902
+                    'SByte', 'Edm'
903
+                );
904
+                break;
905
+            case EdmPrimitiveType::SINGLE:
906
+                return new ResourceType(
907
+                    new Single(), 
908
+                    ResourceTypeKind::PRIMITIVE, 
909
+                    'Single', 'Edm'
910
+                );
911
+                break;
912
+            case EdmPrimitiveType::STRING:
913
+                return new ResourceType(
914
+                    new String(), 
915
+                    ResourceTypeKind::PRIMITIVE, 
916
+                    'String', 'Edm'
917
+                );
918
+                break;
919
+            default:
920
+                throw new \InvalidArgumentException(
921
+                    Messages::commonNotValidPrimitiveEDMType(
922
+                        '$typeCode', 'getPrimitiveResourceType'
923
+                    )
924
+                );
925 925
         }    
926 926
     }
927 927
 }
928 928
\ No newline at end of file
Please login to merge, or discard this patch.
POData/UriProcessor/QueryProcessor/ExpressionParser/ExpressionParser.php 1 patch
Switch Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -363,37 +363,37 @@
 block discarded – undo
363 363
     private function _parsePrimaryStart()
364 364
     {
365 365
         switch ($this->_lexer->getCurrentToken()->Id) {
366
-        case ExpressionTokenId::BOOLEAN_LITERAL:
367
-            return $this->_parseTypedLiteral(new Boolean());
368
-        case ExpressionTokenId::DATETIME_LITERAL:
369
-            return $this->_parseTypedLiteral(new DateTime());
370
-        case ExpressionTokenId::DECIMAL_LITERAL:
371
-            return $this->_parseTypedLiteral(new Decimal());
372
-        case ExpressionTokenId::NULL_LITERAL:
373
-            return $this->_parseNullLiteral();
374
-        case ExpressionTokenId::IDENTIFIER:
375
-            return $this->_parseIdentifier();
376
-        case ExpressionTokenId::STRING_LITERAL:
377
-            return $this->_parseTypedLiteral(new String());
378
-        case ExpressionTokenId::INT64_LITERAL:
379
-            return $this->_parseTypedLiteral(new Int64());
380
-        case ExpressionTokenId::INTEGER_LITERAL:
381
-            return $this->_parseTypedLiteral(new Int32());
382
-        case ExpressionTokenId::DOUBLE_LITERAL:
383
-            return $this->_parseTypedLiteral(new Double());
384
-        case ExpressionTokenId::SINGLE_LITERAL:
385
-            return $this->_parseTypedLiteral(new Single());
386
-        case ExpressionTokenId::GUID_LITERAL:
387
-            return $this->_parseTypedLiteral(new Guid());
388
-        case ExpressionTokenId::BINARY_LITERAL:
389
-            throw new NotImplementedException(
390
-                'Support for binary is not implemented'
391
-            );
392
-            //return $this->_parseTypedLiteral(new Binary());
393
-        case ExpressionTokenId::OPENPARAM:
394
-            return $this->_parseParenExpression();
395
-        default:
396
-            throw ODataException::createSyntaxError("Expression expected.");
366
+            case ExpressionTokenId::BOOLEAN_LITERAL:
367
+                return $this->_parseTypedLiteral(new Boolean());
368
+            case ExpressionTokenId::DATETIME_LITERAL:
369
+                return $this->_parseTypedLiteral(new DateTime());
370
+            case ExpressionTokenId::DECIMAL_LITERAL:
371
+                return $this->_parseTypedLiteral(new Decimal());
372
+            case ExpressionTokenId::NULL_LITERAL:
373
+                return $this->_parseNullLiteral();
374
+            case ExpressionTokenId::IDENTIFIER:
375
+                return $this->_parseIdentifier();
376
+            case ExpressionTokenId::STRING_LITERAL:
377
+                return $this->_parseTypedLiteral(new String());
378
+            case ExpressionTokenId::INT64_LITERAL:
379
+                return $this->_parseTypedLiteral(new Int64());
380
+            case ExpressionTokenId::INTEGER_LITERAL:
381
+                return $this->_parseTypedLiteral(new Int32());
382
+            case ExpressionTokenId::DOUBLE_LITERAL:
383
+                return $this->_parseTypedLiteral(new Double());
384
+            case ExpressionTokenId::SINGLE_LITERAL:
385
+                return $this->_parseTypedLiteral(new Single());
386
+            case ExpressionTokenId::GUID_LITERAL:
387
+                return $this->_parseTypedLiteral(new Guid());
388
+            case ExpressionTokenId::BINARY_LITERAL:
389
+                throw new NotImplementedException(
390
+                    'Support for binary is not implemented'
391
+                );
392
+                //return $this->_parseTypedLiteral(new Binary());
393
+            case ExpressionTokenId::OPENPARAM:
394
+                return $this->_parseParenExpression();
395
+            default:
396
+                throw ODataException::createSyntaxError("Expression expected.");
397 397
         }
398 398
     }
399 399
 
Please login to merge, or discard this patch.
POData/UriProcessor/ResourcePathProcessor/SegmentParser/KeyDescriptor.php 1 patch
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -470,39 +470,39 @@
 block discarded – undo
470 470
     private static function _getTypeAndValidateKeyValue($value, $tokenId, &$outValue, &$outType)
471 471
     {     
472 472
         switch ($tokenId) {
473
-        case ExpressionTokenId::BOOLEAN_LITERAL:
474
-            $outType = new Boolean();
475
-            break;
476
-        case ExpressionTokenId::DATETIME_LITERAL:
477
-            $outType = new DateTime();
478
-            break;
479
-        case ExpressionTokenId::GUID_LITERAL:
480
-            $outType = new Guid();
481
-            break;
482
-        case ExpressionTokenId::STRING_LITERAL:
483
-            $outType = new String();
484
-            break;
485
-        case ExpressionTokenId::INTEGER_LITERAL:
486
-            $outType = new Int32();
487
-            break;
488
-        case ExpressionTokenId::DECIMAL_LITERAL:
489
-            $outType = new Decimal();
490
-            break;
491
-        case ExpressionTokenId::DOUBLE_LITERAL:
492
-            $outType = new Double();
493
-            break;
494
-        case ExpressionTokenId::INT64_LITERAL:
495
-            $outType = new Int64();
496
-            break;
497
-        case ExpressionTokenId::SINGLE_LITERAL:
498
-            $outType = new Single();
499
-            break;
500
-        case ExpressionTokenId::NULL_LITERAL:
501
-            $outType = new Null1();
502
-            break;
503
-        default:
504
-            $outType = null;
505
-            return false;
473
+            case ExpressionTokenId::BOOLEAN_LITERAL:
474
+                $outType = new Boolean();
475
+                break;
476
+            case ExpressionTokenId::DATETIME_LITERAL:
477
+                $outType = new DateTime();
478
+                break;
479
+            case ExpressionTokenId::GUID_LITERAL:
480
+                $outType = new Guid();
481
+                break;
482
+            case ExpressionTokenId::STRING_LITERAL:
483
+                $outType = new String();
484
+                break;
485
+            case ExpressionTokenId::INTEGER_LITERAL:
486
+                $outType = new Int32();
487
+                break;
488
+            case ExpressionTokenId::DECIMAL_LITERAL:
489
+                $outType = new Decimal();
490
+                break;
491
+            case ExpressionTokenId::DOUBLE_LITERAL:
492
+                $outType = new Double();
493
+                break;
494
+            case ExpressionTokenId::INT64_LITERAL:
495
+                $outType = new Int64();
496
+                break;
497
+            case ExpressionTokenId::SINGLE_LITERAL:
498
+                $outType = new Single();
499
+                break;
500
+            case ExpressionTokenId::NULL_LITERAL:
501
+                $outType = new Null1();
502
+                break;
503
+            default:
504
+                $outType = null;
505
+                return false;
506 506
         }
507 507
 
508 508
         if (!$outType->validate($value, $outValue)) {
Please login to merge, or discard this patch.