Completed
Push — master ( 7e191b...5fbcda )
by Nikolay
03:00
created
services/NorthWind/NorthWindDSExpressionProvider.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function onLogicalExpression($expressionType, $left, $right)
90 90
     {
91
-        switch($expressionType) {
91
+        switch ($expressionType) {
92 92
         case ExpressionType::AND_LOGICAL:
93 93
             return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
94 94
             break;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function onArithmeticExpression($expressionType, $left, $right)
113 113
     {
114
-        switch($expressionType) {
114
+        switch ($expressionType) {
115 115
         case ExpressionType::MULTIPLY:
116 116
             return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
117 117
             break;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function onRelationalExpression($expressionType, $left, $right)
145 145
     {
146
-        switch($expressionType) {
146
+        switch ($expressionType) {
147 147
         case ExpressionType::GREATERTHAN:
148 148
             return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
149 149
             break;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function onUnaryExpression($expressionType, $child)
183 183
     {
184
-        switch($expressionType) {
184
+        switch ($expressionType) {
185 185
         case ExpressionType::NEGATE:
186 186
             return $this->_prepareUnaryExpression(self::NEGATE, $child);
187 187
             break;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      */
298 298
     public function onFunctionCallExpression($functionDescription, $params)
299 299
     {
300
-        switch($functionDescription->functionName) {
300
+        switch ($functionDescription->functionName) {
301 301
         case ODataConstants::STRFUN_COMPARE:
302 302
             return "STRCMP($params[0]; $params[1])";
303 303
             break;
@@ -423,12 +423,12 @@  discard block
 block discarded – undo
423 423
                     $operator = "!".$operator;
424 424
               }
425 425
               return self::OPEN_BRAKET 
426
-                    . $str[0] . ' ' . $operator 
427
-                    . ' ' . $str[1] . self::CLOSE_BRACKET;
426
+                    . $str[0].' '.$operator 
427
+                    . ' '.$str[1].self::CLOSE_BRACKET;
428 428
             } else {
429 429
                 return self::OPEN_BRAKET 
430
-                    . $str[0] . ' ' . $operator 
431
-                    . ' ' . $str[1] . self::CLOSE_BRACKET;
430
+                    . $str[0].' '.$operator 
431
+                    . ' '.$str[1].self::CLOSE_BRACKET;
432 432
             }
433 433
         }
434 434
         
@@ -447,19 +447,19 @@  discard block
 block discarded – undo
447 447
               $operator = "!".$operator;
448 448
             }
449 449
             return self::OPEN_BRAKET
450
-            . $str[0] . ' ' . $operator
451
-            . ' ' . $str[1] . self::CLOSE_BRACKET;
450
+            . $str[0].' '.$operator
451
+            . ' '.$str[1].self::CLOSE_BRACKET;
452 452
           } else {
453 453
             return self::OPEN_BRAKET
454
-            . $str[0] . ' ' . $operator
455
-            . ' ' . $str[1] . self::CLOSE_BRACKET;
454
+            . $str[0].' '.$operator
455
+            . ' '.$str[1].self::CLOSE_BRACKET;
456 456
           }
457 457
         }
458 458
 
459 459
         return 
460 460
             self::OPEN_BRAKET 
461
-            . $left . ' ' . $operator 
462
-            . ' ' . $right . self::CLOSE_BRACKET;
461
+            . $left.' '.$operator 
462
+            . ' '.$right.self::CLOSE_BRACKET;
463 463
     }
464 464
 
465 465
     /**
@@ -472,6 +472,6 @@  discard block
 block discarded – undo
472 472
      */
473 473
     private function _prepareUnaryExpression($operator, $child)
474 474
     {
475
-        return $operator . self::OPEN_BRAKET . $child . self::CLOSE_BRACKET;
475
+        return $operator.self::OPEN_BRAKET.$child.self::CLOSE_BRACKET;
476 476
     }
477 477
 }
Please login to merge, or discard this patch.
services/NorthWind/NorthWindQueryProvider.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     	}
48 48
 
49 49
         $this->_connectionHandle = sqlsrv_connect(SERVER, $connectionInfo);
50
-        if ( $this->_connectionHandle ) {        	
50
+        if ($this->_connectionHandle) {        	
51 51
         } else {
52 52
             $errorAsString = self::_getSQLSRVError();
53 53
         	throw ODataException::createInternalServerError($errorAsString);
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
      * @return array(Object)
93 93
      */
94 94
     public function getResourceSet(ResourceSet $resourceSet, $filterOption = null, 
95
-        $select=null, $orderby=null, $top=null, $skip=null
95
+        $select = null, $orderby = null, $top = null, $skip = null
96 96
     ) {
97
-        $resourceSetName =  $resourceSet->getName();
97
+        $resourceSetName = $resourceSet->getName();
98 98
         if ($resourceSetName !== 'Customers' 
99 99
             && $resourceSetName !== 'Orders' 
100 100
             && $resourceSetName !== 'Order_Details'
101 101
             && $resourceSetName !== 'Employees'
102 102
         ) {
103
-        	throw ODataException::createInternalServerError('(NorthWindQueryProvider) Unknown resource set ' . $resourceSetName . '! Contact service provider');
103
+        	throw ODataException::createInternalServerError('(NorthWindQueryProvider) Unknown resource set '.$resourceSetName.'! Contact service provider');
104 104
         }
105 105
 
106 106
         if ($resourceSetName === 'Order_Details') {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
         $query = "SELECT * FROM [$resourceSetName]";
111 111
         if ($filterOption != null) {
112
-            $query .= ' WHERE ' . $filterOption;
112
+            $query .= ' WHERE '.$filterOption;
113 113
         }
114 114
         $stmt = sqlsrv_query($this->_connectionHandle, $query);
115 115
         if ($stmt === false) {
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getResourceFromResourceSet(ResourceSet $resourceSet, KeyDescriptor $keyDescriptor)
148 148
     {   
149
-        $resourceSetName =  $resourceSet->getName();
149
+        $resourceSetName = $resourceSet->getName();
150 150
         if ($resourceSetName !== 'Customers' 
151 151
             && $resourceSetName !== 'Orders' 
152 152
             && $resourceSetName !== 'Order_Details' 
153 153
             && $resourceSetName !== 'Products' 
154 154
             && $resourceSetName !== 'Employees'
155 155
         ) {
156
-            die('(NorthWindQueryProvider) Unknown resource set ' . $resourceSetName);    
156
+            die('(NorthWindQueryProvider) Unknown resource set '.$resourceSetName);    
157 157
         }
158 158
 
159 159
         if ($resourceSetName === 'Order_Details') {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $namedKeyValues = $keyDescriptor->getValidatedNamedValues();
164 164
         $condition = null;
165 165
         foreach ($namedKeyValues as $key => $value) {
166
-            $condition .= $key . ' = ' . $value[0] . ' and ';
166
+            $condition .= $key.' = '.$value[0].' and ';
167 167
         }
168 168
 
169 169
         $len = strlen($condition);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         }
182 182
 
183 183
         $result = null;
184
-        while ( $record = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
184
+        while ($record = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
185 185
             switch ($resourceSetName) {
186 186
             case 'Customers':
187 187
                 $result = $this->_serializeCustomer($record);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $navigationPropName = $targetProperty->getName();
228 228
         $key = null;
229 229
         foreach ($keyDescriptor->getValidatedNamedValues() as $keyName => $valueDescription) {
230
-            $key = $key . $keyName . '=' . $valueDescription[0] . ' and ';
230
+            $key = $key.$keyName.'='.$valueDescription[0].' and ';
231 231
         }
232 232
 
233 233
         $key = rtrim($key, ' and ');
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
                 $result = $this->_serializeOrders($stmt);
244 244
             } else {
245
-                die('Customer does not have navigation porperty with name: ' . $navigationPropName);
245
+                die('Customer does not have navigation porperty with name: '.$navigationPropName);
246 246
             }            
247 247
         } else if ($srcClass === 'Order') {
248 248
             if ($navigationPropName === 'Order_Details') {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
                 $result = $this->_serializeOrderDetails($stmt);
257 257
             } else {
258
-                die('Order does not have navigation porperty with name: ' . $navigationPropName);
258
+                die('Order does not have navigation porperty with name: '.$navigationPropName);
259 259
             }
260 260
         } 
261 261
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         ResourceSet $targetResourceSet,
288 288
         ResourceProperty $targetProperty, 
289 289
         $filterOption = null,
290
-        $select=null, $orderby=null, $top=null, $skip=null
290
+        $select = null, $orderby = null, $top = null, $skip = null
291 291
     ) {    
292 292
         $result = array();
293 293
         $srcClass = get_class($sourceEntityInstance);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             if ($navigationPropName === 'Orders') {                
297 297
                 $query = "SELECT * FROM Orders WHERE CustomerID = '$sourceEntityInstance->CustomerID'";
298 298
                 if ($filterOption != null) {
299
-                    $query .= ' AND ' . $filterOption;
299
+                    $query .= ' AND '.$filterOption;
300 300
                 }
301 301
                 $stmt = sqlsrv_query($this->_connectionHandle, $query);
302 302
                 if ($stmt === false) {
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 
307 307
                 $result = $this->_serializeOrders($stmt);
308 308
             } else {
309
-                die('Customer does not have navigation porperty with name: ' . $navigationPropName);
309
+                die('Customer does not have navigation porperty with name: '.$navigationPropName);
310 310
             }            
311 311
         } else if ($srcClass === 'Order') {
312 312
             if ($navigationPropName === 'Order_Details') {
313 313
                 $query = "SELECT * FROM [Order Details] WHERE OrderID = $sourceEntityInstance->OrderID";
314 314
                 if ($filterOption != null) {
315
-                    $query .= ' AND ' . $filterOption;
315
+                    $query .= ' AND '.$filterOption;
316 316
                 }
317 317
                 $stmt = sqlsrv_query($this->_connectionHandle, $query);
318 318
                 if ($stmt === false) {            
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
                 $result = $this->_serializeOrderDetails($stmt);
324 324
             } else {
325
-                die('Order does not have navigation porperty with name: ' . $navigationPropName);
325
+                die('Order does not have navigation porperty with name: '.$navigationPropName);
326 326
             }
327 327
         }
328 328
 
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
                     }
363 363
 
364 364
                     if (!sqlsrv_has_rows($stmt)) {
365
-                        $result =  null;
365
+                        $result = null;
366 366
                     }
367 367
 
368 368
                     $result = $this->_serializeCustomer(sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC));
369 369
                 }
370 370
             } else {
371
-                die('Customer does not have navigation porperty with name: ' . $navigationPropName);
371
+                die('Customer does not have navigation porperty with name: '.$navigationPropName);
372 372
             }            
373 373
         } else if ($srcClass === 'Order_Details') {
374 374
             if ($navigationPropName === 'Order') {
@@ -383,13 +383,13 @@  discard block
 block discarded – undo
383 383
                     }
384 384
                     
385 385
                     if (!sqlsrv_has_rows($stmt)) {
386
-                        $result =  null;
386
+                        $result = null;
387 387
                     }
388 388
                     
389 389
                     $result = $this->_serializeOrder(sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC));
390 390
                 }
391 391
             } else {
392
-                die('Order_Details does not have navigation porperty with name: ' . $navigationPropName);
392
+                die('Order_Details does not have navigation porperty with name: '.$navigationPropName);
393 393
             }
394 394
         } 
395 395
 
@@ -437,14 +437,14 @@  discard block
 block discarded – undo
437 437
         $customer->Address->Country = $record['Country'];
438 438
         //Set alternate address
439 439
         $customer->Address->AltAddress = new Address();
440
-        $customer->Address->AltAddress->StreetName = 'ALT_' . $customer->Address->StreetName;
441
-        $customer->Address->AltAddress->City = 'ALT_' . $customer->Address->City;
442
-        $customer->Address->AltAddress->Region = 'ALT_' . $customer->Address->Region;
443
-        $customer->Address->AltAddress->PostalCode = 'ALT_' . $customer->Address->PostalCode;
444
-        $customer->Address->AltAddress->Country = 'ALT_' . $customer->Address->Country;
440
+        $customer->Address->AltAddress->StreetName = 'ALT_'.$customer->Address->StreetName;
441
+        $customer->Address->AltAddress->City = 'ALT_'.$customer->Address->City;
442
+        $customer->Address->AltAddress->Region = 'ALT_'.$customer->Address->Region;
443
+        $customer->Address->AltAddress->PostalCode = 'ALT_'.$customer->Address->PostalCode;
444
+        $customer->Address->AltAddress->Country = 'ALT_'.$customer->Address->Country;
445 445
         $customer->EmailAddresses = array();
446 446
         for ($i = 1; $i < 4; $i++) {
447
-            $customer->EmailAddresses[] = $customer->CustomerID . $i . '@live.com'; 
447
+            $customer->EmailAddresses[] = $customer->CustomerID.$i.'@live.com'; 
448 448
         }
449 449
 
450 450
         $customer->OtherAddresses = array();
@@ -467,18 +467,18 @@  discard block
 block discarded – undo
467 467
      */
468 468
     private function _copyAddress(&$src, &$target, $tag)
469 469
     {
470
-        $target->StreetName = $src->StreetName . $tag;
471
-        $target->City = $src->City . $tag;
472
-        $target->Region = $src->Region . $tag;
473
-        $target->PostalCode = $src->PostalCode . $tag;
474
-        $target->Country = $src->Country . $tag;
470
+        $target->StreetName = $src->StreetName.$tag;
471
+        $target->City = $src->City.$tag;
472
+        $target->Region = $src->Region.$tag;
473
+        $target->PostalCode = $src->PostalCode.$tag;
474
+        $target->Country = $src->Country.$tag;
475 475
         
476 476
         $target->AltAddress = new Address();
477
-        $target->AltAddress->StreetName = $target->AltAddress->StreetName . $tag;
478
-        $target->AltAddress->City = $target->AltAddress->City . $tag;
479
-        $target->AltAddress->Region = $target->AltAddress->Region . $tag;
480
-        $target->AltAddress->PostalCode = $target->AltAddress->PostalCode . $tag;
481
-        $target->AltAddress->Country = $target->AltAddress->Country . $tag;
477
+        $target->AltAddress->StreetName = $target->AltAddress->StreetName.$tag;
478
+        $target->AltAddress->City = $target->AltAddress->City.$tag;
479
+        $target->AltAddress->Region = $target->AltAddress->Region.$tag;
480
+        $target->AltAddress->PostalCode = $target->AltAddress->PostalCode.$tag;
481
+        $target->AltAddress->Country = $target->AltAddress->Country.$tag;
482 482
     }
483 483
 
484 484
     /**
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     private function _serializeOrders($result)
492 492
     {
493 493
         $orders = array();
494
-        while ( $record = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
494
+        while ($record = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
495 495
              $orders[] = $this->_serializeOrder($record);
496 496
         }
497 497
 
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
         $order->OrderID = $record['OrderID'];
512 512
         $order->CustomerID = $record['CustomerID'];
513 513
         $order->EmployeeID = $record['EmployeeID'];
514
-        $order->OrderDate = !is_null($record['OrderDate']) ? $record['OrderDate']->format('Y-m-d\TH:i:s'): null;
515
-        $order->RequiredDate = !is_null($record['RequiredDate']) ? $record['RequiredDate']->format('Y-m-d\TH:i:s'): null;
516
-        $order->ShippedDate = !is_null($record['ShippedDate']) ? $record['ShippedDate']->format('Y-m-d\TH:i:s'): null;
514
+        $order->OrderDate = !is_null($record['OrderDate']) ? $record['OrderDate']->format('Y-m-d\TH:i:s') : null;
515
+        $order->RequiredDate = !is_null($record['RequiredDate']) ? $record['RequiredDate']->format('Y-m-d\TH:i:s') : null;
516
+        $order->ShippedDate = !is_null($record['ShippedDate']) ? $record['ShippedDate']->format('Y-m-d\TH:i:s') : null;
517 517
         $order->ShipVia = $record['ShipVia'];
518 518
         $order->Freight = $record['Freight'];
519 519
         $order->ShipName = $record['ShipName'];
@@ -557,8 +557,8 @@  discard block
 block discarded – undo
557 557
         $employee->LastName = $record['LastName'];
558 558
         $employee->Title = $record['Title'];
559 559
         $employee->TitleOfCourtesy = $record['TitleOfCourtesy'];
560
-        $employee->BirthDate = !is_null($record['BirthDate']) ? $record['BirthDate']->format('Y-m-d\TH:i:s'): null;
561
-        $employee->HireDate = !is_null($record['HireDate']) ? $record['HireDate']->format('Y-m-d\TH:i:s'): null;        
560
+        $employee->BirthDate = !is_null($record['BirthDate']) ? $record['BirthDate']->format('Y-m-d\TH:i:s') : null;
561
+        $employee->HireDate = !is_null($record['HireDate']) ? $record['HireDate']->format('Y-m-d\TH:i:s') : null;        
562 562
         $employee->Address = $record['Address'];
563 563
         $employee->City = $record['City'];
564 564
         $employee->Region = $record['Region'];
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
         $employee->Notes = $record['Notes'];
570 570
         $employee->ReportsTo = $record['ReportsTo'];
571 571
         //$employee->Photo = $record['Photo'];
572
-        $employee->Emails = array ($employee->FirstName . '@hotmail.com', $employee->FirstName . '@live.com');
572
+        $employee->Emails = array($employee->FirstName.'@hotmail.com', $employee->FirstName.'@live.com');
573 573
         return $employee;
574 574
     }
575 575
 
Please login to merge, or discard this patch.
services/NorthWind/NorthWindStreamProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         }
77 77
 
78 78
         $filePath = self::IMAGE_PATH_ROOT 
79
-            . 'Employee_' . $entity->EmployeeID 
79
+            . 'Employee_'.$entity->EmployeeID 
80 80
             . '.jpg';
81 81
         if (file_exists($filePath)) {
82 82
             $handle = fopen($filePath, 'r');
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         }
153 153
 
154 154
         $lastModifiedTime = null;
155
-        $filePath = self::IMAGE_PATH_ROOT . 'Employee_' . $entity->EmployeeID . '.jpg';
155
+        $filePath = self::IMAGE_PATH_ROOT.'Employee_'.$entity->EmployeeID.'.jpg';
156 156
         if (file_exists($filePath)) {
157 157
             $lastModifiedTime = date("\"m-d-Y H:i:s\"", filemtime($filePath));
158 158
         } else {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             throw new ODataException('Internal Server Error.', 500);
237 237
         }
238 238
         
239
-        $filePath = self::IMAGE_PATH_ROOT . 'Employee_' 
239
+        $filePath = self::IMAGE_PATH_ROOT.'Employee_' 
240 240
             . $entity->EmployeeID 
241 241
             . '_' 
242 242
             . $resourceStreamInfo->getName() 
Please login to merge, or discard this patch.
services/WordPress/WordPressDSExpressionProvider.php 1 patch
Spacing   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function onLogicalExpression($expressionType, $left, $right)
86 86
     {
87
-        switch($expressionType) {
87
+        switch ($expressionType) {
88 88
         case ExpressionType::AND_LOGICAL:
89 89
             return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
90 90
             break;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function onArithmeticExpression($expressionType, $left, $right)
109 109
     {
110
-        switch($expressionType) {
110
+        switch ($expressionType) {
111 111
         case ExpressionType::MULTIPLY:
112 112
             return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
113 113
             break;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function onRelationalExpression($expressionType, $left, $right)
141 141
     {
142
-        switch($expressionType) {
142
+        switch ($expressionType) {
143 143
         case ExpressionType::GREATERTHAN:
144 144
             return $this->_prepareBinaryExpression(self::GREATERTHAN, $left, $right);
145 145
             break;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function onUnaryExpression($expressionType, $child)
179 179
     {
180
-        switch($expressionType) {
180
+        switch ($expressionType) {
181 181
         case ExpressionType::NEGATE:
182 182
             return $this->_prepareUnaryExpression(self::NEGATE, $child);
183 183
             break;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function onFunctionCallExpression($functionDescription, $params)
245 245
     {
246
-        switch($functionDescription->functionName) {
246
+        switch ($functionDescription->functionName) {
247 247
         case ODataConstants::STRFUN_COMPARE:
248 248
             return "STRCMP($params[0], $params[1])";
249 249
             break;
@@ -270,8 +270,7 @@  discard block
 block discarded – undo
270 270
             break;
271 271
         case ODataConstants::STRFUN_SUBSTRING:
272 272
             return count($params) == 3 ?
273
-                "SUBSTRING($params[0], $params[1] + 1, $params[2])" :
274
-                "SUBSTRING($params[0], $params[1] + 1)";
273
+                "SUBSTRING($params[0], $params[1] + 1, $params[2])" : "SUBSTRING($params[0], $params[1] + 1)";
275 274
             break;
276 275
         case ODataConstants::STRFUN_SUBSTRINGOF:
277 276
             return "(LOCATE($params[0], $params[1]) > 0)";
@@ -343,14 +342,14 @@  discard block
 block discarded – undo
343 342
         $str = explode(';', $left, 2);
344 343
         $str[0] = str_replace('DATETIMECMP', '', $str[0]);
345 344
         return self::OPEN_BRAKET
346
-          . $str[0] . ' ' . $operator
347
-          . ' ' . $str[1] . self::CLOSE_BRACKET;
345
+          . $str[0].' '.$operator
346
+          . ' '.$str[1].self::CLOSE_BRACKET;
348 347
       }
349 348
 
350 349
         return 
351 350
             self::OPEN_BRAKET 
352
-            . $left . ' ' . $operator 
353
-            . ' ' . $right . self::CLOSE_BRACKET;
351
+            . $left.' '.$operator 
352
+            . ' '.$right.self::CLOSE_BRACKET;
354 353
     }
355 354
 
356 355
     /**
@@ -363,6 +362,6 @@  discard block
 block discarded – undo
363 362
      */
364 363
     private function _prepareUnaryExpression($operator, $child)
365 364
     {
366
-        return $operator . self::OPEN_BRAKET . $child . self::CLOSE_BRACKET;
365
+        return $operator.self::OPEN_BRAKET.$child.self::CLOSE_BRACKET;
367 366
     }
368 367
 }
Please login to merge, or discard this patch.
services/WordPress/WordPressDataService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      */
54 54
     public function getService($serviceType)
55 55
     {
56
-      if(($serviceType === 'IMetadataProvider') ||
56
+      if (($serviceType === 'IMetadataProvider') ||
57 57
         ($serviceType === 'IQueryProvider') ||
58 58
         ($serviceType === 'IStreamProvider')) {
59 59
         if (is_null($this->_wordPressExpressionProvider)) {
Please login to merge, or discard this patch.
services/WordPress/WordPressMetadata.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
     public static function getEntityMapping() {
298 298
       if (!is_null(self::$_entityMapping))
299 299
       {
300
-        self::$_entityMapping = array (
301
-            'Post' => array (
300
+        self::$_entityMapping = array(
301
+            'Post' => array(
302 302
                 '$MappedTable$' => 'wp_posts',
303 303
                 'PostID' => 'ID',
304 304
                 'Author' => 'post_author',
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
                 'CommentCount' => 'comment_count'
325 325
               ),
326 326
           
327
-            'Tag' => array (
327
+            'Tag' => array(
328 328
                 '$MappedTable$' => 'wp_terms',
329 329
                 'TagID' =>'t.term_id',
330 330
                 'Name' =>'t.name',
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                 'Description' =>'tt.description'
333 333
             ),
334 334
           
335
-            'Category' => array (
335
+            'Category' => array(
336 336
                 '$MappedTable$' => 'wp_terms',
337 337
                 'CategoryID' =>'t.term_id',
338 338
                 'Name' =>'t.name',
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                 'Description' =>'tt.description'
341 341
             ),
342 342
           
343
-            'Comment' => array (
343
+            'Comment' => array(
344 344
                 '$MappedTable$' => 'wp_comments',
345 345
                 'CommentID', 'comment_id',
346 346
                 'PostID', 'comment_post_id',
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 'UserID', 'user_id'
359 359
             ),
360 360
           
361
-            'User' => array (
361
+            'User' => array(
362 362
                 '$MappedTable$' => 'wp_users',
363 363
                 'UserID' => 'ID',
364 364
                 'Login' => 'user_login',
Please login to merge, or discard this patch.
services/WordPress/WordPressQueryProvider.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function __construct()
42 42
     {
43 43
         $this->_connectionHandle = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, true);
44
-        if ( $this->_connectionHandle ) {
44
+        if ($this->_connectionHandle) {
45 45
         } else {             
46 46
              die(print_r(mysql_error(), true));
47 47
         } 
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
      * 
85 85
      * @return array(Object)
86 86
      */
87
-    public function getResourceSet(ResourceSet $resourceSet,$filter=null,$select=null,$orderby=null,$top=null,$skip=null)
87
+    public function getResourceSet(ResourceSet $resourceSet, $filter = null, $select = null, $orderby = null, $top = null, $skip = null)
88 88
     {   
89
-        $resourceSetName =  $resourceSet->getName();
89
+        $resourceSetName = $resourceSet->getName();
90 90
         if ($resourceSetName !== 'Posts' 
91 91
             && $resourceSetName !== 'Tags' 
92 92
             && $resourceSetName !== 'Categories' 
93 93
             && $resourceSetName !== 'Comments' 
94 94
             && $resourceSetName !== 'Users'
95 95
         ) {
96
-            die('(WordPressQueryProvider) Unknown resource set ' . $resourceSetName);
96
+            die('(WordPressQueryProvider) Unknown resource set '.$resourceSetName);
97 97
         }
98 98
 
99 99
        
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function getResourceFromResourceSet(ResourceSet $resourceSet, KeyDescriptor $keyDescriptor)
169 169
     {
170
-        $resourceSetName =  $resourceSet->getName();
170
+        $resourceSetName = $resourceSet->getName();
171 171
         if ($resourceSetName !== 'Posts' 
172 172
             && $resourceSetName !== 'Tags' 
173 173
             && $resourceSetName !== 'Categories' 
174 174
             && $resourceSetName !== 'Comments' 
175 175
             && $resourceSetName !== 'Users'
176 176
         ) {
177
-            die('(WordPressQueryProvider) Unknown resource set ' . $resourceSetName);
177
+            die('(WordPressQueryProvider) Unknown resource set '.$resourceSetName);
178 178
         }
179 179
 
180 180
         $namedKeyValues = $keyDescriptor->getValidatedNamedValues();
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $sourceEntityInstance, 
287 287
         ResourceSet $targetResourceSet,
288 288
         ResourceProperty $targetProperty,
289
-        $filter=null ,$select=null, $orderby=null, $top=null, $skip=null
289
+        $filter = null, $select = null, $orderby = null, $top = null, $skip = null
290 290
     ) {
291 291
         $result = array();
292 292
         $srcClass = get_class($sourceEntityInstance);
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                     $query .= " AND $filter";
308 308
                 }
309 309
                 $stmt = mysql_query($query);
310
-                if ( $stmt === false) {
310
+                if ($stmt === false) {
311 311
                     die(mysql_error());
312 312
                 }
313 313
                         
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                     $query .= " AND $filter";
326 326
                 }
327 327
                 $stmt = mysql_query($query);
328
-                if ( $stmt === false) {            
328
+                if ($stmt === false) {            
329 329
                        die(mysql_error());
330 330
                 }
331 331
                         
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
                     $query .= " AND $filter";
339 339
                 }
340 340
                 $stmt = mysql_query($query);
341
-                if ( $stmt === false) {
341
+                if ($stmt === false) {
342 342
                     die(mysql_error());
343 343
                 }
344 344
                         
345 345
                 $result = $this->_serializeComments($stmt);
346 346
             } else {
347
-                die('Post does not have navigation porperty with name: ' . $navigationPropName);
347
+                die('Post does not have navigation porperty with name: '.$navigationPropName);
348 348
             }
349 349
             break;
350 350
 
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
                     $query .= " AND $filter";
364 364
                 }
365 365
                 $stmt = mysql_query($query);
366
-                if ( $stmt === false) {
366
+                if ($stmt === false) {
367 367
                             die(mysql_error());
368 368
                 }
369 369
                         
370 370
                       $result = $this->_serializePosts($stmt);
371 371
             } else {
372
-                die('Tag does not have navigation porperty with name: ' . $navigationPropName);
372
+                die('Tag does not have navigation porperty with name: '.$navigationPropName);
373 373
             }
374 374
             break;
375 375
                     
@@ -388,18 +388,18 @@  discard block
 block discarded – undo
388 388
                     $query .= " AND $filter";
389 389
                 }
390 390
                 $stmt = mysql_query($query);
391
-                if ( $stmt === false) {
391
+                if ($stmt === false) {
392 392
                     die(mysql_error());
393 393
                 }
394 394
                         
395 395
                 $result = $this->_serializePosts($stmt);
396 396
             } else {
397
-                die('Category does not have navigation porperty with name: ' . $navigationPropName);
397
+                die('Category does not have navigation porperty with name: '.$navigationPropName);
398 398
             }
399 399
             break;
400 400
                  
401 401
         case ($srcClass == 'Comment'):
402
-            die('Comment does not have navigation porperty with name: ' . $navigationPropName);
402
+            die('Comment does not have navigation porperty with name: '.$navigationPropName);
403 403
             break;
404 404
                     
405 405
         case ($srcClass == 'User'):
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                     $query .= " AND $filter";
413 413
                 }
414 414
                 $stmt = mysql_query($query);
415
-                if ( $stmt === false) {
415
+                if ($stmt === false) {
416 416
                     die(mysql_error());
417 417
                 }
418 418
                             
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
                     $query .= " AND $filter";
426 426
                 }
427 427
                 $stmt = mysql_query($query);
428
-                if ( $stmt === false) {            
428
+                if ($stmt === false) {            
429 429
                     die(mysql_error());
430 430
                 }
431 431
                         
432 432
                 $result = $this->_serializeComments($stmt);
433 433
             } else {
434
-                die('User does not have navigation porperty with name: ' . $navigationPropName);
434
+                die('User does not have navigation porperty with name: '.$navigationPropName);
435 435
             }
436 436
             break;
437 437
         }
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
                 $stmt = mysql_query($query);
507 507
                 $result = $this->_serializeComments($stmt);
508 508
             } else {
509
-                die('Post does not have navigation porperty with name: ' . $navigationPropName);
509
+                die('Post does not have navigation porperty with name: '.$navigationPropName);
510 510
             }
511 511
             break;
512 512
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                 $stmt = mysql_query($query);
526 526
                 $result = $this->_serializePosts($stmt);
527 527
             } else {
528
-                die('Tag does not have navigation porperty with name: ' . $navigationPropName);
528
+                die('Tag does not have navigation porperty with name: '.$navigationPropName);
529 529
             }
530 530
             break;
531 531
                     
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
                 $stmt = mysql_query($query);
545 545
                 $result = $this->_serializePosts($stmt);
546 546
             } else {
547
-                die('Category does not have navigation porperty with name: ' . $navigationPropName);
547
+                die('Category does not have navigation porperty with name: '.$navigationPropName);
548 548
             }
549 549
             break;
550 550
                  
551 551
         case ($srcClass == 'Comment'):
552
-            die('Comment does not have navigation porperty with name: ' . $navigationPropName);
552
+            die('Comment does not have navigation porperty with name: '.$navigationPropName);
553 553
             break;
554 554
                     
555 555
         case ($srcClass == 'User'):
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                  $stmt = mysql_query($query);
570 570
                  $result = $this->_serializeComments($stmt);
571 571
             } else {
572
-                 die('User does not have navigation porperty with name: ' . $navigationPropName);
572
+                 die('User does not have navigation porperty with name: '.$navigationPropName);
573 573
             }
574 574
             break;
575 575
         }
@@ -606,15 +606,15 @@  discard block
 block discarded – undo
606 606
                 $stmt = mysql_query($query);
607 607
                 $data = mysql_fetch_assoc($stmt);
608 608
                 $result = $this->_serializeUser($data);
609
-                if ( $stmt === false) {            
609
+                if ($stmt === false) {            
610 610
                     die(mysql_error());
611 611
                 }
612 612
                         
613 613
                 if (!mysql_num_rows($stmt)) {
614
-                    $result =  null;
614
+                    $result = null;
615 615
                 }
616 616
             } else {
617
-                die('Post does not have navigation porperty with name: ' . $navigationPropName);
617
+                die('Post does not have navigation porperty with name: '.$navigationPropName);
618 618
             }
619 619
             break;
620 620
 
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
             if ($navigationPropName == 'User') {
623 623
                 $query = "SELECT * FROM `wp_users` WHERE ID = $sourceEntityInstance->UserID";
624 624
                 $stmt = mysql_query($query);
625
-                if ( $stmt === false) {
625
+                if ($stmt === false) {
626 626
                     die(mysql_error());
627 627
                 }
628 628
                         
629 629
                 if (!mysql_num_rows($stmt)) {
630
-                    $result =  null;
630
+                    $result = null;
631 631
                 }
632 632
                         
633 633
                 $data = mysql_fetch_assoc($stmt);
@@ -639,18 +639,18 @@  discard block
 block discarded – undo
639 639
                        ." AND wp_posts.post_status = 'publish'"
640 640
                        ." AND wp_posts.ID = $sourceEntityInstance->PostID";
641 641
                 $stmt = mysql_query($query);
642
-                if ( $stmt === false) {            
642
+                if ($stmt === false) {            
643 643
                     die(mysql_error());
644 644
                 }
645 645
                         
646 646
                 if (!mysql_num_rows($stmt)) {
647
-                    $result =  null;
647
+                    $result = null;
648 648
                 }
649 649
                         
650 650
                 $data = mysql_fetch_assoc($stmt);
651 651
                 $result = $this->_serializePost($data);
652 652
             } else {
653
-                die('Comment does not have navigation porperty with name: ' . $navigationPropName);
653
+                die('Comment does not have navigation porperty with name: '.$navigationPropName);
654 654
             }
655 655
             break;
656 656
         }
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
     private function _serializeComments($result)
817 817
     {
818 818
         $comments = array();
819
-        while ( $record = mysql_fetch_array($result, MYSQL_ASSOC)) {         
819
+        while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) {         
820 820
              $comments[] = $this->_serializeComment($record);
821 821
         }
822 822
 
Please login to merge, or discard this patch.
src/POData/BaseService.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 		$registry->register(new JsonODataV1Writer());
317 317
 		$registry->register(new AtomODataWriter($serviceURI));
318 318
 
319
-		if($serviceVersion->compare(Version::v2()) > -1){
319
+		if ($serviceVersion->compare(Version::v2()) > -1) {
320 320
 			$registry->register(new JsonODataV2Writer());
321 321
 		}
322 322
 
323
-		if($serviceVersion->compare(Version::v3()) > -1){
323
+		if ($serviceVersion->compare(Version::v3()) > -1) {
324 324
 			$registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::NONE(), $serviceURI));
325 325
 			$registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::MINIMAL(), $serviceURI));
326 326
 			$registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::FULL(), $serviceURI));
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 
352 352
 	    if (is_null($responseContentType) && $request->getTargetKind() != TargetKind::MEDIA_RESOURCE()) {
353 353
 		    //the responseContentType can ONLY be null if it's a stream (media resource) and that stream is storing null as the content type
354
-		    throw new ODataException( Messages::unsupportedMediaType(), 415 );
354
+		    throw new ODataException(Messages::unsupportedMediaType(), 415);
355 355
 	    }
356 356
 
357 357
 	    $odataModelInstance = null;
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 
519 519
 	    //if the $format header is present it overrides the accepts header
520 520
 	    $format = $host->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FORMAT);
521
-	    if(!is_null($format)){
521
+	    if (!is_null($format)) {
522 522
 
523 523
             //There's a strange edge case..if application/json is supplied and it's V3
524
-            if($format == MimeTypes::MIME_APPLICATION_JSON && $requestVersion == Version::v3()){
524
+            if ($format == MimeTypes::MIME_APPLICATION_JSON && $requestVersion == Version::v3()) {
525 525
                 //then it's actual minimalmetadata
526 526
                 //TODO: should this be done with the header text too?
527 527
                 $format = MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	    //getTargetKind doesn't deal with link resources directly and this can change things
538 538
 	    $targetKind = $request->isLinkUri() ? TargetKind::LINK() : $request->getTargetKind();
539 539
 
540
-	    switch($targetKind){
540
+	    switch ($targetKind) {
541 541
 		    case TargetKind::METADATA():
542 542
 			    return HttpProcessUtility::selectMimeType(
543 543
 				    $requestAcceptText,
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 			    );
615 615
 
616 616
 		    case TargetKind::MEDIA_RESOURCE():
617
-			    if (!$request->isNamedStream() && !$request->getTargetResourceType()->isMediaLinkEntry()){
617
+			    if (!$request->isNamedStream() && !$request->getTargetResourceType()->isMediaLinkEntry()) {
618 618
 					throw ODataException::createBadRequestError(
619 619
 					    Messages::badRequestInvalidUriForMediaResource(
620 620
 						    $host->getAbsoluteRequestUri()->getUrlAsString()
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 
649 649
 
650 650
 	    //If we got here, we just don't know what it is...
651
-        throw new ODataException( Messages::unsupportedMediaType(), 415 );
651
+        throw new ODataException(Messages::unsupportedMediaType(), 415);
652 652
 
653 653
     }
654 654
 
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
      * @return string|null The ETag for the entry object if it has eTag properties 
670 670
      *                     NULL otherwise.
671 671
      */
672
-    protected function compareETag(&$entryObject, ResourceType &$resourceType, 
672
+    protected function compareETag(&$entryObject, ResourceType & $resourceType, 
673 673
         &$needToSerializeResponse
674 674
     ) {      
675 675
         $needToSerializeResponse = true;
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
             // but that is causing an issue in Linux env where the 
721 721
             // firefix browser is unable to parse the ETag in this case.
722 722
             // Need to follow up PHP core devs for this. 
723
-            $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX . $eTag . '"';
723
+            $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX.$eTag.'"';
724 724
             if (!is_null($ifMatch)) {
725 725
                 if (strcmp($eTag, $ifMatch) != 0) {
726 726
                     // Requested If-Match value does not match with current 
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
             // but that is causing an issue in Linux env where the 
744 744
             // firefix browser is unable to parse the ETag in this case.
745 745
             // Need to follow up PHP core devs for this. 
746
-            $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX . $eTag . '"';
746
+            $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX.$eTag.'"';
747 747
         }
748 748
 
749 749
         return $eTag;
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
      *                     for use in a URI) there are etag properties, NULL if 
763 763
      *                     there is no etag property.
764 764
      */
765
-    protected function getETagForEntry(&$entryObject, ResourceType &$resourceType)
765
+    protected function getETagForEntry(&$entryObject, ResourceType & $resourceType)
766 766
     {
767 767
         $eTag = null;
768 768
         $comma = null;
@@ -777,18 +777,18 @@  discard block
 block discarded – undo
777 777
             try {
778 778
 
779 779
 	            //TODO #88...also this seems like dupe work
780
-                $reflectionProperty  = new \ReflectionProperty($entryObject, $eTagProperty->getName() );
780
+                $reflectionProperty = new \ReflectionProperty($entryObject, $eTagProperty->getName());
781 781
                 $value = $reflectionProperty->getValue($entryObject);
782 782
             } catch (\ReflectionException $reflectionException) {
783 783
                 throw ODataException::createInternalServerError(
784
-                    Messages::failedToAccessProperty($eTagProperty->getName(), $resourceType->getName() )
784
+                    Messages::failedToAccessProperty($eTagProperty->getName(), $resourceType->getName())
785 785
                 );
786 786
             }
787 787
 
788 788
             if (is_null($value)) {
789
-                $eTag = $eTag . $comma. 'null';
789
+                $eTag = $eTag.$comma.'null';
790 790
             } else {
791
-                $eTag = $eTag . $comma . $type->convertToOData($value);
791
+                $eTag = $eTag.$comma.$type->convertToOData($value);
792 792
             }
793 793
 
794 794
             $comma = ',';
Please login to merge, or discard this patch.
src/POData/Common/ErrorHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
             $exception = new ODataException($exception->getMessage(), HttpStatus::CODE_INTERNAL_SERVER_ERROR);
54 54
         }
55 55
 
56
-        $service->getHost()->setResponseVersion(ODataConstants::DATASERVICEVERSION_1_DOT_0 . ';');
56
+        $service->getHost()->setResponseVersion(ODataConstants::DATASERVICEVERSION_1_DOT_0.';');
57 57
 
58 58
         // At this point all kind of exceptions will be converted 
59 59
         //to 'ODataException' 
Please login to merge, or discard this patch.