@@ -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. |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | if (!isset($endpoint)) { |
| 117 | 117 | $bitter = get_class(); |
| 118 | - $name = substr($bitter, strrpos($bitter, '\\') + 1); |
|
| 118 | + $name = substr($bitter, strrpos($bitter, '\\')+1); |
|
| 119 | 119 | return ($name); |
| 120 | 120 | } |
| 121 | 121 | return ($endpoint); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $reflection = new \ReflectionMethod($model, $method); |
| 200 | 200 | |
| 201 | 201 | $file = new \SplFileObject($reflection->getFileName()); |
| 202 | - $file->seek($reflection->getStartLine() - 1); |
|
| 202 | + $file->seek($reflection->getStartLine()-1); |
|
| 203 | 203 | $code = ''; |
| 204 | 204 | while ($file->key() < $reflection->getEndLine()) { |
| 205 | 205 | $code .= $file->current(); |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | 'Function definition must have keyword \'function\'' |
| 213 | 213 | ); |
| 214 | 214 | $begin = strpos($code, 'function('); |
| 215 | - $code = substr($code, $begin, strrpos($code, '}') - $begin + 1); |
|
| 216 | - $lastCode = $code[strlen($code) - 1]; |
|
| 215 | + $code = substr($code, $begin, strrpos($code, '}')-$begin+1); |
|
| 216 | + $lastCode = $code[strlen($code)-1]; |
|
| 217 | 217 | assert('}' == $lastCode, 'Final character of function definition must be closing brace'); |
| 218 | 218 | foreach ([ |
| 219 | 219 | 'hasMany', |
@@ -485,10 +485,10 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | $keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 487 | 487 | $keySegments = explode('.', $keyRaw); |
| 488 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 488 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 489 | 489 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 490 | 490 | $localSegments = explode('.', $localRaw); |
| 491 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 491 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 492 | 492 | $first = $keyName; |
| 493 | 493 | $last = $localName; |
| 494 | 494 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -514,10 +514,10 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 516 | 516 | $keySegments = explode('.', $keyName); |
| 517 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 517 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 518 | 518 | $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 519 | 519 | $localSegments = explode('.', $localRaw); |
| 520 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 520 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 521 | 521 | $first = $isBelong ? $localName : $keyName; |
| 522 | 522 | $last = $isBelong ? $keyName : $localName; |
| 523 | 523 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); |
@@ -541,10 +541,10 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 543 | 543 | $keySegments = explode('.', $keyRaw); |
| 544 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 544 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 545 | 545 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 546 | 546 | $localSegments = explode('.', $localRaw); |
| 547 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 547 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 548 | 548 | $first = $isMany ? $keyName : $localName; |
| 549 | 549 | $last = $isMany ? $localName : $keyName; |
| 550 | 550 | $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ, 'unknown'); |
@@ -567,10 +567,10 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); |
| 569 | 569 | $keySegments = explode('.', $keyRaw); |
| 570 | - $keyName = $keySegments[count($keySegments) - 1]; |
|
| 570 | + $keyName = $keySegments[count($keySegments)-1]; |
|
| 571 | 571 | $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); |
| 572 | 572 | $localSegments = explode('.', $localRaw); |
| 573 | - $localName = $localSegments[count($localSegments) - 1]; |
|
| 573 | + $localName = $localSegments[count($localSegments)-1]; |
|
| 574 | 574 | |
| 575 | 575 | $first = $keyName; |
| 576 | 576 | $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) { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | class MetadataProvider extends MetadataBaseProvider |
| 25 | 25 | { |
| 26 | - protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 26 | + protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; |
|
| 27 | 27 | protected static $metaNAMESPACE = 'Data'; |
| 28 | 28 | protected static $relationCache; |
| 29 | 29 | protected static $isBooted = false; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | $metaCount = count($meta->oDataEntityMap); |
| 122 | 122 | $entityCount = count($entities); |
| 123 | - assert($metaCount == 2 * $entityCount + 1); |
|
| 123 | + assert($metaCount == 2 * $entityCount+1); |
|
| 124 | 124 | |
| 125 | 125 | if (null === $objectModel->getAssociations()) { |
| 126 | 126 | return; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $knownKeys = array_keys($knownSide); |
| 428 | 428 | $unknownKeys = array_keys($unknownSide); |
| 429 | 429 | $dualKeys = array_intersect($knownKeys, $unknownKeys); |
| 430 | - assert(count($hooks) == (count($unknownKeys) + count($knownKeys) - count($dualKeys))); |
|
| 430 | + assert(count($hooks) == (count($unknownKeys)+count($knownKeys)-count($dualKeys))); |
|
| 431 | 431 | // if either list is empty, bail out - there's nothing to do |
| 432 | 432 | if (0 === count($knownSide) || 0 === count($unknownSide)) { |
| 433 | 433 | return []; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $className = $entity->getClassName(); |
| 20 | 20 | if (array_key_exists($className, $this->relations)) { |
| 21 | - $msg = $className.' already added'; |
|
| 21 | + $msg = $className . ' already added'; |
|
| 22 | 22 | throw new \InvalidArgumentException($msg); |
| 23 | 23 | } |
| 24 | 24 | $this->relations[$className] = $entity; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | if ($stub instanceof AssociationStubMonomorphic) { |
| 71 | 71 | assert( |
| 72 | 72 | 1 >= count($others), |
| 73 | - 'Monomorphic relation stub on '. $className . ' ' . $relName |
|
| 73 | + 'Monomorphic relation stub on ' . $className . ' ' . $relName |
|
| 74 | 74 | . ' should point to at most 1 other stub' |
| 75 | 75 | ); |
| 76 | 76 | } |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | $thisMono = $this instanceof AssociationStubMonomorphic; |
| 98 | 98 | $thatMono = $otherStub instanceof AssociationStubMonomorphic; |
| 99 | 99 | |
| 100 | - $count = ($thisPoly ? 1 : 0) + ($thatPoly ? 1 : 0) + ($thisMono ? 1 : 0) + ($thatMono ? 1 : 0); |
|
| 100 | + $count = ($thisPoly ? 1 : 0)+($thatPoly ? 1 : 0)+($thisMono ? 1 : 0)+($thatMono ? 1 : 0); |
|
| 101 | 101 | assert(2 == $count); |
| 102 | 102 | if ($thisPoly && $thatMono) { |
| 103 | 103 | return false; |