@@ -621,10 +621,10 @@ |
||
621 | 621 | { |
622 | 622 | $queryParameterString = null; |
623 | 623 | foreach ([ODataConstants::HTTPQUERY_STRING_FILTER, |
624 | - ODataConstants::HTTPQUERY_STRING_EXPAND, |
|
625 | - ODataConstants::HTTPQUERY_STRING_ORDERBY, |
|
626 | - ODataConstants::HTTPQUERY_STRING_INLINECOUNT, |
|
627 | - ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { |
|
624 | + ODataConstants::HTTPQUERY_STRING_EXPAND, |
|
625 | + ODataConstants::HTTPQUERY_STRING_ORDERBY, |
|
626 | + ODataConstants::HTTPQUERY_STRING_INLINECOUNT, |
|
627 | + ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { |
|
628 | 628 | $value = $this->getService()->getHost()->getQueryStringItem($queryOption); |
629 | 629 | if (!is_null($value)) { |
630 | 630 | if (!is_null($queryParameterString)) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | // despite all set up, checking, etc, if we haven't picked a concrete resource type, |
176 | 176 | // wheels have fallen off, so blow up |
177 | - assert(!$resourceType->isAbstract(), 'Concrete resource type not selected for payload '.$payloadClass); |
|
177 | + assert(!$resourceType->isAbstract(), 'Concrete resource type not selected for payload ' . $payloadClass); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // make sure we're barking up right tree |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $targClass = $resourceType->getInstanceType()->getName(); |
183 | 183 | assert( |
184 | 184 | $entryObject->results instanceof $targClass, |
185 | - 'Object being serialised not instance of expected class, '.$targClass. ', is actually '.$payloadClass |
|
185 | + 'Object being serialised not instance of expected class, ' . $targClass . ', is actually ' . $payloadClass |
|
186 | 186 | ); |
187 | 187 | |
188 | 188 | $rawProp = $resourceType->getAllProperties(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | .' $propKind != ResourcePropertyKind::RESOURCE_REFERENCE' |
230 | 230 | ); |
231 | 231 | $propTail = ResourcePropertyKind::RESOURCE_REFERENCE == $propKind ? 'entry' : 'feed'; |
232 | - $propType = 'application/atom+xml;type='.$propTail; |
|
232 | + $propType = 'application/atom+xml;type=' . $propTail; |
|
233 | 233 | $propName = $prop->getName(); |
234 | 234 | $nuLink->title = $propName; |
235 | 235 | $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return ODataFeed |
282 | 282 | */ |
283 | - public function writeTopLevelElements(QueryResult &$entryObjects) |
|
283 | + public function writeTopLevelElements(QueryResult & $entryObjects) |
|
284 | 284 | { |
285 | 285 | $res = $entryObjects->results; |
286 | 286 | assert(is_array($res) || $res instanceof Collection, '!is_array($entryObjects->results)'); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $resourceSet = $this->getRequest()->getTargetResourceSetWrapper()->getResourceSet(); |
322 | 322 | $requestTop = $this->getRequest()->getTopOptionCount(); |
323 | 323 | $pageSize = $this->getService()->getConfiguration()->getEntitySetPageSize($resourceSet); |
324 | - $requestTop = (null === $requestTop) ? $pageSize + 1 : $requestTop; |
|
324 | + $requestTop = (null === $requestTop) ? $pageSize+1 : $requestTop; |
|
325 | 325 | |
326 | 326 | if (true === $entryObjects->hasMore && $requestTop > $pageSize) { |
327 | 327 | $stackSegment = $setName; |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * |
405 | 405 | * @return ODataPropertyContent |
406 | 406 | */ |
407 | - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) |
|
407 | + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) |
|
408 | 408 | { |
409 | 409 | $result = $complexValue->results; |
410 | 410 | |
@@ -433,14 +433,14 @@ discard block |
||
433 | 433 | * bag object |
434 | 434 | * @return ODataPropertyContent |
435 | 435 | */ |
436 | - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) |
|
436 | + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) |
|
437 | 437 | { |
438 | 438 | $result = $BagValue->results; |
439 | 439 | |
440 | 440 | $propertyContent = new ODataPropertyContent(); |
441 | 441 | $odataProperty = new ODataProperty(); |
442 | 442 | $odataProperty->name = $propertyName; |
443 | - $odataProperty->typeName = 'Collection('.$resourceType->getFullName().')'; |
|
443 | + $odataProperty->typeName = 'Collection(' . $resourceType->getFullName() . ')'; |
|
444 | 444 | $odataProperty->value = $this->writeBagValue($resourceType, $result); |
445 | 445 | |
446 | 446 | $propertyContent->properties[$propertyName] = $odataProperty; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * primitive property to be written |
457 | 457 | * @return ODataPropertyContent |
458 | 458 | */ |
459 | - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) |
|
459 | + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) |
|
460 | 460 | { |
461 | 461 | assert(null != $resourceProperty, 'Resource property must not be null'); |
462 | 462 | $propertyContent = new ODataPropertyContent(); |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $segmentWrappers = $this->getStack()->getSegmentWrappers(); |
716 | 716 | $count = count($segmentWrappers); |
717 | 717 | |
718 | - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; |
|
718 | + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | /** |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $skipToken = $internalOrderByInfo->buildSkipTokenValue($lastObject); |
741 | 741 | assert(!is_null($skipToken), '!is_null($skipToken)'); |
742 | 742 | $token = (1 < $numSegments) ? '$skiptoken=' : '$skip='; |
743 | - $skipToken = '?'.$queryParameterString.$token.$skipToken; |
|
743 | + $skipToken = '?' . $queryParameterString . $token . $skipToken; |
|
744 | 744 | |
745 | 745 | return $skipToken; |
746 | 746 | } |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | |
775 | 775 | $topCountValue = $this->getRequest()->getTopOptionCount(); |
776 | 776 | if (!is_null($topCountValue)) { |
777 | - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); |
|
777 | + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); |
|
778 | 778 | if (0 < $remainingCount) { |
779 | 779 | if (!is_null($queryParameterString)) { |
780 | 780 | $queryParameterString .= '&'; |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | * |
810 | 810 | * @return string |
811 | 811 | */ |
812 | - private function primitiveToString(IType &$type, $primitiveValue) |
|
812 | + private function primitiveToString(IType & $type, $primitiveValue) |
|
813 | 813 | { |
814 | 814 | if ($type instanceof Boolean) { |
815 | 815 | $stringValue = (true === $primitiveValue) ? 'true' : 'false'; |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | * @param $result |
910 | 910 | * @return ODataBagContent|null |
911 | 911 | */ |
912 | - protected function writeBagValue(ResourceType &$resourceType, $result) |
|
912 | + protected function writeBagValue(ResourceType & $resourceType, $result) |
|
913 | 913 | { |
914 | 914 | assert(null == $result || is_array($result), 'Bag parameter must be null or array'); |
915 | 915 | $typeKind = $resourceType->getResourceTypeKind(); |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | * @param string|null $propertyName |
943 | 943 | * @return ODataPropertyContent |
944 | 944 | */ |
945 | - protected function writeComplexValue(ResourceType &$resourceType, &$result, $propertyName = null) |
|
945 | + protected function writeComplexValue(ResourceType & $resourceType, &$result, $propertyName = null) |
|
946 | 946 | { |
947 | 947 | assert(is_object($result), 'Supplied $customObject must be an object'); |
948 | 948 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | }; |
57 | 57 | $this->functionDescriptionParsers[ODataConstants::STRFUN_ENDSWITH] = function ($params) { |
58 | 58 | return '(strcmp(substr('.$params[0].', strlen('.$params[0].') - strlen('.$params[1].')), ' |
59 | - .$params[1].') === 0)'; |
|
59 | + .$params[1].') === 0)'; |
|
60 | 60 | }; |
61 | 61 | $this->functionDescriptionParsers[ODataConstants::STRFUN_INDEXOF] = function ($params) { |
62 | 62 | return 'strpos('.$params[0].', '.$params[1].')'; |
@@ -52,81 +52,81 @@ discard block |
||
52 | 52 | public function __construct() |
53 | 53 | { |
54 | 54 | $this->functionDescriptionParsers[ODataConstants::STRFUN_COMPARE] = function ($params) { |
55 | - return 'strcmp('.$params[0].', '.$params[1].')'; |
|
55 | + return 'strcmp(' . $params[0] . ', ' . $params[1] . ')'; |
|
56 | 56 | }; |
57 | 57 | $this->functionDescriptionParsers[ODataConstants::STRFUN_ENDSWITH] = function ($params) { |
58 | - return '(strcmp(substr('.$params[0].', strlen('.$params[0].') - strlen('.$params[1].')), ' |
|
59 | - .$params[1].') === 0)'; |
|
58 | + return '(strcmp(substr(' . $params[0] . ', strlen(' . $params[0] . ') - strlen(' . $params[1] . ')), ' |
|
59 | + .$params[1] . ') === 0)'; |
|
60 | 60 | }; |
61 | 61 | $this->functionDescriptionParsers[ODataConstants::STRFUN_INDEXOF] = function ($params) { |
62 | - return 'strpos('.$params[0].', '.$params[1].')'; |
|
62 | + return 'strpos(' . $params[0] . ', ' . $params[1] . ')'; |
|
63 | 63 | }; |
64 | 64 | $this->functionDescriptionParsers[ODataConstants::STRFUN_REPLACE] = function ($params) { |
65 | - return 'str_replace('.$params[1].', '.$params[2].', '.$params[0].')'; |
|
65 | + return 'str_replace(' . $params[1] . ', ' . $params[2] . ', ' . $params[0] . ')'; |
|
66 | 66 | }; |
67 | 67 | $this->functionDescriptionParsers[ODataConstants::STRFUN_STARTSWITH] = function ($params) { |
68 | - return '(strpos('.$params[0].', '.$params[1].') === 0)'; |
|
68 | + return '(strpos(' . $params[0] . ', ' . $params[1] . ') === 0)'; |
|
69 | 69 | }; |
70 | 70 | $this->functionDescriptionParsers[ODataConstants::STRFUN_TOLOWER] = function ($params) { |
71 | - return 'strtolower('.$params[0].')'; |
|
71 | + return 'strtolower(' . $params[0] . ')'; |
|
72 | 72 | }; |
73 | 73 | $this->functionDescriptionParsers[ODataConstants::STRFUN_TOUPPER] = function ($params) { |
74 | - return 'strtoupper('.$params[0].')'; |
|
74 | + return 'strtoupper(' . $params[0] . ')'; |
|
75 | 75 | }; |
76 | 76 | $this->functionDescriptionParsers[ODataConstants::STRFUN_TRIM] = function ($params) { |
77 | - return 'trim('.$params[0].')'; |
|
77 | + return 'trim(' . $params[0] . ')'; |
|
78 | 78 | }; |
79 | 79 | $this->functionDescriptionParsers[ODataConstants::STRFUN_SUBSTRING] = function ($params) { |
80 | 80 | return count($params) == 3 ? |
81 | - 'substr('.$params[0].', '.$params[1].', '.$params[2].')' : 'substr('.$params[0].', '.$params[1].')'; |
|
81 | + 'substr(' . $params[0] . ', ' . $params[1] . ', ' . $params[2] . ')' : 'substr(' . $params[0] . ', ' . $params[1] . ')'; |
|
82 | 82 | }; |
83 | 83 | $this->functionDescriptionParsers[ODataConstants::STRFUN_SUBSTRINGOF] = function ($params) { |
84 | - return '(strpos('.$params[1].', '.$params[0].') !== false)'; |
|
84 | + return '(strpos(' . $params[1] . ', ' . $params[0] . ') !== false)'; |
|
85 | 85 | }; |
86 | 86 | $this->functionDescriptionParsers[ODataConstants::STRFUN_CONCAT] = function ($params) { |
87 | - return $params[0].' . '.$params[1]; |
|
87 | + return $params[0] . ' . ' . $params[1]; |
|
88 | 88 | }; |
89 | 89 | $this->functionDescriptionParsers[ODataConstants::STRFUN_LENGTH] = function ($params) { |
90 | - return 'strlen('.$params[0].')'; |
|
90 | + return 'strlen(' . $params[0] . ')'; |
|
91 | 91 | }; |
92 | 92 | $this->functionDescriptionParsers[ODataConstants::GUIDFUN_EQUAL] = function ($params) { |
93 | - return self::TYPE_NAMESPACE.'Guid::guidEqual('.$params[0].', '.$params[1].')'; |
|
93 | + return self::TYPE_NAMESPACE . 'Guid::guidEqual(' . $params[0] . ', ' . $params[1] . ')'; |
|
94 | 94 | }; |
95 | 95 | $this->functionDescriptionParsers[ODataConstants::DATETIME_COMPARE] = function ($params) { |
96 | - return self::TYPE_NAMESPACE.'DateTime::dateTimeCmp('.$params[0].', '.$params[1].')'; |
|
96 | + return self::TYPE_NAMESPACE . 'DateTime::dateTimeCmp(' . $params[0] . ', ' . $params[1] . ')'; |
|
97 | 97 | }; |
98 | 98 | $this->functionDescriptionParsers[ODataConstants::DATETIME_YEAR] = function ($params) { |
99 | - return self::TYPE_NAMESPACE.'DateTime::year('.$params[0].')'; |
|
99 | + return self::TYPE_NAMESPACE . 'DateTime::year(' . $params[0] . ')'; |
|
100 | 100 | }; |
101 | 101 | $this->functionDescriptionParsers[ODataConstants::DATETIME_MONTH] = function ($params) { |
102 | - return self::TYPE_NAMESPACE.'DateTime::month('.$params[0].')'; |
|
102 | + return self::TYPE_NAMESPACE . 'DateTime::month(' . $params[0] . ')'; |
|
103 | 103 | }; |
104 | 104 | $this->functionDescriptionParsers[ODataConstants::DATETIME_DAY] = function ($params) { |
105 | - return self::TYPE_NAMESPACE.'DateTime::day('.$params[0].')'; |
|
105 | + return self::TYPE_NAMESPACE . 'DateTime::day(' . $params[0] . ')'; |
|
106 | 106 | }; |
107 | 107 | $this->functionDescriptionParsers[ODataConstants::DATETIME_HOUR] = function ($params) { |
108 | - return self::TYPE_NAMESPACE.'DateTime::hour('.$params[0].')'; |
|
108 | + return self::TYPE_NAMESPACE . 'DateTime::hour(' . $params[0] . ')'; |
|
109 | 109 | }; |
110 | 110 | $this->functionDescriptionParsers[ODataConstants::DATETIME_MINUTE] = function ($params) { |
111 | - return self::TYPE_NAMESPACE.'DateTime::minute('.$params[0].')'; |
|
111 | + return self::TYPE_NAMESPACE . 'DateTime::minute(' . $params[0] . ')'; |
|
112 | 112 | }; |
113 | 113 | $this->functionDescriptionParsers[ODataConstants::DATETIME_SECOND] = function ($params) { |
114 | - return self::TYPE_NAMESPACE.'DateTime::second('.$params[0].')'; |
|
114 | + return self::TYPE_NAMESPACE . 'DateTime::second(' . $params[0] . ')'; |
|
115 | 115 | }; |
116 | 116 | $this->functionDescriptionParsers[ODataConstants::MATHFUN_ROUND] = function ($params) { |
117 | - return 'round('.$params[0].')'; |
|
117 | + return 'round(' . $params[0] . ')'; |
|
118 | 118 | }; |
119 | 119 | $this->functionDescriptionParsers[ODataConstants::MATHFUN_CEILING] = function ($params) { |
120 | - return 'ceil('.$params[0].')'; |
|
120 | + return 'ceil(' . $params[0] . ')'; |
|
121 | 121 | }; |
122 | 122 | $this->functionDescriptionParsers[ODataConstants::MATHFUN_FLOOR] = function ($params) { |
123 | - return 'floor('.$params[0].')'; |
|
123 | + return 'floor(' . $params[0] . ')'; |
|
124 | 124 | }; |
125 | 125 | $this->functionDescriptionParsers[ODataConstants::BINFUL_EQUAL] = function ($params) { |
126 | - return self::TYPE_NAMESPACE.'Binary::binaryEqual('.$params[0].', '.$params[1].')'; |
|
126 | + return self::TYPE_NAMESPACE . 'Binary::binaryEqual(' . $params[0] . ', ' . $params[1] . ')'; |
|
127 | 127 | }; |
128 | 128 | $this->functionDescriptionParsers['is_null'] = function ($params) { |
129 | - return 'is_null('.$params[0].')'; |
|
129 | + return 'is_null(' . $params[0] . ')'; |
|
130 | 130 | }; |
131 | 131 | } |
132 | 132 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function setResourceType(ResourceType $resourceType) |
159 | 159 | { |
160 | - $this->iteratorName = '$'.$resourceType->getName(); |
|
160 | + $this->iteratorName = '$' . $resourceType->getName(); |
|
161 | 161 | $this->resourceType = $resourceType; |
162 | 162 | } |
163 | 163 | /** |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | $parent = $expression; |
283 | 283 | $variable = null; |
284 | 284 | do { |
285 | - $variable = $parent->getResourceProperty()->getName().self::MEMBER_ACCESS.$variable; |
|
285 | + $variable = $parent->getResourceProperty()->getName() . self::MEMBER_ACCESS . $variable; |
|
286 | 286 | $parent = $parent->getParent(); |
287 | 287 | } while ($parent != null); |
288 | 288 | $variable = rtrim($variable, self::MEMBER_ACCESS); |
289 | - $variable = $this->getIteratorName().self::MEMBER_ACCESS.$variable; |
|
289 | + $variable = $this->getIteratorName() . self::MEMBER_ACCESS . $variable; |
|
290 | 290 | return $variable; |
291 | 291 | } |
292 | 292 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | private function prepareBinaryExpression($operator, $left, $right) |
320 | 320 | { |
321 | - return self::OPEN_BRACKET.$left.' '.$operator.' '.$right.self::CLOSE_BRACKET; |
|
321 | + return self::OPEN_BRACKET . $left . ' ' . $operator . ' ' . $right . self::CLOSE_BRACKET; |
|
322 | 322 | } |
323 | 323 | /** |
324 | 324 | * To format unary expression. |
@@ -330,6 +330,6 @@ discard block |
||
330 | 330 | */ |
331 | 331 | private function prepareUnaryExpression($operator, $child) |
332 | 332 | { |
333 | - return $operator.self::OPEN_BRACKET.$child.self::CLOSE_BRACKET; |
|
333 | + return $operator . self::OPEN_BRACKET . $child . self::CLOSE_BRACKET; |
|
334 | 334 | } |
335 | 335 | } |
@@ -301,17 +301,17 @@ |
||
301 | 301 | $lastCode = $code[strlen($code) - 1]; |
302 | 302 | assert('}' == $lastCode, 'Final character of function definition must be closing brace'); |
303 | 303 | foreach ([ |
304 | - 'hasMany', |
|
305 | - 'hasManyThrough', |
|
306 | - 'belongsToMany', |
|
307 | - 'hasOne', |
|
308 | - 'belongsTo', |
|
309 | - 'morphOne', |
|
310 | - 'morphTo', |
|
311 | - 'morphMany', |
|
312 | - 'morphToMany', |
|
313 | - 'morphedByMany' |
|
314 | - ] as $relation) { |
|
304 | + 'hasMany', |
|
305 | + 'hasManyThrough', |
|
306 | + 'belongsToMany', |
|
307 | + 'hasOne', |
|
308 | + 'belongsTo', |
|
309 | + 'morphOne', |
|
310 | + 'morphTo', |
|
311 | + 'morphMany', |
|
312 | + 'morphToMany', |
|
313 | + 'morphedByMany' |
|
314 | + ] as $relation) { |
|
315 | 315 | $search = '$this->' . $relation . '('; |
316 | 316 | if ($pos = stripos($code, $search)) { |
317 | 317 | //Resolve the relation's model to a Relation object. |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $reflection = new \ReflectionMethod($model, $method); |
308 | 308 | |
309 | 309 | $file = new \SplFileObject($reflection->getFileName()); |
310 | - $file->seek($reflection->getStartLine() - 1); |
|
310 | + $file->seek($reflection->getStartLine()-1); |
|
311 | 311 | $code = ''; |
312 | 312 | while ($file->key() < $reflection->getEndLine()) { |
313 | 313 | $code .= $file->current(); |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | 'Function definition must have keyword \'function\'' |
321 | 321 | ); |
322 | 322 | $begin = strpos($code, 'function('); |
323 | - $code = substr($code, $begin, strrpos($code, '}') - $begin + 1); |
|
324 | - $lastCode = $code[strlen($code) - 1]; |
|
323 | + $code = substr($code, $begin, strrpos($code, '}')-$begin+1); |
|
324 | + $lastCode = $code[strlen($code)-1]; |
|
325 | 325 | assert('}' == $lastCode, 'Final character of function definition must be closing brace'); |
326 | 326 | foreach ([ |
327 | 327 | 'hasMany', |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | break; |
490 | 490 | } |
491 | 491 | } |
492 | - assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list'); |
|
492 | + assert(in_array($fkMethodName, $methodList), 'Selected method, ' . $fkMethodName . ', not in method list'); |
|
493 | 493 | $rkMethodName = 'getQualifiedRelatedPivotKeyName'; |
494 | 494 | foreach ($rkList as $option) { |
495 | 495 | if (in_array($option, $methodList)) { |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | break; |
498 | 498 | } |
499 | 499 | } |
500 | - assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list'); |
|
500 | + assert(in_array($rkMethodName, $methodList), 'Selected method, ' . $rkMethodName . ', not in method list'); |
|
501 | 501 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
502 | 502 | static::$methodPrimary[get_class($foo)] = $line; |
503 | 503 | } |
@@ -520,13 +520,13 @@ discard block |
||
520 | 520 | } else { |
521 | 521 | $methodList = get_class_methods(get_class($foo)); |
522 | 522 | $fkCombo = array_values(array_intersect($fkList, $methodList)); |
523 | - assert(1 <= count($fkCombo), 'Expected at least 1 element in foreign-key list, got '.count($fkCombo)); |
|
523 | + assert(1 <= count($fkCombo), 'Expected at least 1 element in foreign-key list, got ' . count($fkCombo)); |
|
524 | 524 | $fkMethodName = $fkCombo[0]; |
525 | - assert(in_array($fkMethodName, $methodList), 'Selected method, '.$fkMethodName.', not in method list'); |
|
525 | + assert(in_array($fkMethodName, $methodList), 'Selected method, ' . $fkMethodName . ', not in method list'); |
|
526 | 526 | $rkCombo = array_values(array_intersect($rkList, $methodList)); |
527 | - assert(1 <= count($rkCombo), 'Expected at least 1 element in related-key list, got '.count($rkCombo)); |
|
527 | + assert(1 <= count($rkCombo), 'Expected at least 1 element in related-key list, got ' . count($rkCombo)); |
|
528 | 528 | $rkMethodName = $rkCombo[0]; |
529 | - assert(in_array($rkMethodName, $methodList), 'Selected method, '.$rkMethodName.', not in method list'); |
|
529 | + assert(in_array($rkMethodName, $methodList), 'Selected method, ' . $rkMethodName . ', not in method list'); |
|
530 | 530 | $line = ['fk' => $fkMethodName, 'rk' => $rkMethodName]; |
531 | 531 | static::$methodAlternate[get_class($foo)] = $line; |
532 | 532 | } |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | |
579 | 579 | $keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
580 | 580 | $keySegments = explode('.', $keyRaw); |
581 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
581 | + $keyName = $keySegments[count($keySegments)-1]; |
|
582 | 582 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
583 | 583 | $localSegments = explode('.', $localRaw); |
584 | - $localName = $localSegments[count($localSegments) - 1]; |
|
584 | + $localName = $localSegments[count($localSegments)-1]; |
|
585 | 585 | $first = $keyName; |
586 | 586 | $last = $localName; |
587 | 587 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -607,10 +607,10 @@ discard block |
||
607 | 607 | |
608 | 608 | $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
609 | 609 | $keySegments = explode('.', $keyName); |
610 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
610 | + $keyName = $keySegments[count($keySegments)-1]; |
|
611 | 611 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
612 | 612 | $localSegments = explode('.', $localRaw); |
613 | - $localName = $localSegments[count($localSegments) - 1]; |
|
613 | + $localName = $localSegments[count($localSegments)-1]; |
|
614 | 614 | $first = $isBelong ? $localName : $keyName; |
615 | 615 | $last = $isBelong ? $keyName : $localName; |
616 | 616 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -634,10 +634,10 @@ discard block |
||
634 | 634 | |
635 | 635 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
636 | 636 | $keySegments = explode('.', $keyRaw); |
637 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
637 | + $keyName = $keySegments[count($keySegments)-1]; |
|
638 | 638 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
639 | 639 | $localSegments = explode('.', $localRaw); |
640 | - $localName = $localSegments[count($localSegments) - 1]; |
|
640 | + $localName = $localSegments[count($localSegments)-1]; |
|
641 | 641 | $first = $isMany ? $keyName : $localName; |
642 | 642 | $last = $isMany ? $localName : $keyName; |
643 | 643 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ, 'unknown'); |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | |
661 | 661 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
662 | 662 | $keySegments = explode('.', $keyRaw); |
663 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
663 | + $keyName = $keySegments[count($keySegments)-1]; |
|
664 | 664 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
665 | 665 | $localSegments = explode('.', $localRaw); |
666 | - $localName = $localSegments[count($localSegments) - 1]; |
|
666 | + $localName = $localSegments[count($localSegments)-1]; |
|
667 | 667 | |
668 | 668 | $first = $keyName; |
669 | 669 | $last = (isset($localName) && '' != $localName) ? $localName : $foo->getRelated()->getKeyName(); |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | $nullFilter = true; |
141 | 141 | $isvalid = null; |
142 | 142 | if (isset($filterInfo)) { |
143 | - $method = 'return '.$filterInfo->getExpressionAsString().';'; |
|
144 | - $clln = '$'.$resourceSet->getResourceType()->getName(); |
|
143 | + $method = 'return ' . $filterInfo->getExpressionAsString() . ';'; |
|
144 | + $clln = '$' . $resourceSet->getResourceType()->getName(); |
|
145 | 145 | $isvalid = create_function($clln, $method); |
146 | 146 | $nullFilter = false; |
147 | 147 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | // so we can't bail out early |
170 | 170 | $rawCount += $results->count(); |
171 | 171 | // now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz |
172 | - if ($rawTop > $resultSet->count() + $skip) { |
|
172 | + if ($rawTop > $resultSet->count()+$skip) { |
|
173 | 173 | $resultSet = collect(array_merge($resultSet->all(), $results->all())); |
174 | 174 | $sliceAmount = min($skip, $resultSet->count()); |
175 | 175 | $resultSet = $resultSet->slice($sliceAmount); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if (QueryType::COUNT() == $queryType || QueryType::ENTITIES_WITH_COUNT() == $queryType) { |
208 | 208 | $result->count = $resultCount; |
209 | 209 | } |
210 | - $hazMore = $bulkSetCount > $skip + count($resultSet); |
|
210 | + $hazMore = $bulkSetCount > $skip+count($resultSet); |
|
211 | 211 | $result->hasMore = $hazMore; |
212 | 212 | return $result; |
213 | 213 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | ) { |
368 | 368 | $propertyName = $targetProperty->getName(); |
369 | 369 | if (!method_exists($sourceEntityInstance, $propertyName)) { |
370 | - $msg = 'Relation method, '.$propertyName.', does not exist on supplied entity.'; |
|
370 | + $msg = 'Relation method, ' . $propertyName . ', does not exist on supplied entity.'; |
|
371 | 371 | throw new InvalidArgumentException($msg); |
372 | 372 | } |
373 | 373 | // take key descriptor and turn it into where clause here, rather than in getResource call |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | assert( |
65 | 65 | !$alreadyKey, |
66 | - 'Mapping already defined for model '.$key.' and CRUD verb '.$barrel |
|
66 | + 'Mapping already defined for model ' . $key . ' and CRUD verb ' . $barrel |
|
67 | 67 | ); |
68 | 68 | $metamix[$key][$barrel] = $roll; |
69 | 69 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | assert(0 < count($this->mapping), 'Mapping array must not be empty'); |
41 | 41 | |
42 | 42 | if (!array_key_exists($modelName, $this->mapping)) { |
43 | - throw new \Exception('Metadata mapping for model '.$modelName.' not defined'); |
|
43 | + throw new \Exception('Metadata mapping for model ' . $modelName . ' not defined'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $this->checkCrudVerbDefined($crudVerb); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $lookup = $this->mapping[$modelName]; |
50 | 50 | if (!is_array($lookup)) { |
51 | - throw new \Exception('Metadata mapping for model '.$modelName.' not an array'); |
|
51 | + throw new \Exception('Metadata mapping for model ' . $modelName . ' not an array'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | if (!array_key_exists($crudVerb, $lookup)) { |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | // optional crud verbs don't have to be defined - so we can return null |
57 | 57 | return null; |
58 | 58 | } |
59 | - throw new \Exception('Metadata mapping for CRUD verb '.$crudVerb.' on model '.$modelName.' not defined'); |
|
59 | + throw new \Exception('Metadata mapping for CRUD verb ' . $crudVerb . ' on model ' . $modelName . ' not defined'); |
|
60 | 60 | } |
61 | 61 | $result = $lookup[$crudVerb]; |
62 | 62 | if (!isset($result)) { |
63 | - throw new \Exception('Metadata mapping for CRUD verb '.$crudVerb.' on model '.$modelName.' null'); |
|
63 | + throw new \Exception('Metadata mapping for CRUD verb ' . $crudVerb . ' on model ' . $modelName . ' null'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if (!method_exists($this, $result)) { |
67 | 67 | throw new \Exception( |
68 | - 'Metadata target for CRUD verb '.$crudVerb.' on model '.$modelName.' does not exist' |
|
68 | + 'Metadata target for CRUD verb ' . $crudVerb . ' on model ' . $modelName . ' does not exist' |
|
69 | 69 | ); |
70 | 70 | } |
71 | 71 | |
@@ -87,17 +87,17 @@ discard block |
||
87 | 87 | // check that mapping array is well formed and sane, rather than waiting to stab us with a spatula |
88 | 88 | foreach ($this->mapping as $key => $map) { |
89 | 89 | if (!is_array($map)) { |
90 | - throw new \Exception('Metadata mapping for model '.$key.' not an array'); |
|
90 | + throw new \Exception('Metadata mapping for model ' . $key . ' not an array'); |
|
91 | 91 | } |
92 | 92 | foreach ($map as $verb => $method) { |
93 | 93 | $this->checkCrudVerbDefined($verb); |
94 | 94 | if (!isset($method)) { |
95 | - throw new \Exception('Metadata mapping for CRUD verb '.$verb.' on model '.$key.' null'); |
|
95 | + throw new \Exception('Metadata mapping for CRUD verb ' . $verb . ' on model ' . $key . ' null'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | if (!method_exists($this, $method)) { |
99 | 99 | throw new \Exception( |
100 | - 'Metadata target for CRUD verb '.$verb.' on model '.$key.' does not exist' |
|
100 | + 'Metadata target for CRUD verb ' . $verb . ' on model ' . $key . ' does not exist' |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 | $parmArray = $this->getParameterNames($method); |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | $map = $raw->getMetadata(); |
357 | 357 | |
358 | 358 | if (!array_key_exists($class, $map)) { |
359 | - throw new \POData\Common\InvalidOperationException('Controller mapping missing for class '.$class.'.'); |
|
359 | + throw new \POData\Common\InvalidOperationException('Controller mapping missing for class ' . $class . '.'); |
|
360 | 360 | } |
361 | 361 | $goal = $raw->getMapping($class, $verb); |
362 | 362 | if (null == $goal) { |
363 | 363 | throw new \POData\Common\InvalidOperationException( |
364 | - 'Controller mapping missing for '.$verb.' verb on class '.$class.'.' |
|
364 | + 'Controller mapping missing for ' . $verb . ' verb on class ' . $class . '.' |
|
365 | 365 | ); |
366 | 366 | } |
367 | 367 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | throw new ODataException($e->getMessage(), 500); |
436 | 436 | } |
437 | 437 | } |
438 | - throw new ODataException('Target model not successfully '.$lastWord, 422); |
|
438 | + throw new ODataException('Target model not successfully ' . $lastWord, 422); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | $outData = $result->getData(); |
480 | 480 | if (is_object($outData)) { |
481 | - $outData = (array)$outData; |
|
481 | + $outData = (array) $outData; |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | if (!is_array($outData)) { |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $otherPropName = $this->getMetadataProvider() |
667 | 667 | ->resolveReverseProperty($sourceEntityInstance, $targetEntityInstance, $navPropName); |
668 | 668 | if (null === $otherPropName) { |
669 | - $msg = 'Bad navigation property, '.$navPropName.', on source model '.get_class($sourceEntityInstance); |
|
669 | + $msg = 'Bad navigation property, ' . $navPropName . ', on source model ' . get_class($sourceEntityInstance); |
|
670 | 670 | throw new \InvalidArgumentException($msg); |
671 | 671 | } |
672 | 672 | $this->unhookSingleModel( |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | } |
701 | 701 | $targType = $relation->getRelated(); |
702 | 702 | if (!$targetEntityInstance instanceof $targType) { |
703 | - $msg = 'Target instance must be of type compatible with relation declared in method '.$navPropName; |
|
703 | + $msg = 'Target instance must be of type compatible with relation declared in method ' . $navPropName; |
|
704 | 704 | throw new \InvalidArgumentException($msg); |
705 | 705 | } |
706 | 706 | return $relation; |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $var = new $varType(); |
742 | 742 | if ($spec['isRequest']) { |
743 | 743 | $var->setMethod($isCreate ? 'POST' : 'PUT'); |
744 | - $bulkData = [ 'data' => $data]; |
|
744 | + $bulkData = ['data' => $data]; |
|
745 | 745 | if (null !== $keyDescriptors) { |
746 | 746 | $keys = []; |
747 | 747 | foreach ($keyDescriptors as $desc) { |
@@ -114,7 +114,7 @@ |
||
114 | 114 | |
115 | 115 | $maxRel = $isKnown ? PHP_INT_MAX : 2 * $numRel; |
116 | 116 | $msg = 'Key '.$keyName. ' on class '.$className . ' should have no more than ' |
117 | - .$maxRel.' lines, has '.count($result); |
|
117 | + .$maxRel.' lines, has '.count($result); |
|
118 | 118 | assert($maxRel >= count($result), $msg); |
119 | 119 | return $result; |
120 | 120 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | class MetadataRelationHolder |
8 | 8 | { |
9 | - protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
9 | + protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
10 | 10 | protected $relations = []; |
11 | 11 | |
12 | 12 | public function __construct() |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | $className = get_class($model); |
28 | 28 | if (array_key_exists($className, $this->relations)) { |
29 | - $msg = $className.' already added'; |
|
29 | + $msg = $className . ' already added'; |
|
30 | 30 | throw new \InvalidArgumentException($msg); |
31 | 31 | } |
32 | 32 | $this->relations[$className] = $model->getRelationships(); |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | $maxRel = $isKnown ? PHP_INT_MAX : 2 * $numRel; |
116 | - $msg = 'Key '.$keyName. ' on class '.$className . ' should have no more than ' |
|
117 | - .$maxRel.' lines, has '.count($result); |
|
116 | + $msg = 'Key ' . $keyName . ' on class ' . $className . ' should have no more than ' |
|
117 | + .$maxRel . ' lines, has ' . count($result); |
|
118 | 118 | assert($maxRel >= count($result), $msg); |
119 | 119 | return $result; |
120 | 120 | } |
@@ -280,7 +280,7 @@ |
||
280 | 280 | $targUnknown = $targRels[$principalPoly ? $dependentType : $principalType]; |
281 | 281 | $targProperty = $principalPoly ? $relation['dependentProp'] : $relation['principalProp']; |
282 | 282 | $msg = 'Specified unknown-side property ' . $targProperty |
283 | - . ' not found in polymorphic relation map'; |
|
283 | + . ' not found in polymorphic relation map'; |
|
284 | 284 | assert(in_array($targProperty, $targUnknown), $msg); |
285 | 285 | |
286 | 286 | $targType = $principalPoly ? 'dependentRSet' : 'principalRSet'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | class MetadataProviderOld extends MetadataBaseProvider |
20 | 20 | { |
21 | - protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
21 | + protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
22 | 22 | protected static $metaNAMESPACE = 'Data'; |
23 | 23 | protected static $relationCache; |
24 | 24 | protected static $isBooted = false; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $knownKeys = array_keys($knownSide); |
217 | 217 | $unknownKeys = array_keys($unknownSide); |
218 | 218 | $dualKeys = array_intersect($knownKeys, $unknownKeys); |
219 | - assert(count($hooks) == (count($unknownKeys) + count($knownKeys) - count($dualKeys))); |
|
219 | + assert(count($hooks) == (count($unknownKeys)+count($knownKeys)-count($dualKeys))); |
|
220 | 220 | // if either list is empty, bail out - there's nothing to do |
221 | 221 | if (0 === count($knownSide) || 0 === count($unknownSide)) { |
222 | 222 | return []; |