Completed
Push — master ( 7e191b...5fbcda )
by Nikolay
03:00
created
src/POData/OperationContext/ServiceHost.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function __construct(IOperationContext $context = null)
88 88
     {
89
-        if(is_null($context)){
89
+        if (is_null($context)) {
90 90
 	        $this->_operationContext = new WebOperationContext();
91 91
         } else {
92 92
 	        $this->_operationContext = $context;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $isAbsoluteServiceUri = (strpos($serviceUri, 'http://') === 0)
163 163
                 || (strpos($serviceUri, 'https://') === 0);
164 164
             try {
165
-                $this->_absoluteServiceUri = new Url($serviceUri, $isAbsoluteServiceUri );
165
+                $this->_absoluteServiceUri = new Url($serviceUri, $isAbsoluteServiceUri);
166 166
             } catch (UrlFormatException $exception) {
167 167
                 throw ODataException::createInternalServerError(Messages::hostMalFormedBaseUriInConfig());
168 168
             }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 // Find index of segment in the request uri that end with .svc
185 185
                 // There will be always a .svc segment in the request uri otherwise
186 186
                 // uri redirection will not happen.
187
-                for (; $i >=0; $i--) {
187
+                for (; $i >= 0; $i--) {
188 188
                     $endsWithSvc = (substr_compare($requestUriSegments[$i], '.svc', -strlen('.svc'), strlen('.svc')) === 0);
189 189
                     if ($endsWithSvc) {
190 190
                         break;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                     . $this->_absoluteRequestUri->getPort();
223 223
 
224 224
                 for ($l = 0; $l <= $k; $l++) {
225
-                    $serviceUri .= '/' . $requestUriSegments[$l];
225
+                    $serviceUri .= '/'.$requestUriSegments[$l];
226 226
                 }
227 227
                 
228 228
                 $this->_absoluteServiceUri = new Url($serviceUri);
@@ -552,18 +552,18 @@  discard block
 block discarded – undo
552 552
      */
553 553
     public function setResponseStatusCode($value)
554 554
     {
555
-        $floor = floor($value / 100);
555
+        $floor = floor($value/100);
556 556
         if ($floor >= 1 && $floor <= 5) {
557 557
             $statusDescription = HttpStatus::getStatusDescription($value);
558 558
             if (!is_null($statusDescription)) {
559
-                $statusDescription = ' ' . $statusDescription;
559
+                $statusDescription = ' '.$statusDescription;
560 560
             }
561 561
 
562 562
             $this->_operationContext
563
-                ->outgoingResponse()->setStatusCode($value . $statusDescription);
563
+                ->outgoingResponse()->setStatusCode($value.$statusDescription);
564 564
         } else {
565 565
             throw ODataException::createInternalServerError(
566
-                'Invalid Status Code' . $value
566
+                'Invalid Status Code'.$value
567 567
             );
568 568
         }
569 569
     }
@@ -635,37 +635,37 @@  discard block
 block discarded – undo
635 635
 	 * @param string $format the short $format form
636 636
 	 * @return string the full mime type corresponding to the short format form for the given version
637 637
 	 */
638
-	public static function translateFormatToMime(Version $responseVersion, $format){
638
+	public static function translateFormatToMime(Version $responseVersion, $format) {
639 639
         //TODO: should the version switches be off of the requestVersion, not the response version? see #91
640 640
 
641
-        switch($format) {
641
+        switch ($format) {
642 642
 
643 643
 	        case ODataConstants::FORMAT_XML:
644 644
 		        $format = MimeTypes::MIME_APPLICATION_XML;
645 645
 		        break;
646 646
 
647 647
             case ODataConstants::FORMAT_ATOM:
648
-	            $format = MimeTypes::MIME_APPLICATION_ATOM ;
648
+	            $format = MimeTypes::MIME_APPLICATION_ATOM;
649 649
 		        break;
650 650
 
651 651
             case ODataConstants::FORMAT_VERBOSE_JSON:
652
-                if($responseVersion == Version::v3()){
652
+                if ($responseVersion == Version::v3()) {
653 653
 	                //only translatable in 3.0 systems
654 654
 	                $format = MimeTypes::MIME_APPLICATION_JSON_VERBOSE;
655 655
                 }
656 656
                 break;
657 657
 
658 658
             case ODataConstants::FORMAT_JSON:
659
-                if($responseVersion == Version::v3()){
659
+                if ($responseVersion == Version::v3()) {
660 660
                     $format = MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META;
661
-                } else{
661
+                } else {
662 662
 	                $format = MimeTypes::MIME_APPLICATION_JSON;
663 663
                 }
664 664
 		        break;
665 665
 
666 666
         }
667 667
 
668
-	    return $format . ';q=1.0';
668
+	    return $format.';q=1.0';
669 669
     }
670 670
 
671 671
 
Please login to merge, or discard this patch.
src/POData/OperationContext/Web/IncomingRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * 
30 30
      * @var string
31 31
      */
32
-    private $_rawUrl  = null;
32
+    private $_rawUrl = null;
33 33
     
34 34
 
35 35
     /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                     $isNamedOptions = count($result) == 2;
196 196
                     if ($isNamedOptions) {
197 197
                         $this->_queryOptions[]
198
-                            = array (rawurldecode($result[0]) => trim(rawurldecode($result[1])));
198
+                            = array(rawurldecode($result[0]) => trim(rawurldecode($result[1])));
199 199
                     } else {
200 200
                         $this->_queryOptions[]
201 201
                             = array(null => trim(rawurldecode($result[0])));
Please login to merge, or discard this patch.
src/POData/Providers/Expression/MySQLExpressionProvider.php 1 patch
Spacing   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     const MULTIPLY              = '*';
32 32
     const NEGATE                = '-';
33 33
     const NOT_EQUAL             = '!=';
34
-    const OPEN_BRACKET           = '(';
34
+    const OPEN_BRACKET = '(';
35 35
     
36 36
     /**
37 37
      * The type of the resource pointed by the resource path segment
@@ -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
 
@@ -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
 
@@ -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::GREATER_THAN, $left, $right);
145 145
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function onUnaryExpression($expressionType, $child)
175 175
     {
176
-        switch($expressionType) {
176
+        switch ($expressionType) {
177 177
 	        case ExpressionType::NEGATE:
178 178
 	            return $this->_prepareUnaryExpression(self::NEGATE, $child);
179 179
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     public function onFunctionCallExpression($functionDescription, $params)
241 241
     {
242
-        switch($functionDescription->name) {
242
+        switch ($functionDescription->name) {
243 243
 	        case ODataConstants::STRFUN_COMPARE:
244 244
 	            return "STRCMP($params[0], $params[1])";
245 245
 
@@ -266,8 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 	        case ODataConstants::STRFUN_SUBSTRING:
268 268
 	            return count($params) == 3 ?
269
-	                "SUBSTRING($params[0], $params[1] + 1, $params[2])" :
270
-	                "SUBSTRING($params[0], $params[1] + 1)";
269
+	                "SUBSTRING($params[0], $params[1] + 1, $params[2])" : "SUBSTRING($params[0], $params[1] + 1)";
271 270
 
272 271
 	        case ODataConstants::STRFUN_SUBSTRINGOF:
273 272
 	            return "(LOCATE($params[0], $params[1]) > 0)";
@@ -338,11 +337,11 @@  discard block
 block discarded – undo
338 337
     		$str = explode(';', $left, 2);
339 338
     		$str[0] = str_replace('DATETIMECMP', '', $str[0]);
340 339
     		return self::OPEN_BRACKET
341
-    			. $str[0] . ' ' . $operator
342
-    			. ' ' . $str[1] . self::CLOSE_BRACKET;
340
+    			. $str[0].' '.$operator
341
+    			. ' '.$str[1].self::CLOSE_BRACKET;
343 342
     	}
344 343
 
345
-        return self::OPEN_BRACKET . $left . ' ' . $operator . ' ' . $right . self::CLOSE_BRACKET;
344
+        return self::OPEN_BRACKET.$left.' '.$operator.' '.$right.self::CLOSE_BRACKET;
346 345
     }
347 346
 
348 347
     /**
@@ -355,6 +354,6 @@  discard block
 block discarded – undo
355 354
      */
356 355
     private function _prepareUnaryExpression($operator, $child)
357 356
     {
358
-        return $operator . self::OPEN_BRACKET . $child . self::CLOSE_BRACKET;
357
+        return $operator.self::OPEN_BRACKET.$child.self::CLOSE_BRACKET;
359 358
     }
360 359
 }
361 360
\ No newline at end of file
Please login to merge, or discard this patch.
src/POData/Providers/Expression/PHPExpressionProvider.php 1 patch
Spacing   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function onLogicalExpression($expressionType, $left, $right)
96 96
     {
97
-        switch($expressionType) {
97
+        switch ($expressionType) {
98 98
 	        case ExpressionType::AND_LOGICAL:
99 99
 	            return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
100 100
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function onArithmeticExpression($expressionType, $left, $right)
119 119
     {
120
-        switch($expressionType) {
120
+        switch ($expressionType) {
121 121
 	        case ExpressionType::MULTIPLY:
122 122
 	            return $this->_prepareBinaryExpression(self::MULTIPLY, $left, $right);
123 123
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function onRelationalExpression($expressionType, $left, $right)
151 151
     {
152
-        switch($expressionType) {
152
+        switch ($expressionType) {
153 153
 	        case ExpressionType::GREATERTHAN:
154 154
 	            return $this->_prepareBinaryExpression(self::GREATER_THAN, $left, $right);
155 155
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function onUnaryExpression($expressionType, $child)
185 185
     {
186
-        switch($expressionType) {
186
+        switch ($expressionType) {
187 187
 	        case ExpressionType::NEGATE:
188 188
 	            return $this->_prepareUnaryExpression(self::NEGATE, $child);
189 189
 
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
         $variable = null;
228 228
         
229 229
         do {
230
-            $variable = $parent->getResourceProperty()->getName() . self::MEMBER_ACCESS . $variable;
230
+            $variable = $parent->getResourceProperty()->getName().self::MEMBER_ACCESS.$variable;
231 231
             $parent = $parent->getParent();
232 232
         } while ($parent != null);
233 233
  
234 234
         $variable = rtrim($variable, self::MEMBER_ACCESS);
235
-        $variable = $this->getIteratorName() . self::MEMBER_ACCESS . $variable;
235
+        $variable = $this->getIteratorName().self::MEMBER_ACCESS.$variable;
236 236
         return $variable;
237 237
     }
238 238
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function onFunctionCallExpression($functionDescription, $params)
248 248
     {
249
-        switch($functionDescription->name) {
249
+        switch ($functionDescription->name) {
250 250
 	        case ODataConstants::STRFUN_COMPARE:
251 251
 	            return "strcmp($params[0], $params[1])";
252 252
 
@@ -273,41 +273,40 @@  discard block
 block discarded – undo
273 273
 
274 274
 	        case ODataConstants::STRFUN_SUBSTRING:
275 275
 	            return count($params) == 3 ?
276
-	                "substr($params[0], $params[1], $params[2])" :
277
-	                "substr($params[0], $params[1])";
276
+	                "substr($params[0], $params[1], $params[2])" : "substr($params[0], $params[1])";
278 277
 
279 278
 	        case ODataConstants::STRFUN_SUBSTRINGOF:
280 279
 	            return "(strpos($params[1], $params[0]) !== false)";
281 280
 
282 281
 	        case ODataConstants::STRFUN_CONCAT:
283
-	            return $params[0] . ' . ' . $params[1];
282
+	            return $params[0].' . '.$params[1];
284 283
 
285 284
 	        case ODataConstants::STRFUN_LENGTH:
286 285
 	            return "strlen($params[0])";
287 286
 
288 287
 	        case ODataConstants::GUIDFUN_EQUAL:
289
-	            return self::TYPE_NAMESPACE . "Guid::guidEqual($params[0], $params[1])";
288
+	            return self::TYPE_NAMESPACE."Guid::guidEqual($params[0], $params[1])";
290 289
 
291 290
 	        case ODataConstants::DATETIME_COMPARE:
292
-	            return self::TYPE_NAMESPACE . "DateTime::dateTimeCmp($params[0], $params[1])";
291
+	            return self::TYPE_NAMESPACE."DateTime::dateTimeCmp($params[0], $params[1])";
293 292
 
294 293
 	        case ODataConstants::DATETIME_YEAR:
295
-	            return self::TYPE_NAMESPACE . "DateTime::year($params[0])";
294
+	            return self::TYPE_NAMESPACE."DateTime::year($params[0])";
296 295
 
297 296
 	        case ODataConstants::DATETIME_MONTH:
298
-	            return self::TYPE_NAMESPACE . "DateTime::month($params[0])";
297
+	            return self::TYPE_NAMESPACE."DateTime::month($params[0])";
299 298
 
300 299
 	        case ODataConstants::DATETIME_DAY:
301
-	            return self::TYPE_NAMESPACE . "DateTime::day($params[0])";
300
+	            return self::TYPE_NAMESPACE."DateTime::day($params[0])";
302 301
 
303 302
 	        case ODataConstants::DATETIME_HOUR:
304
-	            return self::TYPE_NAMESPACE . "DateTime::hour($params[0])";
303
+	            return self::TYPE_NAMESPACE."DateTime::hour($params[0])";
305 304
 
306 305
 	        case ODataConstants::DATETIME_MINUTE:
307
-	            return self::TYPE_NAMESPACE . "DateTime::minute($params[0])";
306
+	            return self::TYPE_NAMESPACE."DateTime::minute($params[0])";
308 307
 
309 308
 	        case ODataConstants::DATETIME_SECOND:
310
-	            return self::TYPE_NAMESPACE . "DateTime::second($params[0])";
309
+	            return self::TYPE_NAMESPACE."DateTime::second($params[0])";
311 310
 
312 311
 	        case ODataConstants::MATHFUN_ROUND:
313 312
 	            return "round($params[0])";
@@ -319,7 +318,7 @@  discard block
 block discarded – undo
319 318
 	            return "floor($params[0])";
320 319
 
321 320
 	        case ODataConstants::BINFUL_EQUAL:
322
-	            return self::TYPE_NAMESPACE . "Binary::binaryEqual($params[0], $params[1])";
321
+	            return self::TYPE_NAMESPACE."Binary::binaryEqual($params[0], $params[1])";
323 322
 
324 323
 	        case 'is_null':
325 324
 	            return "is_null($params[0])";
@@ -341,7 +340,7 @@  discard block
 block discarded – undo
341 340
     private function _prepareBinaryExpression($operator, $left, $right)
342 341
     {
343 342
         return 
344
-            self::OPEN_BRACKET . $left . ' ' . $operator . ' ' . $right . self::CLOSE_BRACKET;
343
+            self::OPEN_BRACKET.$left.' '.$operator.' '.$right.self::CLOSE_BRACKET;
345 344
     }
346 345
 
347 346
     /**
@@ -354,6 +353,6 @@  discard block
 block discarded – undo
354 353
      */
355 354
     private function _prepareUnaryExpression($operator, $child)
356 355
     {
357
-        return $operator . self::OPEN_BRACKET . $child . self::CLOSE_BRACKET;
356
+        return $operator.self::OPEN_BRACKET.$child.self::CLOSE_BRACKET;
358 357
     }
359 358
 }
360 359
\ No newline at end of file
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/ResourceAssociationType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     ) {
49 49
         $this->_name = $name;
50 50
         $this->_fullName = !is_null($namespaceName) 
51
-                          ? $namespaceName . '.' . $name : $name;
51
+                          ? $namespaceName.'.'.$name : $name;
52 52
         $this->_end1 = $end1;
53 53
         $this->_end2 = $end2;
54 54
     }
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/ResourceProperty.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@
 block discarded – undo
176 176
             $kind != ResourcePropertyKind::RESOURCESET_REFERENCE &&
177 177
             $kind != ResourcePropertyKind::COMPLEX_TYPE &&
178 178
             ($kind != (ResourcePropertyKind::COMPLEX_TYPE | ResourcePropertyKind::BAG)) &&
179
-            $kind  != ResourcePropertyKind::PRIMITIVE &&
179
+            $kind != ResourcePropertyKind::PRIMITIVE &&
180 180
             ($kind != (ResourcePropertyKind::PRIMITIVE | ResourcePropertyKind::BAG)) &&
181 181
             ($kind != (ResourcePropertyKind::PRIMITIVE | ResourcePropertyKind::KEY)) &&
182 182
             ($kind != (ResourcePropertyKind::PRIMITIVE | ResourcePropertyKind::ETAG)));
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/ResourceType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         $this->_baseType = $baseType;        
234 234
         $this->_namespaceName = $namespaceName; 
235 235
         $this->_fullName 
236
-            = is_null($namespaceName) ? $name : $namespaceName . '.' . $name;
236
+            = is_null($namespaceName) ? $name : $namespaceName.'.'.$name;
237 237
         $this->_abstractType = $isAbstract;
238 238
         $this->_isMediaLinkEntry = false;
239 239
         $this->_customState = null;
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
      */
826 826
     public static function getPrimitiveResourceType($typeCode)
827 827
     {
828
-        switch($typeCode) {
828
+        switch ($typeCode) {
829 829
         case EdmPrimitiveType::BINARY:
830 830
             return new ResourceType(
831 831
                 new Binary(), ResourceTypeKind::PRIMITIVE, 
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/SimpleMetadataProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
         
163 163
         $targetResourceSet = $targetResourceProperty->getResourceType()->getCustomState();
164 164
         if (is_null($targetResourceSet)) {
165
-            throw new InvalidOperationException('Failed to retrieve the custom state from ' . $targetResourceProperty->getResourceType()->getName());
165
+            throw new InvalidOperationException('Failed to retrieve the custom state from '.$targetResourceProperty->getResourceType()->getName());
166 166
         }
167 167
 
168 168
         //Customer_Orders_Orders, Order_Customer_Customers
169
-        $key = $sourceResourceType->getName() . '_' . $targetResourceProperty->getName() . '_' . $targetResourceSet->getName();
169
+        $key = $sourceResourceType->getName().'_'.$targetResourceProperty->getName().'_'.$targetResourceSet->getName();
170 170
         if (array_key_exists($key, $this->associationSets)) {
171 171
             return $this->associationSets[$key];
172 172
         }
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
             throw new InvalidOperationException('Only primitve property can be etag property, bag property cannot be etag property');
413 413
         }
414 414
 
415
-        $kind = $isKey ?  ResourcePropertyKind::PRIMITIVE | ResourcePropertyKind::KEY : ResourcePropertyKind::PRIMITIVE;
415
+        $kind = $isKey ? ResourcePropertyKind::PRIMITIVE | ResourcePropertyKind::KEY : ResourcePropertyKind::PRIMITIVE;
416 416
         if ($isBag) {    	   
417 417
             $kind = $kind | ResourcePropertyKind::BAG;
418 418
         }
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
         //Create instance of AssociationSet for this relationship        
475 475
         $sourceResourceSet = $resourceType->getCustomState();
476 476
         if (is_null($sourceResourceSet)) {
477
-            throw new InvalidOperationException('Failed to retrieve the custom state from ' . $resourceType->getName());
477
+            throw new InvalidOperationException('Failed to retrieve the custom state from '.$resourceType->getName());
478 478
         }
479 479
 
480 480
         //Customer_Orders_Orders, Order_Customer_Customers 
481 481
         //(source type::name _ source property::name _ target set::name)
482
-        $setKey = $resourceType->getName() . '_' .  $name . '_' . $targetResourceSet->getName();
482
+        $setKey = $resourceType->getName().'_'.$name.'_'.$targetResourceSet->getName();
483 483
         $set = new ResourceAssociationSet(
484 484
             $setKey,
485 485
             new ResourceAssociationSetEnd($sourceResourceSet, $resourceType, $resourceProperty),
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/Type/Binary.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function convertToOData($value)
109 109
     {
110
-        return 'binary\'' . bin2hex($value). '\'';
110
+        return 'binary\''.bin2hex($value).'\'';
111 111
     }
112 112
 
113 113
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             return false;    
126 126
         }
127 127
 
128
-	    if (!ctype_xdigit($value)){
128
+	    if (!ctype_xdigit($value)) {
129 129
 		    $outValue = null;
130 130
 		    return false;
131 131
 	    }
Please login to merge, or discard this patch.