@@ -103,8 +103,8 @@ |
||
| 103 | 103 | Messages::orderByLeafNodeArgumentShouldBeNonEmptyArray() |
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | - $flag1 = ""; |
|
| 107 | - $flag2 = ""; |
|
| 106 | + $flag1 = ""; |
|
| 107 | + $flag2 = ""; |
|
| 108 | 108 | $parameterNames = null; |
| 109 | 109 | $accessor1 = null; |
| 110 | 110 | $accessor2 = null; |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | $this->_queryOptionsCount = null; |
| 63 | 63 | $this->_headers = null; |
| 64 | 64 | $this->getHeaders(); |
| 65 | - //Not sure about this |
|
| 66 | - $this->getQueryParameters(); |
|
| 65 | + //Not sure about this |
|
| 66 | + $this->getQueryParameters(); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $this->_rawUrl .= "://" . $_SERVER[HttpProcessUtility::headerToServerKey(ODataConstants::HTTPREQUEST_HEADER_HOST)]; |
| 140 | 140 | $this->_rawUrl .= $_SERVER[ODataConstants::HTTPREQUEST_URI]; |
| 141 | - //It looks like it is not working, for example if there is an $inlinecount then it will double the parameter |
|
| 142 | - //if (!empty($_SERVER[ODataConstants::HTTPREQUEST_QUERY_STRING])) { |
|
| 143 | - // $this->_rawUrl .= "?" . $_SERVER[ODataConstants::HTTPREQUEST_QUERY_STRING]; |
|
| 144 | - //} |
|
| 141 | + //It looks like it is not working, for example if there is an $inlinecount then it will double the parameter |
|
| 142 | + //if (!empty($_SERVER[ODataConstants::HTTPREQUEST_QUERY_STRING])) { |
|
| 143 | + // $this->_rawUrl .= "?" . $_SERVER[ODataConstants::HTTPREQUEST_QUERY_STRING]; |
|
| 144 | + //} |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return $this->_rawUrl; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | if (is_null($this->_queryOptions)) { |
| 195 | 195 | $queryString = $this->getQueryString(); |
| 196 | 196 | $this->_queryOptions = array(); |
| 197 | - //example $filter=CustomerID gt \'ALFKI\' |
|
| 197 | + //example $filter=CustomerID gt \'ALFKI\' |
|
| 198 | 198 | foreach (explode('&', $queryString) as $queryOptionAsString) { |
| 199 | 199 | $queryOptionAsString = trim($queryOptionAsString); |
| 200 | 200 | if (!empty($queryOptionAsString)) { |
@@ -124,12 +124,12 @@ |
||
| 124 | 124 | { |
| 125 | 125 | if (is_null($this->_absoluteRequestUri)) { |
| 126 | 126 | $this->_absoluteRequestUriAsString = $this->_operationContext->incomingRequest()->getRawUrl(); |
| 127 | - $originalRequest = $this->_operationContext->incomingRequest(); |
|
| 127 | + $originalRequest = $this->_operationContext->incomingRequest(); |
|
| 128 | 128 | // Validate the uri first |
| 129 | 129 | try { |
| 130 | 130 | $this->_fullAbsoluteRequestUriAsString = $this->_absoluteRequestUriAsString; |
| 131 | 131 | $this->_fullAbsoluteRequestUri = new Url($this->_fullAbsoluteRequestUriAsString); |
| 132 | - $this->_fullAbsoluteRequestUri->setQueryOptions($originalRequest->getQueryParameters()); |
|
| 132 | + $this->_fullAbsoluteRequestUri->setQueryOptions($originalRequest->getQueryParameters()); |
|
| 133 | 133 | } catch (UrlFormatException $exception) { |
| 134 | 134 | throw ODataException::createBadRequestError($exception->getMessage()); |
| 135 | 135 | } |
@@ -68,19 +68,19 @@ |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Gets query options |
|
| 73 | - * |
|
| 74 | - * @return array |
|
| 75 | - */ |
|
| 71 | + /** |
|
| 72 | + * Gets query options |
|
| 73 | + * |
|
| 74 | + * @return array |
|
| 75 | + */ |
|
| 76 | 76 | public function getQueryOptions() |
| 77 | 77 | { |
| 78 | 78 | return $this->_queryOptions; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Sets query options |
|
| 83 | - */ |
|
| 81 | + /** |
|
| 82 | + * Sets query options |
|
| 83 | + */ |
|
| 84 | 84 | public function setQueryOptions($_queryOptions) |
| 85 | 85 | { |
| 86 | 86 | $this->_queryOptions = $_queryOptions; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | private $_dummyObject; |
| 67 | 67 | |
| 68 | - private $_rootOrderByNode; |
|
| 68 | + private $_rootOrderByNode; |
|
| 69 | 69 | /** |
| 70 | 70 | * Creates new instance of OrderByParser |
| 71 | 71 | * |
@@ -79,52 +79,52 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | private static function _mock($resourceType): object { |
| 82 | - $instanceType = $resourceType->getInstanceType(); |
|
| 83 | - $reflection = new \ReflectionClass($instanceType->name); |
|
| 84 | - $mock = $reflection->newInstanceWithoutConstructor(); |
|
| 85 | - |
|
| 86 | - foreach ($reflection->getProperties() as $property) { |
|
| 87 | - $property->setAccessible(true); |
|
| 88 | - |
|
| 89 | - $type = $property->getType(); |
|
| 90 | - if($resourceType instanceof ResourceProperty) { |
|
| 91 | - $resourceType = $resourceType->getResourceType(); |
|
| 92 | - } |
|
| 93 | - $resourceProperty = $resourceType->resolveProperty($property->getName()); |
|
| 94 | - if(is_null($resourceProperty)) continue; |
|
| 95 | - |
|
| 96 | - $resourcePropertyType = $resourceProperty->getResourceType(); |
|
| 97 | - $resourceKind = $resourcePropertyType->getResourceTypeKind(); |
|
| 98 | - if ($type && !$type->allowsNull()) { |
|
| 99 | - if ($resourceKind === ResourceTypeKind::PRIMITIVE) { |
|
| 100 | - switch ($type->getName()) { |
|
| 101 | - case 'int': |
|
| 102 | - $property->setValue($mock, 0); |
|
| 103 | - break; |
|
| 104 | - case 'string': |
|
| 105 | - $property->setValue($mock, ''); |
|
| 106 | - break; |
|
| 107 | - case 'bool': |
|
| 108 | - $property->setValue($mock, false); |
|
| 109 | - break; |
|
| 110 | - case 'array': |
|
| 111 | - // If the property is of type array, set it as an empty array |
|
| 112 | - $property->setValue($mock, []); |
|
| 113 | - break; |
|
| 114 | - default: |
|
| 115 | - break; |
|
| 116 | - } |
|
| 117 | - } else { |
|
| 118 | - continue; |
|
| 119 | - } |
|
| 120 | - } else { |
|
| 121 | - // If the property allows null, set it to null |
|
| 122 | - $property->setValue($mock, null); |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - return $mock; |
|
| 127 | - } |
|
| 82 | + $instanceType = $resourceType->getInstanceType(); |
|
| 83 | + $reflection = new \ReflectionClass($instanceType->name); |
|
| 84 | + $mock = $reflection->newInstanceWithoutConstructor(); |
|
| 85 | + |
|
| 86 | + foreach ($reflection->getProperties() as $property) { |
|
| 87 | + $property->setAccessible(true); |
|
| 88 | + |
|
| 89 | + $type = $property->getType(); |
|
| 90 | + if($resourceType instanceof ResourceProperty) { |
|
| 91 | + $resourceType = $resourceType->getResourceType(); |
|
| 92 | + } |
|
| 93 | + $resourceProperty = $resourceType->resolveProperty($property->getName()); |
|
| 94 | + if(is_null($resourceProperty)) continue; |
|
| 95 | + |
|
| 96 | + $resourcePropertyType = $resourceProperty->getResourceType(); |
|
| 97 | + $resourceKind = $resourcePropertyType->getResourceTypeKind(); |
|
| 98 | + if ($type && !$type->allowsNull()) { |
|
| 99 | + if ($resourceKind === ResourceTypeKind::PRIMITIVE) { |
|
| 100 | + switch ($type->getName()) { |
|
| 101 | + case 'int': |
|
| 102 | + $property->setValue($mock, 0); |
|
| 103 | + break; |
|
| 104 | + case 'string': |
|
| 105 | + $property->setValue($mock, ''); |
|
| 106 | + break; |
|
| 107 | + case 'bool': |
|
| 108 | + $property->setValue($mock, false); |
|
| 109 | + break; |
|
| 110 | + case 'array': |
|
| 111 | + // If the property is of type array, set it as an empty array |
|
| 112 | + $property->setValue($mock, []); |
|
| 113 | + break; |
|
| 114 | + default: |
|
| 115 | + break; |
|
| 116 | + } |
|
| 117 | + } else { |
|
| 118 | + continue; |
|
| 119 | + } |
|
| 120 | + } else { |
|
| 121 | + // If the property allows null, set it to null |
|
| 122 | + $property->setValue($mock, null); |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + return $mock; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * This function perform the following tasks with the help of internal helper |
@@ -87,11 +87,11 @@ |
||
| 87 | 87 | $property->setAccessible(true); |
| 88 | 88 | |
| 89 | 89 | $type = $property->getType(); |
| 90 | - if($resourceType instanceof ResourceProperty) { |
|
| 91 | - $resourceType = $resourceType->getResourceType(); |
|
| 90 | + if ($resourceType instanceof ResourceProperty) { |
|
| 91 | + $resourceType = $resourceType->getResourceType(); |
|
| 92 | 92 | } |
| 93 | 93 | $resourceProperty = $resourceType->resolveProperty($property->getName()); |
| 94 | - if(is_null($resourceProperty)) continue; |
|
| 94 | + if (is_null($resourceProperty)) continue; |
|
| 95 | 95 | |
| 96 | 96 | $resourcePropertyType = $resourceProperty->getResourceType(); |
| 97 | 97 | $resourceKind = $resourcePropertyType->getResourceTypeKind(); |
@@ -91,7 +91,9 @@ |
||
| 91 | 91 | $resourceType = $resourceType->getResourceType(); |
| 92 | 92 | } |
| 93 | 93 | $resourceProperty = $resourceType->resolveProperty($property->getName()); |
| 94 | - if(is_null($resourceProperty)) continue; |
|
| 94 | + if(is_null($resourceProperty)) { |
|
| 95 | + continue; |
|
| 96 | + } |
|
| 95 | 97 | |
| 96 | 98 | $resourcePropertyType = $resourceProperty->getResourceType(); |
| 97 | 99 | $resourceKind = $resourcePropertyType->getResourceTypeKind(); |