diff --git a/src/Controllers/MetadataControllerTrait.php b/src/Controllers/MetadataControllerTrait.php index 1e58be28..3f47ea9f 100644 --- a/src/Controllers/MetadataControllerTrait.php +++ b/src/Controllers/MetadataControllerTrait.php @@ -40,7 +40,7 @@ public function getMethodName($modelName, $crudVerb) assert(0 < count($this->mapping), 'Mapping array must not be empty'); if (!array_key_exists($modelName, $this->mapping)) { - throw new \Exception('Metadata mapping for model '.$modelName.' not defined'); + throw new \Exception('Metadata mapping for model ' . $modelName . ' not defined'); } $this->checkCrudVerbDefined($crudVerb); @@ -48,7 +48,7 @@ public function getMethodName($modelName, $crudVerb) $lookup = $this->mapping[$modelName]; if (!is_array($lookup)) { - throw new \Exception('Metadata mapping for model '.$modelName.' not an array'); + throw new \Exception('Metadata mapping for model ' . $modelName . ' not an array'); } if (!array_key_exists($crudVerb, $lookup)) { @@ -56,16 +56,16 @@ public function getMethodName($modelName, $crudVerb) // optional crud verbs don't have to be defined - so we can return null return null; } - throw new \Exception('Metadata mapping for CRUD verb '.$crudVerb.' on model '.$modelName.' not defined'); + throw new \Exception('Metadata mapping for CRUD verb ' . $crudVerb . ' on model ' . $modelName . ' not defined'); } $result = $lookup[$crudVerb]; if (!isset($result)) { - throw new \Exception('Metadata mapping for CRUD verb '.$crudVerb.' on model '.$modelName.' null'); + throw new \Exception('Metadata mapping for CRUD verb ' . $crudVerb . ' on model ' . $modelName . ' null'); } if (!method_exists($this, $result)) { throw new \Exception( - 'Metadata target for CRUD verb '.$crudVerb.' on model '.$modelName.' does not exist' + 'Metadata target for CRUD verb ' . $crudVerb . ' on model ' . $modelName . ' does not exist' ); } @@ -87,17 +87,17 @@ public function getMappings() // check that mapping array is well formed and sane, rather than waiting to stab us with a spatula foreach ($this->mapping as $key => $map) { if (!is_array($map)) { - throw new \Exception('Metadata mapping for model '.$key.' not an array'); + throw new \Exception('Metadata mapping for model ' . $key . ' not an array'); } foreach ($map as $verb => $method) { $this->checkCrudVerbDefined($verb); if (!isset($method)) { - throw new \Exception('Metadata mapping for CRUD verb '.$verb.' on model '.$key.' null'); + throw new \Exception('Metadata mapping for CRUD verb ' . $verb . ' on model ' . $key . ' null'); } if (!method_exists($this, $method)) { throw new \Exception( - 'Metadata target for CRUD verb '.$verb.' on model '.$key.' does not exist' + 'Metadata target for CRUD verb ' . $verb . ' on model ' . $key . ' does not exist' ); } $parmArray = $this->getParameterNames($method); diff --git a/src/Models/MetadataGubbinsHolder.php b/src/Models/MetadataGubbinsHolder.php index 7dfa67d0..d4adb4e4 100644 --- a/src/Models/MetadataGubbinsHolder.php +++ b/src/Models/MetadataGubbinsHolder.php @@ -18,7 +18,7 @@ public function addEntity(EntityGubbins $entity) { $className = $entity->getClassName(); if (array_key_exists($className, $this->relations)) { - $msg = $className.' already added'; + $msg = $className . ' already added'; throw new \InvalidArgumentException($msg); } $this->relations[$className] = $entity; @@ -70,7 +70,7 @@ public function getRelationsByClass($className) if ($stub instanceof AssociationStubMonomorphic) { assert( 1 >= count($others), - 'Monomorphic relation stub on '. $className . ' ' . $relName + 'Monomorphic relation stub on ' . $className . ' ' . $relName . ' should point to at most 1 other stub' ); } diff --git a/src/Models/MetadataTrait.php b/src/Models/MetadataTrait.php index 295b3c60..5d591a64 100644 --- a/src/Models/MetadataTrait.php +++ b/src/Models/MetadataTrait.php @@ -115,7 +115,7 @@ public function getEndpointName() if (!isset($endpoint)) { $bitter = get_class(); - $name = substr($bitter, strrpos($bitter, '\\') + 1); + $name = substr($bitter, strrpos($bitter, '\\')+1); return ($name); } return ($endpoint); @@ -199,7 +199,7 @@ protected function getRelationshipsFromMethods($biDir = false) $reflection = new \ReflectionMethod($model, $method); $file = new \SplFileObject($reflection->getFileName()); - $file->seek($reflection->getStartLine() - 1); + $file->seek($reflection->getStartLine()-1); $code = ''; while ($file->key() < $reflection->getEndLine()) { $code .= $file->current(); @@ -212,21 +212,21 @@ protected function getRelationshipsFromMethods($biDir = false) 'Function definition must have keyword \'function\'' ); $begin = strpos($code, 'function('); - $code = substr($code, $begin, strrpos($code, '}') - $begin + 1); - $lastCode = $code[strlen($code) - 1]; + $code = substr($code, $begin, strrpos($code, '}')-$begin+1); + $lastCode = $code[strlen($code)-1]; assert('}' == $lastCode, 'Final character of function definition must be closing brace'); foreach ([ - 'hasMany', - 'hasManyThrough', - 'belongsToMany', - 'hasOne', - 'belongsTo', - 'morphOne', - 'morphTo', - 'morphMany', - 'morphToMany', - 'morphedByMany' - ] as $relation) { + 'hasMany', + 'hasManyThrough', + 'belongsToMany', + 'hasOne', + 'belongsTo', + 'morphOne', + 'morphTo', + 'morphMany', + 'morphToMany', + 'morphedByMany' + ] as $relation) { $search = '$this->' . $relation . '('; if ($pos = stripos($code, $search)) { //Resolve the relation's model to a Relation object. @@ -485,10 +485,10 @@ private function getRelationshipsHasMany($rels, &$hooks) $keyRaw = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); $keySegments = explode('.', $keyRaw); - $keyName = $keySegments[count($keySegments) - 1]; + $keyName = $keySegments[count($keySegments)-1]; $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); $localSegments = explode('.', $localRaw); - $localName = $localSegments[count($localSegments) - 1]; + $localName = $localSegments[count($localSegments)-1]; $first = $keyName; $last = $localName; $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); @@ -514,10 +514,10 @@ private function getRelationshipsHasOne($rels, &$hooks) $keyName = $isBelong ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); $keySegments = explode('.', $keyName); - $keyName = $keySegments[count($keySegments) - 1]; + $keyName = $keySegments[count($keySegments)-1]; $localRaw = $isBelong ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); $localSegments = explode('.', $localRaw); - $localName = $localSegments[count($localSegments) - 1]; + $localName = $localSegments[count($localSegments)-1]; $first = $isBelong ? $localName : $keyName; $last = $isBelong ? $keyName : $localName; $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ); @@ -541,10 +541,10 @@ private function getRelationshipsKnownPolyMorph($rels, &$hooks) $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); $keySegments = explode('.', $keyRaw); - $keyName = $keySegments[count($keySegments) - 1]; + $keyName = $keySegments[count($keySegments)-1]; $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); $localSegments = explode('.', $localRaw); - $localName = $localSegments[count($localSegments) - 1]; + $localName = $localSegments[count($localSegments)-1]; $first = $isMany ? $keyName : $localName; $last = $isMany ? $localName : $keyName; $this->addRelationsHook($hooks, $first, $property, $last, $mult, $targ, 'unknown'); @@ -567,10 +567,10 @@ private function getRelationshipsUnknownPolyMorph($rels, &$hooks) $keyRaw = $isMany ? $foo->$fkMethodName() : $foo->$fkMethodAlternate(); $keySegments = explode('.', $keyRaw); - $keyName = $keySegments[count($keySegments) - 1]; + $keyName = $keySegments[count($keySegments)-1]; $localRaw = $isMany ? $foo->$rkMethodName() : $foo->$rkMethodAlternate(); $localSegments = explode('.', $localRaw); - $localName = $localSegments[count($localSegments) - 1]; + $localName = $localSegments[count($localSegments)-1]; $first = $keyName; $last = (isset($localName) && '' != $localName) ? $localName : $foo->getRelated()->getKeyName(); diff --git a/src/Models/ObjectMap/Entities/Associations/AssociationMonomorphic.php b/src/Models/ObjectMap/Entities/Associations/AssociationMonomorphic.php index 140a3a2a..b8aa12bf 100644 --- a/src/Models/ObjectMap/Entities/Associations/AssociationMonomorphic.php +++ b/src/Models/ObjectMap/Entities/Associations/AssociationMonomorphic.php @@ -51,7 +51,7 @@ public function isOk() public function getAssociationType() { return new AssociationType($this->first->getMultiplicity()->getValue() - | $this->last->getMultiplicity()->getValue()); + | $this->last->getMultiplicity()->getValue()); } /** diff --git a/src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php b/src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php index 5b183433..b2ada897 100644 --- a/src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php +++ b/src/Models/ObjectMap/Entities/Associations/AssociationStubBase.php @@ -97,7 +97,7 @@ public function isCompatible(AssociationStubBase $otherStub) $thisMono = $this instanceof AssociationStubMonomorphic; $thatMono = $otherStub instanceof AssociationStubMonomorphic; - $count = ($thisPoly ? 1 : 0) + ($thatPoly ? 1 : 0) + ($thisMono ? 1 : 0) + ($thatMono ? 1 : 0); + $count = ($thisPoly ? 1 : 0)+($thatPoly ? 1 : 0)+($thisMono ? 1 : 0)+($thatMono ? 1 : 0); assert(2 == $count); if ($thisPoly && $thatMono) { return false; diff --git a/src/Models/ObjectMap/Entities/EntityField.php b/src/Models/ObjectMap/Entities/EntityField.php index fc2189a2..2b409dfa 100644 --- a/src/Models/ObjectMap/Entities/EntityField.php +++ b/src/Models/ObjectMap/Entities/EntityField.php @@ -211,7 +211,6 @@ private function primitiveTypeToEdmType(EntityFieldPrimitiveType $primitiveType) { $value = $primitiveType->getValue(); return array_key_exists($value, self::$primitiveToEdmMapping) ? - self::$primitiveToEdmMapping[$value] : - EdmPrimitiveType::STRING; + self::$primitiveToEdmMapping[$value] : EdmPrimitiveType::STRING; } } diff --git a/src/Providers/MetadataControllerProvider.php b/src/Providers/MetadataControllerProvider.php index 7a1f0244..cf67ad42 100644 --- a/src/Providers/MetadataControllerProvider.php +++ b/src/Providers/MetadataControllerProvider.php @@ -61,7 +61,7 @@ public function boot() } assert( !$alreadyKey, - 'Mapping already defined for model '.$key.' and CRUD verb '.$barrel + 'Mapping already defined for model ' . $key . ' and CRUD verb ' . $barrel ); $metamix[$key][$barrel] = $roll; } diff --git a/src/Providers/MetadataProvider.php b/src/Providers/MetadataProvider.php index cae52642..b94ffd2f 100644 --- a/src/Providers/MetadataProvider.php +++ b/src/Providers/MetadataProvider.php @@ -23,7 +23,7 @@ class MetadataProvider extends MetadataBaseProvider { - protected $multConstraints = [ '0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; + protected $multConstraints = ['0..1' => ['1'], '1' => ['0..1', '*'], '*' => ['1', '*']]; protected static $metaNAMESPACE = 'Data'; protected static $relationCache; protected static $isBooted = false; @@ -120,7 +120,7 @@ private function implement(Map $objectModel) } $metaCount = count($meta->oDataEntityMap); $entityCount = count($entities); - assert($metaCount == 2 * $entityCount + 1); + assert($metaCount == 2 * $entityCount+1); if (null === $objectModel->getAssociations()) { return; @@ -427,7 +427,7 @@ public function getPolymorphicRelationGroups() $knownKeys = array_keys($knownSide); $unknownKeys = array_keys($unknownSide); $dualKeys = array_intersect($knownKeys, $unknownKeys); - assert(count($hooks) == (count($unknownKeys) + count($knownKeys) - count($dualKeys))); + assert(count($hooks) == (count($unknownKeys)+count($knownKeys)-count($dualKeys))); // if either list is empty, bail out - there's nothing to do if (0 === count($knownSide) || 0 === count($unknownSide)) { return []; diff --git a/src/Query/LaravelExpressionProvider.php b/src/Query/LaravelExpressionProvider.php index 71ebb217..0077a2de 100644 --- a/src/Query/LaravelExpressionProvider.php +++ b/src/Query/LaravelExpressionProvider.php @@ -54,7 +54,7 @@ public function __construct() }; $this->functionDescriptionParsers[ODataConstants::STRFUN_ENDSWITH] = function ($params) { return '(strcmp(substr('.$params[0].', strlen('.$params[0].') - strlen('.$params[1].')), ' - .$params[1].') === 0)'; + .$params[1].') === 0)'; }; $this->functionDescriptionParsers[ODataConstants::STRFUN_INDEXOF] = function ($params) { return 'strpos('.$params[0].', '.$params[1].')'; @@ -155,7 +155,7 @@ public function getResourceType() */ public function setResourceType(ResourceType $resourceType) { - $this->iteratorName = '$'.$resourceType->getName(); + $this->iteratorName = '$' . $resourceType->getName(); $this->resourceType = $resourceType; } /** @@ -280,11 +280,11 @@ public function onPropertyAccessExpression($expression) $parent = $expression; $variable = null; do { - $variable = $parent->getResourceProperty()->getName().self::MEMBER_ACCESS.$variable; + $variable = $parent->getResourceProperty()->getName() . self::MEMBER_ACCESS . $variable; $parent = $parent->getParent(); } while ($parent != null); $variable = rtrim($variable, self::MEMBER_ACCESS); - $variable = $this->getIteratorName().self::MEMBER_ACCESS.$variable; + $variable = $this->getIteratorName() . self::MEMBER_ACCESS . $variable; return $variable; } /** @@ -316,7 +316,7 @@ public function onFunctionCallExpression($functionDescription, $params) */ private function prepareBinaryExpression($operator, $left, $right) { - return self::OPEN_BRACKET.$left.' '.$operator.' '.$right.self::CLOSE_BRACKET; + return self::OPEN_BRACKET . $left . ' ' . $operator . ' ' . $right . self::CLOSE_BRACKET; } /** * To format unary expression. @@ -328,6 +328,6 @@ private function prepareBinaryExpression($operator, $left, $right) */ private function prepareUnaryExpression($operator, $child) { - return $operator.self::OPEN_BRACKET.$child.self::CLOSE_BRACKET; + return $operator . self::OPEN_BRACKET . $child . self::CLOSE_BRACKET; } } diff --git a/src/Query/LaravelQuery.php b/src/Query/LaravelQuery.php index a85f5e03..4ce0c447 100644 --- a/src/Query/LaravelQuery.php +++ b/src/Query/LaravelQuery.php @@ -354,12 +354,12 @@ private function createUpdateDeleteCore($sourceEntityInstance, $data, $class, $v $map = $raw->getMetadata(); if (!array_key_exists($class, $map)) { - throw new \POData\Common\InvalidOperationException('Controller mapping missing for class '.$class.'.'); + throw new \POData\Common\InvalidOperationException('Controller mapping missing for class ' . $class . '.'); } $goal = $raw->getMapping($class, $verb); if (null == $goal) { throw new \POData\Common\InvalidOperationException( - 'Controller mapping missing for '.$verb.' verb on class '.$class.'.' + 'Controller mapping missing for ' . $verb . ' verb on class ' . $class . '.' ); } @@ -433,7 +433,7 @@ private function createUpdateCoreWrapper(ResourceSet $sourceResourceSet, $data, throw new ODataException($e->getMessage(), 500); } } - throw new ODataException('Target model not successfully '.$lastWord, 422); + throw new ODataException('Target model not successfully ' . $lastWord, 422); } /** @@ -476,7 +476,7 @@ private function createUpdateDeleteProcessOutput($result) } $outData = $result->getData(); if (is_object($outData)) { - $outData = (array)$outData; + $outData = (array) $outData; } if (!is_array($outData)) { @@ -669,7 +669,7 @@ public function unhookSingleModel( $otherPropName = $this->getMetadataProvider() ->resolveReverseProperty($sourceEntityInstance, $targetEntityInstance, $navPropName); if (null === $otherPropName) { - $msg = 'Bad navigation property, '.$navPropName.', on source model '.get_class($sourceEntityInstance); + $msg = 'Bad navigation property, ' . $navPropName . ', on source model ' . get_class($sourceEntityInstance); throw new \InvalidArgumentException($msg); } $this->unhookSingleModel( @@ -703,7 +703,7 @@ protected function isModelHookInputsOk($sourceEntityInstance, $targetEntityInsta } $targType = $relation->getRelated(); if (!$targetEntityInstance instanceof $targType) { - $msg = 'Target instance must be of type compatible with relation declared in method '.$navPropName; + $msg = 'Target instance must be of type compatible with relation declared in method ' . $navPropName; throw new \InvalidArgumentException($msg); } return $relation; @@ -743,7 +743,7 @@ protected function prepareBulkRequestInput($paramList, array $data, array $keyDe $var = new $varType(); if ($spec['isRequest']) { $var->setMethod($isCreate ? 'POST' : 'PUT'); - $bulkData = [ 'data' => $data]; + $bulkData = ['data' => $data]; if (null !== $keyDescriptors) { $keys = []; foreach ($keyDescriptors as $desc) { diff --git a/src/Query/LaravelReadQuery.php b/src/Query/LaravelReadQuery.php index 63e6a570..c50a07b7 100644 --- a/src/Query/LaravelReadQuery.php +++ b/src/Query/LaravelReadQuery.php @@ -144,8 +144,8 @@ function ($query) use ($processed) { $nullFilter = true; $isvalid = null; if (isset($filterInfo)) { - $method = 'return '.$filterInfo->getExpressionAsString().';'; - $clln = '$'.$resourceSet->getResourceType()->getName(); + $method = 'return ' . $filterInfo->getExpressionAsString() . ';'; + $clln = '$' . $resourceSet->getResourceType()->getName(); $isvalid = create_function($clln, $method); $nullFilter = false; } @@ -173,7 +173,7 @@ function ($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { // so we can't bail out early $rawCount += $results->count(); // now bolt on filtrate to accumulating result set if we haven't accumulated enough bitz - if ($rawTop > $resultSet->count() + $skip) { + if ($rawTop > $resultSet->count()+$skip) { $resultSet = collect(array_merge($resultSet->all(), $results->all())); $sliceAmount = min($skip, $resultSet->count()); $resultSet = $resultSet->slice($sliceAmount); @@ -211,7 +211,7 @@ function ($results) use ($isvalid, &$skip, &$resultSet, &$rawCount, $rawTop) { if (QueryType::COUNT() == $queryType || QueryType::ENTITIES_WITH_COUNT() == $queryType) { $result->count = $resultCount; } - $hazMore = $bulkSetCount > $skip + count($resultSet); + $hazMore = $bulkSetCount > $skip+count($resultSet); $result->hasMore = $hazMore; return $result; } @@ -371,7 +371,7 @@ public function getResourceFromRelatedResourceSet( ) { $propertyName = $targetProperty->getName(); if (!method_exists($sourceEntityInstance, $propertyName)) { - $msg = 'Relation method, '.$propertyName.', does not exist on supplied entity.'; + $msg = 'Relation method, ' . $propertyName . ', does not exist on supplied entity.'; throw new InvalidArgumentException($msg); } // take key descriptor and turn it into where clause here, rather than in getResource call diff --git a/src/Serialisers/IronicSerialiser.php b/src/Serialisers/IronicSerialiser.php index 48f9ff1f..136092bf 100644 --- a/src/Serialisers/IronicSerialiser.php +++ b/src/Serialisers/IronicSerialiser.php @@ -177,7 +177,7 @@ public function writeTopLevelElement(QueryResult $entryObject) } // despite all set up, checking, etc, if we haven't picked a concrete resource type, // wheels have fallen off, so blow up - assert(!$resourceType->isAbstract(), 'Concrete resource type not selected for payload '.$payloadClass); + assert(!$resourceType->isAbstract(), 'Concrete resource type not selected for payload ' . $payloadClass); } // make sure we're barking up right tree @@ -185,7 +185,7 @@ public function writeTopLevelElement(QueryResult $entryObject) $targClass = $resourceType->getInstanceType()->getName(); assert( $entryObject->results instanceof $targClass, - 'Object being serialised not instance of expected class, '.$targClass. ', is actually '.$payloadClass + 'Object being serialised not instance of expected class, ' . $targClass . ', is actually ' . $payloadClass ); $rawProp = $resourceType->getAllProperties(); @@ -232,7 +232,7 @@ public function writeTopLevelElement(QueryResult $entryObject) .' $propKind != ResourcePropertyKind::RESOURCE_REFERENCE' ); $propTail = ResourcePropertyKind::RESOURCE_REFERENCE == $propKind ? 'entry' : 'feed'; - $propType = 'application/atom+xml;type='.$propTail; + $propType = 'application/atom+xml;type=' . $propTail; $propName = $prop->getName(); $nuLink->title = $propName; $nuLink->name = ODataConstants::ODATA_RELATED_NAMESPACE . $propName; @@ -283,7 +283,7 @@ public function writeTopLevelElement(QueryResult $entryObject) * * @return ODataFeed */ - public function writeTopLevelElements(QueryResult &$entryObjects) + public function writeTopLevelElements(QueryResult & $entryObjects) { $res = $entryObjects->results; assert(is_array($res) || $res instanceof Collection, '!is_array($entryObjects->results)'); @@ -326,7 +326,7 @@ public function writeTopLevelElements(QueryResult &$entryObjects) $resourceSet = $this->getRequest()->getTargetResourceSetWrapper()->getResourceSet(); $requestTop = $this->getRequest()->getTopOptionCount(); $pageSize = $this->getService()->getConfiguration()->getEntitySetPageSize($resourceSet); - $requestTop = (null === $requestTop) ? $pageSize + 1 : $requestTop; + $requestTop = (null === $requestTop) ? $pageSize+1 : $requestTop; if (true === $entryObjects->hasMore && $requestTop > $pageSize) { $stackSegment = $setName; @@ -415,7 +415,7 @@ public function writeUrlElements(QueryResult $entryObjects) * * @return ODataPropertyContent */ - public function writeTopLevelComplexObject(QueryResult &$complexValue, $propertyName, ResourceType &$resourceType) + public function writeTopLevelComplexObject(QueryResult & $complexValue, $propertyName, ResourceType & $resourceType) { $result = $complexValue->results; @@ -443,17 +443,16 @@ public function writeTopLevelComplexObject(QueryResult &$complexValue, $property * @param ResourceType &$resourceType Describes the type of * bag object * - * @return ODataPropertyContent */ - public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, ResourceType &$resourceType) + public function writeTopLevelBagObject(QueryResult & $BagValue, $propertyName, ResourceType & $resourceType) { $result = $BagValue->results; $propertyContent = new ODataPropertyContent(); $odataProperty = new ODataProperty(); $odataProperty->name = $propertyName; - $odataProperty->typeName = 'Collection('.$resourceType->getFullName().')'; + $odataProperty->typeName = 'Collection(' . $resourceType->getFullName() . ')'; $odataProperty->value = $this->writeBagValue($resourceType, $result); $propertyContent->properties[$propertyName] = $odataProperty; @@ -469,7 +468,7 @@ public function writeTopLevelBagObject(QueryResult &$BagValue, $propertyName, Re * primitive property to be written * @return ODataPropertyContent */ - public function writeTopLevelPrimitive(QueryResult &$primitiveValue, ResourceProperty &$resourceProperty = null) + public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null) { assert(null != $resourceProperty, 'Resource property must not be null'); $propertyContent = new ODataPropertyContent(); @@ -728,7 +727,7 @@ protected function getCurrentResourceSetWrapper() $segmentWrappers = $this->getStack()->getSegmentWrappers(); $count = count($segmentWrappers); - return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count - 1]; + return 0 == $count ? $this->getRequest()->getTargetResourceSetWrapper() : $segmentWrappers[$count-1]; } /** @@ -753,7 +752,7 @@ protected function getNextLinkUri(&$lastObject) $skipToken = $internalOrderByInfo->buildSkipTokenValue($lastObject); assert(null !== $skipToken, '!is_null($skipToken)'); $token = (1 < $numSegments) ? '$skiptoken=' : '$skip='; - $skipToken = '?'.$queryParameterString.$token.$skipToken; + $skipToken = '?' . $queryParameterString . $token . $skipToken; return $skipToken; } @@ -771,10 +770,10 @@ protected function getNextPageLinkQueryParametersForRootResourceSet() { $queryParameterString = null; foreach ([ODataConstants::HTTPQUERY_STRING_FILTER, - ODataConstants::HTTPQUERY_STRING_EXPAND, - ODataConstants::HTTPQUERY_STRING_ORDERBY, - ODataConstants::HTTPQUERY_STRING_INLINECOUNT, - ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { + ODataConstants::HTTPQUERY_STRING_EXPAND, + ODataConstants::HTTPQUERY_STRING_ORDERBY, + ODataConstants::HTTPQUERY_STRING_INLINECOUNT, + ODataConstants::HTTPQUERY_STRING_SELECT, ] as $queryOption) { $value = $this->getService()->getHost()->getQueryStringItem($queryOption); if (null !== $value) { if (null !== $queryParameterString) { @@ -787,7 +786,7 @@ protected function getNextPageLinkQueryParametersForRootResourceSet() $topCountValue = $this->getRequest()->getTopOptionCount(); if (null !== $topCountValue) { - $remainingCount = $topCountValue - $this->getRequest()->getTopCount(); + $remainingCount = $topCountValue-$this->getRequest()->getTopCount(); if (0 < $remainingCount) { if (null !== $queryParameterString) { $queryParameterString .= '&'; @@ -822,7 +821,7 @@ private function loadStackIfEmpty() * * @return string */ - private function primitiveToString(IType &$type, $primitiveValue) + private function primitiveToString(IType & $type, $primitiveValue) { if ($type instanceof Boolean) { $stringValue = (true === $primitiveValue) ? 'true' : 'false'; @@ -925,7 +924,7 @@ public function setService(IService $service) * @param $result * @return ODataBagContent|null */ - protected function writeBagValue(ResourceType &$resourceType, $result) + protected function writeBagValue(ResourceType & $resourceType, $result) { assert(null == $result || is_array($result), 'Bag parameter must be null or array'); $typeKind = $resourceType->getResourceTypeKind(); @@ -958,7 +957,7 @@ protected function writeBagValue(ResourceType &$resourceType, $result) * @param string|null $propertyName * @return ODataPropertyContent */ - protected function writeComplexValue(ResourceType &$resourceType, &$result, $propertyName = null) + protected function writeComplexValue(ResourceType & $resourceType, &$result, $propertyName = null) { assert(is_object($result), 'Supplied $customObject must be an object');