Completed
Push — master ( 7e191b...5fbcda )
by Nikolay
03:00
created
services/NorthWind/NorthWindDSExpressionProvider.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function getIteratorName()
65 65
     {
66
-      return null;
66
+        return null;
67 67
     }
68 68
 
69 69
     /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function setResourceType(ResourceType $resourceType)
76 76
     {
77
-    	$this->_resourceType = $resourceType;
77
+        $this->_resourceType = $resourceType;
78 78
     }
79 79
 
80 80
     /**
@@ -225,66 +225,66 @@  discard block
 block discarded – undo
225 225
         $variable = null;
226 226
         $isFirstLevelPrimitive = is_null($parent->getParent());
227 227
         if (!$isFirstLevelPrimitive) {
228
-        	// This propery access sub-expression in the $filter need access
229
-        	// to level 2 or greater property of a complex or resource reference
230
-        	// property.
231
-        	// e.g. Customers?$filter=Address/City eq 'Kottayam'
232
-        	//          Level_2 property access [Complex]
233
-        	//      Customers?$filter=Address/AltAddress/City eq 'Seattle'
234
-        	//          Level_3 property access [Complex]
235
-        	//      Orders?$filter=Customer/CustomerID eq 'ALFKI'
236
-        	//          Level_2 property access [Resource Reference]
237
-        	$parent2 = null;
238
-        	do {
239
-        		$parent2 = $parent;
240
-        		$parent = $parent->getParent();
241
-        	} while ($parent != null);
228
+            // This propery access sub-expression in the $filter need access
229
+            // to level 2 or greater property of a complex or resource reference
230
+            // property.
231
+            // e.g. Customers?$filter=Address/City eq 'Kottayam'
232
+            //          Level_2 property access [Complex]
233
+            //      Customers?$filter=Address/AltAddress/City eq 'Seattle'
234
+            //          Level_3 property access [Complex]
235
+            //      Orders?$filter=Customer/CustomerID eq 'ALFKI'
236
+            //          Level_2 property access [Resource Reference]
237
+            $parent2 = null;
238
+            do {
239
+                $parent2 = $parent;
240
+                $parent = $parent->getParent();
241
+            } while ($parent != null);
242 242
         	
243
-        	$resourceProperty = $parent2->getResourceProperty();
244
-        	if ($resourceProperty->isKindOf(ResourcePropertyKind::RESOURCE_REFERENCE)) {
245
-        		// Orders?$filter=Customer/CustomerID eq 'ALFKI'
246
-        		throw new NotImplementedException(
247
-        				'This implementation not supports Resource reference in the filter',
248
-        				500,
249
-        				NULL
250
-        		);
251
-        	} else {
252
-        		// Customers?$filter=Address/AltAddress/City eq 'Seattle'
253
-        		// Customers?$filter=Address/City eq 'Seattle'
254
-        		$propertyName = $parent2->getResourceProperty()->getName();
255
-        		if ("Address" == $propertyName) {
256
-        			$child = $parent2->getChild();
257
-        			$propertyName = $child->getResourceProperty()->getName();
258
-        			if ("AltAddress" != $propertyName) {
259
-        				return $propertyName;
260
-        			}
243
+            $resourceProperty = $parent2->getResourceProperty();
244
+            if ($resourceProperty->isKindOf(ResourcePropertyKind::RESOURCE_REFERENCE)) {
245
+                // Orders?$filter=Customer/CustomerID eq 'ALFKI'
246
+                throw new NotImplementedException(
247
+                        'This implementation not supports Resource reference in the filter',
248
+                        500,
249
+                        NULL
250
+                );
251
+            } else {
252
+                // Customers?$filter=Address/AltAddress/City eq 'Seattle'
253
+                // Customers?$filter=Address/City eq 'Seattle'
254
+                $propertyName = $parent2->getResourceProperty()->getName();
255
+                if ("Address" == $propertyName) {
256
+                    $child = $parent2->getChild();
257
+                    $propertyName = $child->getResourceProperty()->getName();
258
+                    if ("AltAddress" != $propertyName) {
259
+                        return $propertyName;
260
+                    }
261 261
         			
262
-        			throw new NotImplementedException(
263
-        					'This implementation not supports Customer::Address::AltAddress in the filter',
264
-        					500,
265
-        					NULL
266
-        			);
267
-        		}
268
-        	}
262
+                    throw new NotImplementedException(
263
+                            'This implementation not supports Customer::Address::AltAddress in the filter',
264
+                            500,
265
+                            NULL
266
+                    );
267
+                }
268
+            }
269 269
 
270 270
         } else {
271
-        	// This is a first level property access
272
-        	$resourceProperty = $parent->getResourceProperty();
273
-        	if ($resourceProperty->isKindOf(ResourcePropertyKind::COMPLEX_TYPE)
274
-        	    || $resourceProperty->isKindOf(ResourcePropertyKind::RESOURCE_REFERENCE)) {
275
-        		// Customers?$filter=Address eq null
276
-        		// Orders?$filter=Customer ne null
277
-        		// First level property access to a complex or resource reference
278
-        		// which is not supported by $this [this implementation of IDSQP2]
279
-        		throw new NotImplementedException(
271
+            // This is a first level property access
272
+            $resourceProperty = $parent->getResourceProperty();
273
+            if ($resourceProperty->isKindOf(ResourcePropertyKind::COMPLEX_TYPE)
274
+                || $resourceProperty->isKindOf(ResourcePropertyKind::RESOURCE_REFERENCE)) {
275
+                // Customers?$filter=Address eq null
276
+                // Orders?$filter=Customer ne null
277
+                // First level property access to a complex or resource reference
278
+                // which is not supported by $this [this implementation of IDSQP2]
279
+                throw new NotImplementedException(
280 280
                     'First level complex and Resource reference are not supported in the filter', 
281
-        		    500, 
282
-        		    NULL
281
+                    500, 
282
+                    NULL
283 283
                 );
284
-        	} else {
285
-        		// First level property access to primitive property
286
-        		return $parent->getResourceProperty()->getName();
287
-        	}
284
+            } else {
285
+                // First level property access to primitive property
286
+                return $parent->getResourceProperty()->getName();
287
+            }
288 288
         }
289 289
     }
290 290
     /**
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
         case ODataConstants::STRFUN_SUBSTRING:
331 331
           if (count($params) == 3) {
332 332
             // 3 Param version of OData substring
333
-              return "SUBSTRING($params[0], $params[1] + 1, $params[2])";
334
-          } else {
333
+                return "SUBSTRING($params[0], $params[1] + 1, $params[2])";
334
+            } else {
335 335
             // 2 Params version of OData substring
336 336
             // We don't have the same function for SQL Server, we have only:
337 337
             //
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             // in value_expression, the whole value expression beginning at start_expression is returned
343 343
             // In OData substring function the index start from 0, in SQL Server its from 1
344 344
             return "SUBSTRING($params[0], $params[1] + 1, LEN($params[0]))";        	    
345
-          }
345
+            }
346 346
             break;
347 347
         case ODataConstants::STRFUN_SUBSTRINGOF:
348 348
           return "(CHARINDEX($params[0], $params[1]) != 0)";
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         case ODataConstants::BINFUL_EQUAL:
390 390
             return "($params[0] = $params[1])";
391 391
             break;
392
-         case 'is_null':
392
+            case 'is_null':
393 393
             return "is_null($params[0])";
394 394
             break;
395 395
 
@@ -409,20 +409,20 @@  discard block
 block discarded – undo
409 409
      */
410 410
     private function _prepareBinaryExpression($operator, $left, $right)
411 411
     {
412
-      if (!substr_compare($left, "STRCMP", 0, 6)) {
412
+        if (!substr_compare($left, "STRCMP", 0, 6)) {
413 413
             $str = explode(';', $left, 2);
414 414
             $str[0] = str_replace('STRCMP', '', $str[0]);
415 415
             if ($right == 'false' and $right != '0') {
416
-              if (!substr_compare($operator, '!', 0, 1)) {
417
-                  $operator = str_replace('!', '', $operator);
418
-              } else if ($operator == '>=') {
419
-                  $operator = '<';
420
-              } else if ($operator == '<=') {
421
-                  $operator = '>';
422
-              } else {
416
+                if (!substr_compare($operator, '!', 0, 1)) {
417
+                    $operator = str_replace('!', '', $operator);
418
+                } else if ($operator == '>=') {
419
+                    $operator = '<';
420
+                } else if ($operator == '<=') {
421
+                    $operator = '>';
422
+                } else {
423 423
                     $operator = "!".$operator;
424
-              }
425
-              return self::OPEN_BRAKET 
424
+                }
425
+                return self::OPEN_BRAKET 
426 426
                     . $str[0] . ' ' . $operator 
427 427
                     . ' ' . $str[1] . self::CLOSE_BRACKET;
428 428
             } else {
@@ -434,26 +434,26 @@  discard block
 block discarded – undo
434 434
         
435 435
         //DATETIMECMP
436 436
         if (!substr_compare($left, "DATETIMECMP", 0, 11)) {
437
-          $str = explode(';', $left, 2);
438
-          $str[0] = str_replace('DATETIMECMP', '', $str[0]);
439
-          if ($right == 'false' and $right != '0') {
437
+            $str = explode(';', $left, 2);
438
+            $str[0] = str_replace('DATETIMECMP', '', $str[0]);
439
+            if ($right == 'false' and $right != '0') {
440 440
             if (!substr_compare($operator, '!', 0, 1)) {
441
-              $operator = str_replace('!', '', $operator);
441
+                $operator = str_replace('!', '', $operator);
442 442
             } else if ($operator == '>=') {
443
-              $operator = '<';
443
+                $operator = '<';
444 444
             } else if ($operator == '<=') {
445
-              $operator = '>';
445
+                $operator = '>';
446 446
             } else {
447
-              $operator = "!".$operator;
447
+                $operator = "!".$operator;
448 448
             }
449 449
             return self::OPEN_BRAKET
450 450
             . $str[0] . ' ' . $operator
451 451
             . ' ' . $str[1] . self::CLOSE_BRACKET;
452
-          } else {
452
+            } else {
453 453
             return self::OPEN_BRAKET
454 454
             . $str[0] . ' ' . $operator
455 455
             . ' ' . $str[1] . self::CLOSE_BRACKET;
456
-          }
456
+            }
457 457
         }
458 458
 
459 459
         return 
Please login to merge, or discard this patch.
services/NorthWind/NorthWindMetadata.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -117,49 +117,49 @@
 block discarded – undo
117 117
 class Employee
118 118
 {
119 119
     //Key Edm.Int32
120
-     public $EmployeeID;
121
-     //Edm.String
122
-     public $FirstName;
123
-     //Edm.String
124
-     public $LastName;
125
-     //Edm.String
126
-     public $Title;
127
-     //Edm.String
128
-     public $TitleOfCourtesy;
129
-     //Edm.DateTime
130
-     public $BirthDate;
131
-     //Edm.DateTime
132
-     public $HireDate;
133
-     //Edm.String
134
-     public $Address;
135
-     //Edm.String
136
-     public $City;
137
-     //Edm.String
138
-     public $Region;
139
-     //Edm.String
140
-     public $PostalCode;
141
-     //Edm.String
142
-     public $Country;
143
-     //Edm.String
144
-     public $HomePhone;
145
-     //Edm.String
146
-     public $Extension;
147
-     //Edm.String
148
-     public $Notes;
149
-     //Bag of strings
150
-     public $Emails;
151
-     //Edm.Int32
152
-     public $ReportsTo;
153
-     //Edm.Binary
154
-     public $Photo;
155
-     //Edm.String
156
-     public $PhotoPath;
157
-     //Navigation Property to associated instance of Employee instance 
158
-     //representing manager (ResourceReference)
159
-     //public $Manager; 
160
-     //Navigation Property to associated instance of Employee instances 
161
-     //representing subordinates (ResourceSetReference)
162
-     //public $Subordinates;
120
+        public $EmployeeID;
121
+        //Edm.String
122
+        public $FirstName;
123
+        //Edm.String
124
+        public $LastName;
125
+        //Edm.String
126
+        public $Title;
127
+        //Edm.String
128
+        public $TitleOfCourtesy;
129
+        //Edm.DateTime
130
+        public $BirthDate;
131
+        //Edm.DateTime
132
+        public $HireDate;
133
+        //Edm.String
134
+        public $Address;
135
+        //Edm.String
136
+        public $City;
137
+        //Edm.String
138
+        public $Region;
139
+        //Edm.String
140
+        public $PostalCode;
141
+        //Edm.String
142
+        public $Country;
143
+        //Edm.String
144
+        public $HomePhone;
145
+        //Edm.String
146
+        public $Extension;
147
+        //Edm.String
148
+        public $Notes;
149
+        //Bag of strings
150
+        public $Emails;
151
+        //Edm.Int32
152
+        public $ReportsTo;
153
+        //Edm.Binary
154
+        public $Photo;
155
+        //Edm.String
156
+        public $PhotoPath;
157
+        //Navigation Property to associated instance of Employee instance 
158
+        //representing manager (ResourceReference)
159
+        //public $Manager; 
160
+        //Navigation Property to associated instance of Employee instances 
161
+        //representing subordinates (ResourceSetReference)
162
+        //public $Subordinates;
163 163
 }
164 164
 //End Resource Classes
165 165
 
Please login to merge, or discard this patch.
services/NorthWind/NorthWindQueryProvider.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function __construct()
42 42
     {
43
-    	$connectionInfo = array("Database" => DATABASE);
43
+        $connectionInfo = array("Database" => DATABASE);
44 44
         if (defined('UID')) {
45
-        	$connectionInfo['UID'] = UID;
46
-        	$connectionInfo['PWD'] = PWD;    		
47
-    	}
45
+            $connectionInfo['UID'] = UID;
46
+            $connectionInfo['PWD'] = PWD;    		
47
+        }
48 48
 
49 49
         $this->_connectionHandle = sqlsrv_connect(SERVER, $connectionInfo);
50 50
         if ( $this->_connectionHandle ) {        	
51 51
         } else {
52 52
             $errorAsString = self::_getSQLSRVError();
53
-        	throw ODataException::createInternalServerError($errorAsString);
53
+            throw ODataException::createInternalServerError($errorAsString);
54 54
         }
55 55
 
56 56
         $this->_northWindSQLSRVExpressionProvider = null;
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getExpressionProvider()
73 73
     {
74
-    	if (is_null($this->_northWindSQLSRVExpressionProvider)) {
75
-    		$this->_northWindSQLSRVExpressionProvider = new NorthWindDSExpressionProvider();
76
-    	}
74
+        if (is_null($this->_northWindSQLSRVExpressionProvider)) {
75
+            $this->_northWindSQLSRVExpressionProvider = new NorthWindDSExpressionProvider();
76
+        }
77 77
 
78
-    	return $this->_northWindSQLSRVExpressionProvider;
78
+        return $this->_northWindSQLSRVExpressionProvider;
79 79
     }
80 80
 
81 81
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
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') {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $stmt = sqlsrv_query($this->_connectionHandle, $query);
115 115
         if ($stmt === false) {
116 116
             $errorAsString = self::_getSQLSRVError();
117
-        	throw ODataException::createInternalServerError($errorAsString);
117
+            throw ODataException::createInternalServerError($errorAsString);
118 118
         }
119 119
         $returnResult = array();
120 120
         switch ($resourceSetName) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $stmt = sqlsrv_query($this->_connectionHandle, $query);
173 173
         if ($stmt === false) {
174 174
             $errorAsString = self::_getSQLSRVError();
175
-        	throw ODataException::createInternalServerError($errorAsString);
175
+            throw ODataException::createInternalServerError($errorAsString);
176 176
         }
177 177
 
178 178
         //If resource not found return null to the library
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                 $stmt = sqlsrv_query($this->_connectionHandle, $query);
238 238
                 if ($stmt === false) {            
239 239
                     $errorAsString = self::_getSQLSRVError();
240
-        	        throw ODataException::createInternalServerError($errorAsString);
240
+                    throw ODataException::createInternalServerError($errorAsString);
241 241
                 }
242 242
 
243 243
                 $result = $this->_serializeOrders($stmt);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                 $stmt = sqlsrv_query($this->_connectionHandle, $query);
251 251
                 if ($stmt === false) {            
252 252
                     $errorAsString = self::_getSQLSRVError();
253
-        	        throw ODataException::createInternalServerError($errorAsString);
253
+                    throw ODataException::createInternalServerError($errorAsString);
254 254
                 }
255 255
 
256 256
                 $result = $this->_serializeOrderDetails($stmt);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                 $stmt = sqlsrv_query($this->_connectionHandle, $query);
302 302
                 if ($stmt === false) {
303 303
                     $errorAsString = self::_getSQLSRVError();
304
-        	        throw ODataException::createInternalServerError($errorAsString);
304
+                    throw ODataException::createInternalServerError($errorAsString);
305 305
                 }
306 306
 
307 307
                 $result = $this->_serializeOrders($stmt);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                 $stmt = sqlsrv_query($this->_connectionHandle, $query);
318 318
                 if ($stmt === false) {            
319 319
                     $errorAsString = self::_getSQLSRVError();
320
-        	        throw ODataException::createInternalServerError($errorAsString);
320
+                    throw ODataException::createInternalServerError($errorAsString);
321 321
                 }
322 322
 
323 323
                 $result = $this->_serializeOrderDetails($stmt);
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                     $stmt = sqlsrv_query($this->_connectionHandle, $query);
359 359
                     if ($stmt === false) {
360 360
                         $errorAsString = self::_getSQLSRVError();
361
-        	            throw ODataException::createInternalServerError($errorAsString);
361
+                        throw ODataException::createInternalServerError($errorAsString);
362 362
                     }
363 363
 
364 364
                     if (!sqlsrv_has_rows($stmt)) {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                     $stmt = sqlsrv_query($this->_connectionHandle, $query);
380 380
                     if ($stmt === false) {
381 381
                         $errorAsString = self::_getSQLSRVError();
382
-        	            throw ODataException::createInternalServerError($errorAsString);
382
+                        throw ODataException::createInternalServerError($errorAsString);
383 383
                     }
384 384
                     
385 385
                     if (!sqlsrv_has_rows($stmt)) {
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     {
408 408
         $customers = array();
409 409
         while ($record = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {         
410
-             $customers[] = $this->_serializeCustomer($record);
410
+                $customers[] = $this->_serializeCustomer($record);
411 411
         }
412 412
 
413 413
         return $customers;
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
         return $customer;
457 457
     }
458 458
     
459
-     /**
460
-     * copy address
461
-     * 
462
-     * @param Object &$src    source
463
-     * @param Object &$target target
464
-     * @param Object $tag     tag
465
-     * 
466
-     * @return void
467
-     */
459
+        /**
460
+         * copy address
461
+         * 
462
+         * @param Object &$src    source
463
+         * @param Object &$target target
464
+         * @param Object $tag     tag
465
+         * 
466
+         * @return void
467
+         */
468 468
     private function _copyAddress(&$src, &$target, $tag)
469 469
     {
470 470
         $target->StreetName = $src->StreetName . $tag;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
     {
493 493
         $orders = array();
494 494
         while ( $record = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
495
-             $orders[] = $this->_serializeOrder($record);
495
+                $orders[] = $this->_serializeOrder($record);
496 496
         }
497 497
 
498 498
         return $orders;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     {
537 537
         $employees = array();
538 538
         while ($record = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
539
-             $employees[] = $this->_serializeEmployee($record);
539
+                $employees[] = $this->_serializeEmployee($record);
540 540
         }
541 541
 
542 542
         return $employees;
@@ -616,10 +616,10 @@  discard block
 block discarded – undo
616 616
      */
617 617
     private static function _getSQLSRVError()
618 618
     {
619
-    	$result = null;
620
-    	$errors = sqlsrv_errors();
621
-    	self::_getSQLSRVError1($errors, $result);
622
-    	return $result;
619
+        $result = null;
620
+        $errors = sqlsrv_errors();
621
+        self::_getSQLSRVError1($errors, $result);
622
+        return $result;
623 623
     }
624 624
     
625 625
     /**
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
      */
631 631
     private static function _getSQLSRVError1($errors, &$result)
632 632
     {
633
-    	if (is_array($errors)) {
634
-    		foreach ($errors as $error) {
635
-    			self::_getSQLSRVError1($error, $result);
636
-    		}
637
-    	} else {
638
-    		$result .= $errors;
639
-    	}
633
+        if (is_array($errors)) {
634
+            foreach ($errors as $error) {
635
+                self::_getSQLSRVError1($error, $result);
636
+            }
637
+        } else {
638
+            $result .= $errors;
639
+        }
640 640
     }
641 641
 
642 642
     /**
Please login to merge, or discard this patch.
services/NorthWind/NorthWindStreamProvider.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@
 block discarded – undo
230 230
                 400
231 231
             );
232 232
         }
233
-        **/
233
+         **/
234 234
 
235 235
         if (!($entity instanceof Employee)) {
236 236
             throw new ODataException('Internal Server Error.', 500);
Please login to merge, or discard this patch.
services/WordPress/WordPressDSExpressionProvider.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __construct()
51 51
     {
52
-      $this->_entityMapping = CreateWordPressMetadata::getEntityMapping();
52
+        $this->_entityMapping = CreateWordPressMetadata::getEntityMapping();
53 53
     }
54 54
 
55 55
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function setResourceType(ResourceType $resourceType)
72 72
     {
73
-      $this->_resourceType = $resourceType;
73
+        $this->_resourceType = $resourceType;
74 74
     }
75 75
 
76 76
     /**
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
         $entityTypeName = $this->_resourceType->getName();
224 224
         $propertyName = $parent->getResourceProperty()->getName();
225 225
         if (is_array($this->_entityMapping)) {
226
-          if (array_key_exists($entityTypeName, $this->_entityMapping)) {
226
+            if (array_key_exists($entityTypeName, $this->_entityMapping)) {
227 227
             if (array_key_exists($propertyName, $this->_entityMapping[$entityTypeName])) {
228
-              return $this->_entityMapping[$entityTypeName][$propertyName];
228
+                return $this->_entityMapping[$entityTypeName][$propertyName];
229
+            }
229 230
             }
230
-          }
231 231
         }
232 232
      
233 233
         return $propertyName;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             return "LENGTH($params[0])";
284 284
             break;
285 285
         case ODataConstants::GUIDFUN_EQUAL:
286
-        	return "STRCMP($params[0], $params[1])";
286
+            return "STRCMP($params[0], $params[1])";
287 287
             break;
288 288
         case ODataConstants::DATETIME_COMPARE:
289 289
             return "DATETIMECMP($params[0]; $params[1])";
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
      */
339 339
     private function _prepareBinaryExpression($operator, $left, $right)
340 340
     {
341
-      // Special handling for DATETIMECMP
342
-      if (!substr_compare($left, "DATETIMECMP", 0, 11)) {
341
+        // Special handling for DATETIMECMP
342
+        if (!substr_compare($left, "DATETIMECMP", 0, 11)) {
343 343
         $str = explode(';', $left, 2);
344 344
         $str[0] = str_replace('DATETIMECMP', '', $str[0]);
345 345
         return self::OPEN_BRAKET
346
-          . $str[0] . ' ' . $operator
347
-          . ' ' . $str[1] . self::CLOSE_BRACKET;
348
-      }
346
+            . $str[0] . ' ' . $operator
347
+            . ' ' . $str[1] . self::CLOSE_BRACKET;
348
+        }
349 349
 
350 350
         return 
351 351
             self::OPEN_BRAKET 
Please login to merge, or discard this patch.
services/WordPress/WordPressDataService.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,13 +53,13 @@
 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)) {
60 60
         $this->_wordPressExpressionProvider = new WordPressDSExpressionProvider();    			
61 61
         }    	
62
-      }
62
+        }
63 63
         if ($serviceType === 'IMetadataProvider') {
64 64
             if (is_null($this->_wordPressMetadata)) {
65 65
                 $this->_wordPressMetadata = CreateWordPressMetadata::create();
Please login to merge, or discard this patch.
services/WordPress/WordPressMetadata.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 class CreateWordPressMetadata
179 179
 {
180 180
 
181
-	/**
182
-	 * Array holding the mapping between the entity properties and coulmns.
183
-	 * 
184
-	 * @var array
185
-	 */
181
+    /**
182
+     * Array holding the mapping between the entity properties and coulmns.
183
+     * 
184
+     * @var array
185
+     */
186 186
     private static $_entityMapping = array();
187 187
 
188 188
     /**
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
      * @return array(string, array(string, string))
296 296
      */
297 297
     public static function getEntityMapping() {
298
-      if (!is_null(self::$_entityMapping))
299
-      {
298
+        if (!is_null(self::$_entityMapping))
299
+        {
300 300
         self::$_entityMapping = array (
301 301
             'Post' => array (
302 302
                 '$MappedTable$' => 'wp_posts',
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                 'Type' => 'post_type',
323 323
                 'MimeType' => 'post_mime_type',
324 324
                 'CommentCount' => 'comment_count'
325
-              ),
325
+                ),
326 326
           
327 327
             'Tag' => array (
328 328
                 '$MappedTable$' => 'wp_terms',
@@ -369,9 +369,9 @@  discard block
 block discarded – undo
369 369
                 'Status' => 'user_status',
370 370
                 'DisplayName' => 'display_name'
371 371
             )
372
-          );
373
-      }
372
+            );
373
+        }
374 374
       
375
-      return self::$_entityMapping;
375
+        return self::$_entityMapping;
376 376
     }
377 377
 }
Please login to merge, or discard this patch.
services/WordPress/WordPressQueryProvider.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $this->_connectionHandle = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, true);
44 44
         if ( $this->_connectionHandle ) {
45 45
         } else {             
46
-             die(print_r(mysql_error(), true));
46
+                die(print_r(mysql_error(), true));
47 47
         } 
48 48
 
49 49
         mysql_select_db(DB_NAME, $this->_connectionHandle);
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function getExpressionProvider()
66 66
     {
67
-    	if (is_null($this->_wordPressMySQLExpressionProvider)) {
68
-    		$this->_wordPressMySQLExpressionProvider = new WordPressDSExpressionProvider();
69
-    	}
67
+        if (is_null($this->_wordPressMySQLExpressionProvider)) {
68
+            $this->_wordPressMySQLExpressionProvider = new WordPressDSExpressionProvider();
69
+        }
70 70
     	
71
-    	return $this->_wordPressMySQLExpressionProvider;
71
+        return $this->_wordPressMySQLExpressionProvider;
72 72
     }
73 73
     
74 74
     /**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
         switch ($resourceSetName) {
102 102
         case 'Posts':
103 103
             $query = "SELECT * FROM `wp_posts` WHERE"
104
-                   ." wp_posts.post_type = 'post'"
105
-                   ." AND wp_posts.post_status = 'publish'";
104
+                    ." wp_posts.post_type = 'post'"
105
+                    ." AND wp_posts.post_status = 'publish'";
106 106
             if ($filter !== null) {
107 107
                 $query .= " AND $filter";
108 108
             }
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
             break;                   
112 112
         case 'Tags':
113 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'";
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 117
             if ($filter !== null) {
118 118
                 $query .= " AND $filter";
119 119
             }
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
             break;
123 123
         case 'Categories':
124 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'";
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 128
             if ($filter !== null) {
129 129
                 $query .= " AND $filter";
130 130
             }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             break;
134 134
         case 'Comments':
135 135
             $query = "SELECT * FROM `wp_comments` WHERE"
136
-                   ." wp_comments.comment_approved = 1";
136
+                    ." wp_comments.comment_approved = 1";
137 137
             if ($filter !== null) {
138 138
                 $query .= " AND $filter";
139 139
             }
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
         switch ($resourceSetName) {
188 188
         case 'Posts':
189 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];
190
+                    ." wp_posts.post_type = 'post'"
191
+                    ." AND wp_posts.post_status = 'publish'"
192
+                    ." AND wp_posts.ID = ".$namedKeyValues['PostID'][0];
193 193
             $stmt = mysql_query($query);
194 194
               
195 195
             //If resource not found return null to the library
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
             break;
203 203
         case 'Tags':
204 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];
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 209
             $stmt = mysql_query($query);
210 210
               
211 211
             //If resource not found return null to the library
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
             break;
219 219
         case 'Categories':
220 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];
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 225
             $stmt = mysql_query($query);
226 226
               
227 227
             //If resource not found return null to the library
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
             break;
235 235
         case 'Comments':
236 236
             $query = "SELECT * FROM `wp_comments`"
237
-                   ." WHERE comment_approved = 1" 
238
-                   ." AND comment_ID = ".$namedKeyValues['CommentID'][0];
237
+                    ." WHERE comment_approved = 1" 
238
+                    ." AND comment_ID = ".$namedKeyValues['CommentID'][0];
239 239
             $stmt = mysql_query($query);
240 240
               
241 241
             //If resource not found return null to the library
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
         case ($srcClass == 'Post'):
297 297
             if ($navigationPropName == 'Tags') {
298 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)";
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 306
                 if ($filter !== null) {
307 307
                     $query .= " AND $filter";
308 308
                 }
@@ -314,26 +314,26 @@  discard block
 block discarded – undo
314 314
                 $result = $this->_serializeTags($stmt);
315 315
             } elseif ($navigationPropName == 'Categories') {
316 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)";
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 324
                 if ($filter !== null) {
325 325
                     $query .= " AND $filter";
326 326
                 }
327 327
                 $stmt = mysql_query($query);
328 328
                 if ( $stmt === false) {            
329
-                       die(mysql_error());
329
+                        die(mysql_error());
330 330
                 }
331 331
                         
332 332
                 $result = $this->_serializeCategories($stmt);
333 333
             } else if ($navigationPropName == 'Comments') {
334 334
                 $query = "SELECT * FROM `wp_comments`"
335
-                       ." WHERE comment_approved = 1" 
336
-                       ." AND comment_post_ID = $sourceEntityInstance->PostID";
335
+                        ." WHERE comment_approved = 1" 
336
+                        ." AND comment_post_ID = $sourceEntityInstance->PostID";
337 337
                 if ($filter !== null) {
338 338
                     $query .= " AND $filter";
339 339
                 }
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
         case ($srcClass == 'Tag'):
352 352
             if ($navigationPropName == 'Posts') {
353 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'";
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 362
                 if ($filter !== null) {
363 363
                     $query .= " AND $filter";
364 364
                 }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                             die(mysql_error());
368 368
                 }
369 369
                         
370
-                      $result = $this->_serializePosts($stmt);
370
+                        $result = $this->_serializePosts($stmt);
371 371
             } else {
372 372
                 die('Tag does not have navigation porperty with name: ' . $navigationPropName);
373 373
             }
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
         case ($srcClass == 'Category'):
377 377
             if ($navigationPropName == 'Posts') {
378 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'";
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 387
                 if ($filter !== null) {
388 388
                     $query .= " AND $filter";
389 389
                 }
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
         case ($srcClass == 'User'):
406 406
             if ($navigationPropName == 'Posts') {
407 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";
408
+                        ." wp_posts.post_type = 'post'"
409
+                        ." AND wp_posts.post_status = 'publish'"
410
+                        ." AND wp_posts.post_author = $sourceEntityInstance->UserID";
411 411
                 if ($filter !== null) {
412 412
                     $query .= " AND $filter";
413 413
                 }
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
                 $result = $this->_serializePosts($stmt);
420 420
             } elseif ($navigationPropName == 'Comments') {
421 421
                 $query = "SELECT * FROM `wp_comments`"
422
-                     ." WHERE comment_approved = 1" 
423
-                     ." AND wp_comments.user_id = $sourceEntityInstance->UserID";
422
+                        ." WHERE comment_approved = 1" 
423
+                        ." AND wp_comments.user_id = $sourceEntityInstance->UserID";
424 424
                 if ($filter !== null) {
425 425
                     $query .= " AND $filter";
426 426
                 }
@@ -476,33 +476,33 @@  discard block
 block discarded – undo
476 476
         case ($srcClass == 'Post'):
477 477
             if ($navigationPropName == 'Tags') {
478 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];
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 487
                 $stmt = mysql_query($query);
488 488
                 $result = $this->_serializeTags($stmt);
489 489
             } elseif ($navigationPropName == 'Categories') {
490 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];
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 499
                 $stmt = mysql_query($query);
500 500
                 $result = $this->_serializeCategories($stmt);
501 501
             } else if ($navigationPropName == 'Comments') {
502 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];
503
+                        ." WHERE comment_approved = 1" 
504
+                        ." AND comment_post_ID = $sourceEntityInstance->PostID"
505
+                        ." AND comment_ID = ".$namedKeyValues['CommentID'][0];
506 506
                 $stmt = mysql_query($query);
507 507
                 $result = $this->_serializeComments($stmt);
508 508
             } else {
@@ -513,15 +513,15 @@  discard block
 block discarded – undo
513 513
         case ($srcClass == 'Tag'):
514 514
             if ($navigationPropName == 'Posts') {
515 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];
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 525
                 $stmt = mysql_query($query);
526 526
                 $result = $this->_serializePosts($stmt);
527 527
             } else {
@@ -532,15 +532,15 @@  discard block
 block discarded – undo
532 532
         case ($srcClass == 'Category'):
533 533
             if ($navigationPropName == 'Posts') {
534 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];
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 544
                 $stmt = mysql_query($query);
545 545
                 $result = $this->_serializePosts($stmt);
546 546
             } else {
@@ -554,22 +554,22 @@  discard block
 block discarded – undo
554 554
                     
555 555
         case ($srcClass == 'User'):
556 556
             if ($navigationPropName == 'Posts') {
557
-                 $query = "SELECT * FROM `wp_posts` WHERE"
557
+                    $query = "SELECT * FROM `wp_posts` WHERE"
558 558
                         ." wp_posts.post_type = 'post'"
559 559
                         ." AND wp_posts.post_status = 'publish'"
560 560
                         ." AND wp_posts.post_author = $sourceEntityInstance->UserID"
561 561
                         ." AND wp_posts.ID = ".$namedKeyValues['PostID'][0];
562
-                 $stmt = mysql_query($query);
563
-                 $result = $this->_serializePosts($stmt);
562
+                    $stmt = mysql_query($query);
563
+                    $result = $this->_serializePosts($stmt);
564 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);
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 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
         }
@@ -635,9 +635,9 @@  discard block
 block discarded – undo
635 635
                       
636 636
             } elseif ($navigationPropName == 'Post') {
637 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";
638
+                        ." wp_posts.post_type = 'post'"
639
+                        ." AND wp_posts.post_status = 'publish'"
640
+                        ." AND wp_posts.ID = $sourceEntityInstance->PostID";
641 641
                 $stmt = mysql_query($query);
642 642
                 if ( $stmt === false) {            
643 643
                     die(mysql_error());
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
     {
671 671
         $posts = array();
672 672
         while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) {
673
-             $posts[] = $this->_serializePost($record);
673
+                $posts[] = $this->_serializePost($record);
674 674
         }
675 675
 
676 676
         return $posts;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
     {
750 750
         $tags = array();
751 751
         while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) {         
752
-             $tags[] = $this->_serializeTag($record);
752
+                $tags[] = $this->_serializeTag($record);
753 753
         }
754 754
 
755 755
         return $tags;
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
     {
784 784
         $cats = array();
785 785
         while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) {         
786
-             $cats[] = $this->_serializeCategory($record);
786
+                $cats[] = $this->_serializeCategory($record);
787 787
         }
788 788
 
789 789
         return $cats;
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
     {
818 818
         $comments = array();
819 819
         while ( $record = mysql_fetch_array($result, MYSQL_ASSOC)) {         
820
-             $comments[] = $this->_serializeComment($record);
820
+                $comments[] = $this->_serializeComment($record);
821 821
         }
822 822
 
823 823
         return $comments;
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
     {
876 876
         $users = array();
877 877
         while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) {         
878
-             $users[] = $this->_serializeUser($record);
878
+                $users[] = $this->_serializeUser($record);
879 879
         }
880 880
 
881 881
         return $users;
Please login to merge, or discard this patch.
src/POData/BaseService.php 1 patch
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     }
100 100
 
101 101
 
102
-	//TODO: shouldn't we hide this from the interface..if we need it at all.
102
+    //TODO: shouldn't we hide this from the interface..if we need it at all.
103 103
     /**
104 104
      * Get the wrapper over developer's IQueryProvider and IMetadataProvider implementation.
105 105
      * 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function getProvidersWrapper()
109 109
     {
110
-          return $this->providersWrapper;
110
+            return $this->providersWrapper;
111 111
     }
112 112
 
113 113
     /**
@@ -228,33 +228,33 @@  discard block
 block discarded – undo
228 228
         }
229 229
     }
230 230
 
231
-	/**
232
-	 * @return IQueryProvider
233
-	 */
234
-	public abstract function getQueryProvider();
231
+    /**
232
+     * @return IQueryProvider
233
+     */
234
+    public abstract function getQueryProvider();
235 235
 
236
-	/**
237
-	 * @return IMetadataProvider
238
-	 */
239
-	public abstract function getMetadataProvider();
236
+    /**
237
+     * @return IMetadataProvider
238
+     */
239
+    public abstract function getMetadataProvider();
240 240
 
241
-	/**
242
-	 * @return \POData\Providers\Stream\IStreamProvider
243
-	 */
244
-	public abstract function getStreamProviderX();
241
+    /**
242
+     * @return \POData\Providers\Stream\IStreamProvider
243
+     */
244
+    public abstract function getStreamProviderX();
245 245
 
246 246
 
247
-	/** @var  ODataWriterRegistry */
248
-	private $writerRegistry;
247
+    /** @var  ODataWriterRegistry */
248
+    private $writerRegistry;
249 249
 
250
-	/**
251
-	 * Returns the ODataWriterRegistry to use when writing the response to a service document or resource request
252
-	 * @return ODataWriterRegistry
253
-	 */
254
-	public function getODataWriterRegistry()
255
-	{
256
-		return $this->writerRegistry;
257
-	}
250
+    /**
251
+     * Returns the ODataWriterRegistry to use when writing the response to a service document or resource request
252
+     * @return ODataWriterRegistry
253
+     */
254
+    public function getODataWriterRegistry()
255
+    {
256
+        return $this->writerRegistry;
257
+    }
258 258
 
259 259
 
260 260
     /**
@@ -300,32 +300,32 @@  discard block
 block discarded – undo
300 300
         
301 301
         $this->initialize($this->config);
302 302
 
303
-	    //TODO: this seems like a bad spot to do this
304
-	    $this->writerRegistry = new ODataWriterRegistry();
305
-	    $this->registerWriters();
303
+        //TODO: this seems like a bad spot to do this
304
+        $this->writerRegistry = new ODataWriterRegistry();
305
+        $this->registerWriters();
306 306
     }
307 307
 
308
-	//TODO: i don't want this to be public..but it's the only way to test it right now...
309
-	public function registerWriters()
310
-	{
311
-		$registry = $this->getODataWriterRegistry();
312
-		$serviceVersion = $this->getConfiguration()->getMaxDataServiceVersion();
313
-		$serviceURI = $this->getHost()->getAbsoluteServiceUri()->getUrlAsString();
308
+    //TODO: i don't want this to be public..but it's the only way to test it right now...
309
+    public function registerWriters()
310
+    {
311
+        $registry = $this->getODataWriterRegistry();
312
+        $serviceVersion = $this->getConfiguration()->getMaxDataServiceVersion();
313
+        $serviceURI = $this->getHost()->getAbsoluteServiceUri()->getUrlAsString();
314 314
 
315
-		//We always register the v1 stuff
316
-		$registry->register(new JsonODataV1Writer());
317
-		$registry->register(new AtomODataWriter($serviceURI));
315
+        //We always register the v1 stuff
316
+        $registry->register(new JsonODataV1Writer());
317
+        $registry->register(new AtomODataWriter($serviceURI));
318 318
 
319
-		if($serviceVersion->compare(Version::v2()) > -1){
320
-			$registry->register(new JsonODataV2Writer());
321
-		}
319
+        if($serviceVersion->compare(Version::v2()) > -1){
320
+            $registry->register(new JsonODataV2Writer());
321
+        }
322 322
 
323
-		if($serviceVersion->compare(Version::v3()) > -1){
324
-			$registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::NONE(), $serviceURI));
325
-			$registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::MINIMAL(), $serviceURI));
326
-			$registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::FULL(), $serviceURI));
327
-		}
328
-	}
323
+        if($serviceVersion->compare(Version::v3()) > -1){
324
+            $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::NONE(), $serviceURI));
325
+            $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::MINIMAL(), $serviceURI));
326
+            $registry->register(new JsonLightODataWriter(JsonLightMetadataLevel::FULL(), $serviceURI));
327
+        }
328
+    }
329 329
 
330 330
     /**
331 331
      * Serialize the requested resource.
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 
350 350
         $responseContentType = self::getResponseContentType($request, $uriProcessor, $this);
351 351
 
352
-	    if (is_null($responseContentType) && $request->getTargetKind() != TargetKind::MEDIA_RESOURCE()) {
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 );
355
-	    }
352
+        if (is_null($responseContentType) && $request->getTargetKind() != TargetKind::MEDIA_RESOURCE()) {
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 );
355
+        }
356 356
 
357
-	    $odataModelInstance = null;
357
+        $odataModelInstance = null;
358 358
         $hasResponseBody = true;
359 359
         // Execution required at this point if request target to any resource other than
360 360
         //
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
                     // In the query 'Orders(1245)/$links/Customer', the targeted
396 396
                     // Customer might be null
397 397
                     if (is_null($result)) {
398
-						throw ODataException::createResourceNotFoundError(
398
+                        throw ODataException::createResourceNotFoundError(
399 399
                             $request->getIdentifier()
400 400
                         );
401 401
                     }
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                     if (!is_null($this->_serviceHost->getRequestIfMatch())
406 406
                         && !is_null($this->_serviceHost->getRequestIfNoneMatch())
407 407
                     ) {
408
-						throw ODataException::createBadRequestError(
408
+                        throw ODataException::createBadRequestError(
409 409
                             Messages::bothIfMatchAndIfNoneMatchHeaderSpecified()
410 410
                         );
411 411
                     }
@@ -441,22 +441,22 @@  discard block
 block discarded – undo
441 441
                     }
442 442
                 } else if ($requestTargetKind == TargetKind::COMPLEX_OBJECT()) {
443 443
 
444
-	                $odataModelInstance = $objectModelSerializer->writeTopLevelComplexObject(
444
+                    $odataModelInstance = $objectModelSerializer->writeTopLevelComplexObject(
445 445
                         $result, 
446 446
                         $request->getProjectedProperty()->getName(),
447
-	                    $request->getTargetResourceType()
448
-	                );
447
+                        $request->getTargetResourceType()
448
+                    );
449 449
                 } else if ($requestTargetKind == TargetKind::BAG()) {
450 450
                     $odataModelInstance = $objectModelSerializer->writeTopLevelBagObject(
451 451
                         $result, 
452 452
                         $request->getProjectedProperty()->getName(),
453
-	                    $request->getTargetResourceType(),
453
+                        $request->getTargetResourceType(),
454 454
                         $odataModelInstance
455 455
                     );
456 456
                 } else if ($requestTargetKind == TargetKind::PRIMITIVE()) {
457 457
                     $odataModelInstance = $objectModelSerializer->writeTopLevelPrimitive(
458 458
                         $result,
459
-	                    $request->getProjectedProperty(),
459
+                        $request->getProjectedProperty(),
460 460
                         $odataModelInstance
461 461
                     );
462 462
                 } else if ($requestTargetKind == TargetKind::PRIMITIVE_VALUE()) {
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
         //Note: Response content type can be null for named stream
475 475
         if ($hasResponseBody && !is_null($responseContentType)) {
476 476
             if ($request->getTargetKind() != TargetKind::MEDIA_RESOURCE() && $responseContentType != MimeTypes::MIME_APPLICATION_OCTETSTREAM) {
477
-	            //append charset for everything except:
478
-	            //stream resources as they have their own content type
479
-	            //binary properties (they content type will be App Octet for those...is this a good way? we could also decide based upon the projected property
480
-	            //
477
+                //append charset for everything except:
478
+                //stream resources as they have their own content type
479
+                //binary properties (they content type will be App Octet for those...is this a good way? we could also decide based upon the projected property
480
+                //
481 481
                 $responseContentType .= ';charset=utf-8';
482 482
             }
483 483
         }
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      * @throws ODataException, HttpHeaderFailure
506 506
      */
507 507
     public static function getResponseContentType(
508
-	    RequestDescription $request,
508
+        RequestDescription $request,
509 509
         UriProcessor $uriProcessor,
510 510
         IService $service
511 511
     ) {
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
         // The Accept request-header field specifies media types which are acceptable for the response
514 514
 
515 515
         $host = $service->getHost();
516
-	    $requestAcceptText = $host->getRequestAccept();
516
+        $requestAcceptText = $host->getRequestAccept();
517 517
         $requestVersion = $request->getResponseVersion();
518 518
 
519
-	    //if the $format header is present it overrides the accepts header
520
-	    $format = $host->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FORMAT);
521
-	    if(!is_null($format)){
519
+        //if the $format header is present it overrides the accepts header
520
+        $format = $host->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_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 524
             if($format == MimeTypes::MIME_APPLICATION_JSON && $requestVersion == Version::v3()){
@@ -527,127 +527,127 @@  discard block
 block discarded – undo
527 527
                 $format = MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META;
528 528
             }
529 529
 
530
-		    $requestAcceptText = ServiceHost::translateFormatToMime($requestVersion, $format);
531
-	    }
530
+            $requestAcceptText = ServiceHost::translateFormatToMime($requestVersion, $format);
531
+        }
532 532
 
533 533
 
534 534
 
535 535
 
536
-	    //The response format can be dictated by the target resource kind. IE a $value will be different then expected
537
-	    //getTargetKind doesn't deal with link resources directly and this can change things
538
-	    $targetKind = $request->isLinkUri() ? TargetKind::LINK() : $request->getTargetKind();
536
+        //The response format can be dictated by the target resource kind. IE a $value will be different then expected
537
+        //getTargetKind doesn't deal with link resources directly and this can change things
538
+        $targetKind = $request->isLinkUri() ? TargetKind::LINK() : $request->getTargetKind();
539 539
 
540
-	    switch($targetKind){
541
-		    case TargetKind::METADATA():
542
-			    return HttpProcessUtility::selectMimeType(
543
-				    $requestAcceptText,
544
-				    array(MimeTypes::MIME_APPLICATION_XML)
545
-			    );
540
+        switch($targetKind){
541
+            case TargetKind::METADATA():
542
+                return HttpProcessUtility::selectMimeType(
543
+                    $requestAcceptText,
544
+                    array(MimeTypes::MIME_APPLICATION_XML)
545
+                );
546 546
 
547
-		    case TargetKind::SERVICE_DIRECTORY():
548
-			    return HttpProcessUtility::selectMimeType(
549
-				    $requestAcceptText,
550
-				    array(
551
-					    MimeTypes::MIME_APPLICATION_XML,
552
-					    MimeTypes::MIME_APPLICATION_ATOMSERVICE,
553
-					    MimeTypes::MIME_APPLICATION_JSON,
547
+            case TargetKind::SERVICE_DIRECTORY():
548
+                return HttpProcessUtility::selectMimeType(
549
+                    $requestAcceptText,
550
+                    array(
551
+                        MimeTypes::MIME_APPLICATION_XML,
552
+                        MimeTypes::MIME_APPLICATION_ATOMSERVICE,
553
+                        MimeTypes::MIME_APPLICATION_JSON,
554 554
                         MimeTypes::MIME_APPLICATION_JSON_FULL_META,
555 555
                         MimeTypes::MIME_APPLICATION_JSON_NO_META,
556 556
                         MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META,
557
-					    MimeTypes::MIME_APPLICATION_JSON_VERBOSE,
557
+                        MimeTypes::MIME_APPLICATION_JSON_VERBOSE,
558 558
 
559 559
                     )
560
-			    );
561
-
562
-		    case TargetKind::PRIMITIVE_VALUE():
563
-			    $supportedResponseMimeTypes = array(MimeTypes::MIME_TEXTPLAIN);
564
-
565
-			    if ($request->getIdentifier() != '$count') {
566
-				    $projectedProperty = $request->getProjectedProperty();
567
-				    self::assert(
568
-					    !is_null($projectedProperty),
569
-					    '!is_null($projectedProperty)'
570
-				    );
571
-				    $type = $projectedProperty->getInstanceType();
572
-				    self::assert(
573
-					    !is_null($type) && $type instanceof IType,
574
-					    '!is_null($type) && $type instanceof IType'
575
-				    );
576
-				    if ($type instanceof Binary) {
577
-					    $supportedResponseMimeTypes = array(MimeTypes::MIME_APPLICATION_OCTETSTREAM);
578
-				    }
579
-			    }
580
-
581
-			    return HttpProcessUtility::selectMimeType(
582
-				    $requestAcceptText,
583
-				    $supportedResponseMimeTypes
584
-			    );
585
-
586
-		    case TargetKind::PRIMITIVE():
587
-		    case TargetKind::COMPLEX_OBJECT():
588
-		    case TargetKind::BAG():
589
-		    case TargetKind::LINK():
590
-			    return HttpProcessUtility::selectMimeType(
591
-				    $requestAcceptText,
592
-				    array(
593
-					    MimeTypes::MIME_APPLICATION_XML,
594
-					    MimeTypes::MIME_TEXTXML,
595
-					    MimeTypes::MIME_APPLICATION_JSON,
560
+                );
561
+
562
+            case TargetKind::PRIMITIVE_VALUE():
563
+                $supportedResponseMimeTypes = array(MimeTypes::MIME_TEXTPLAIN);
564
+
565
+                if ($request->getIdentifier() != '$count') {
566
+                    $projectedProperty = $request->getProjectedProperty();
567
+                    self::assert(
568
+                        !is_null($projectedProperty),
569
+                        '!is_null($projectedProperty)'
570
+                    );
571
+                    $type = $projectedProperty->getInstanceType();
572
+                    self::assert(
573
+                        !is_null($type) && $type instanceof IType,
574
+                        '!is_null($type) && $type instanceof IType'
575
+                    );
576
+                    if ($type instanceof Binary) {
577
+                        $supportedResponseMimeTypes = array(MimeTypes::MIME_APPLICATION_OCTETSTREAM);
578
+                    }
579
+                }
580
+
581
+                return HttpProcessUtility::selectMimeType(
582
+                    $requestAcceptText,
583
+                    $supportedResponseMimeTypes
584
+                );
585
+
586
+            case TargetKind::PRIMITIVE():
587
+            case TargetKind::COMPLEX_OBJECT():
588
+            case TargetKind::BAG():
589
+            case TargetKind::LINK():
590
+                return HttpProcessUtility::selectMimeType(
591
+                    $requestAcceptText,
592
+                    array(
593
+                        MimeTypes::MIME_APPLICATION_XML,
594
+                        MimeTypes::MIME_TEXTXML,
595
+                        MimeTypes::MIME_APPLICATION_JSON,
596 596
                         MimeTypes::MIME_APPLICATION_JSON_FULL_META,
597 597
                         MimeTypes::MIME_APPLICATION_JSON_NO_META,
598 598
                         MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META,
599
-					    MimeTypes::MIME_APPLICATION_JSON_VERBOSE,
600
-				    )
601
-			    );
602
-
603
-		    case TargetKind::RESOURCE():
604
-			    return HttpProcessUtility::selectMimeType(
605
-				    $requestAcceptText,
606
-				    array(
607
-					    MimeTypes::MIME_APPLICATION_ATOM,
608
-					    MimeTypes::MIME_APPLICATION_JSON,
599
+                        MimeTypes::MIME_APPLICATION_JSON_VERBOSE,
600
+                    )
601
+                );
602
+
603
+            case TargetKind::RESOURCE():
604
+                return HttpProcessUtility::selectMimeType(
605
+                    $requestAcceptText,
606
+                    array(
607
+                        MimeTypes::MIME_APPLICATION_ATOM,
608
+                        MimeTypes::MIME_APPLICATION_JSON,
609 609
                         MimeTypes::MIME_APPLICATION_JSON_FULL_META,
610 610
                         MimeTypes::MIME_APPLICATION_JSON_NO_META,
611 611
                         MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META,
612
-					    MimeTypes::MIME_APPLICATION_JSON_VERBOSE,
613
-				    )
614
-			    );
615
-
616
-		    case TargetKind::MEDIA_RESOURCE():
617
-			    if (!$request->isNamedStream() && !$request->getTargetResourceType()->isMediaLinkEntry()){
618
-					throw ODataException::createBadRequestError(
619
-					    Messages::badRequestInvalidUriForMediaResource(
620
-						    $host->getAbsoluteRequestUri()->getUrlAsString()
621
-					    )
622
-				    );
623
-			    }
624
-
625
-			    $uriProcessor->execute();
626
-			    $request->setExecuted();
627
-			    // DSSW::getStreamContentType can throw error in 2 cases
628
-			    // 1. If the required stream implementation not found
629
-			    // 2. If IDSSP::getStreamContentType returns NULL for MLE
630
-			    $responseContentType = $service->getStreamProviderWrapper()
631
-				    ->getStreamContentType(
632
-					    $request->getTargetResult(),
633
-					    $request->getResourceStreamInfo()
634
-				    );
635
-
636
-
637
-			    // Note StreamWrapper::getStreamContentType can return NULL if the requested named stream has not
638
-			    // yet been uploaded. But for an MLE if IDSSP::getStreamContentType returns NULL then StreamWrapper will throw error
639
-			    if (!is_null($responseContentType)) {
640
-				    $responseContentType = HttpProcessUtility::selectMimeType(
641
-					    $requestAcceptText,
642
-					    array($responseContentType)
643
-				    );
644
-			    }
645
-
646
-			    return $responseContentType;
647
-	    }
648
-
649
-
650
-	    //If we got here, we just don't know what it is...
612
+                        MimeTypes::MIME_APPLICATION_JSON_VERBOSE,
613
+                    )
614
+                );
615
+
616
+            case TargetKind::MEDIA_RESOURCE():
617
+                if (!$request->isNamedStream() && !$request->getTargetResourceType()->isMediaLinkEntry()){
618
+                    throw ODataException::createBadRequestError(
619
+                        Messages::badRequestInvalidUriForMediaResource(
620
+                            $host->getAbsoluteRequestUri()->getUrlAsString()
621
+                        )
622
+                    );
623
+                }
624
+
625
+                $uriProcessor->execute();
626
+                $request->setExecuted();
627
+                // DSSW::getStreamContentType can throw error in 2 cases
628
+                // 1. If the required stream implementation not found
629
+                // 2. If IDSSP::getStreamContentType returns NULL for MLE
630
+                $responseContentType = $service->getStreamProviderWrapper()
631
+                    ->getStreamContentType(
632
+                        $request->getTargetResult(),
633
+                        $request->getResourceStreamInfo()
634
+                    );
635
+
636
+
637
+                // Note StreamWrapper::getStreamContentType can return NULL if the requested named stream has not
638
+                // yet been uploaded. But for an MLE if IDSSP::getStreamContentType returns NULL then StreamWrapper will throw error
639
+                if (!is_null($responseContentType)) {
640
+                    $responseContentType = HttpProcessUtility::selectMimeType(
641
+                        $requestAcceptText,
642
+                        array($responseContentType)
643
+                    );
644
+                }
645
+
646
+                return $responseContentType;
647
+        }
648
+
649
+
650
+        //If we got here, we just don't know what it is...
651 651
         throw new ODataException( Messages::unsupportedMediaType(), 415 );
652 652
 
653 653
     }
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
         if ($this->config->getValidateETagHeader() && !$resourceType->hasETagProperties()) {
690 690
             if (!is_null($ifMatch) || !is_null($ifNoneMatch)) {
691 691
                 // No eTag properties but request has eTag headers, bad request
692
-				throw ODataException::createBadRequestError(
692
+                throw ODataException::createBadRequestError(
693 693
                     Messages::noETagPropertiesForType()
694 694
                 );
695 695
             }
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
             $value = null; 
777 777
             try {
778 778
 
779
-	            //TODO #88...also this seems like dupe work
779
+                //TODO #88...also this seems like dupe work
780 780
                 $reflectionProperty  = new \ReflectionProperty($entryObject, $eTagProperty->getName() );
781 781
                 $value = $reflectionProperty->getValue($entryObject);
782 782
             } catch (\ReflectionException $reflectionException) {
Please login to merge, or discard this patch.