Completed
Pull Request — master (#63)
by Christopher
13:45 queued 04:13
created
src/POData/Common/Messages/expressionLexer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public static function expressionLexerUnterminatedStringLiteral($pos, $text)
16 16
     {
17
-        return 'Unterminated string literal at position '.$pos.' in '.$text;
17
+        return 'Unterminated string literal at position ' . $pos . ' in ' . $text;
18 18
     }
19 19
 
20 20
     /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public static function expressionLexerDigitExpected($pos)
28 28
     {
29
-        return 'Digit expected at position '.$pos;
29
+        return 'Digit expected at position ' . $pos;
30 30
     }
31 31
 
32 32
     /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public static function expressionLexerSyntaxError($pos)
40 40
     {
41
-        return 'Syntax Error at position '.$pos;
41
+        return 'Syntax Error at position ' . $pos;
42 42
     }
43 43
 
44 44
     /**
Please login to merge, or discard this patch.
src/POData/Common/Messages/keyDescriptor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public static function keyDescriptorInCompatibleKeyType($segment, $keyProperty, $expectedType, $actualType)
48 48
     {
49
-        return "Syntax error in the segment '$segment'. The value of key property '$keyProperty' should be of type ".$expectedType.', given '.$actualType;
49
+        return "Syntax error in the segment '$segment'. The value of key property '$keyProperty' should be of type " . $expectedType . ', given ' . $actualType;
50 50
     }
51 51
 
52 52
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public static function keyDescriptorInCompatibleKeyTypeAtPosition($segment, $keyProperty, $position, $expectedType, $actualType)
65 65
     {
66
-        return "Syntax error in the segment '$segment'. The value of key property '$keyProperty' at position $position should be of type ".$expectedType.', given '.$actualType;
66
+        return "Syntax error in the segment '$segment'. The value of key property '$keyProperty' at position $position should be of type " . $expectedType . ', given ' . $actualType;
67 67
     }
68 68
 
69 69
     /**
Please login to merge, or discard this patch.
src/POData/Common/ErrorHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
             $exception = new ODataException($exception->getMessage(), HttpStatus::CODE_INTERNAL_SERVER_ERROR);
48 48
         }
49 49
 
50
-        $service->getHost()->setResponseVersion(ODataConstants::DATASERVICEVERSION_1_DOT_0.';');
50
+        $service->getHost()->setResponseVersion(ODataConstants::DATASERVICEVERSION_1_DOT_0 . ';');
51 51
 
52 52
         // At this point all kind of exceptions will be converted
53 53
         //to 'ODataException'
Please login to merge, or discard this patch.
src/POData/Readers/Atom/AtomODataReader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         $name = $property->nodeName;
255 255
 
256 256
         if ($prefix != 'default') {
257
-            $prefix = $prefix.':';
257
+            $prefix = $prefix . ':';
258 258
             $pos = (false === ($index = strpos($name, $prefix))) ? 0 : $index + strlen($prefix);
259 259
             $name = substr($name, $pos);
260 260
         }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
                     if ($nodes->length) {
333 333
                         if (isset($attributes['NodeAttribute'])) {
334
-                            $attribute = $attributes['FC_NsPrefix'].':'.$attributes['NodeAttribute'];
334
+                            $attribute = $attributes['FC_NsPrefix'] . ':' . $attributes['NodeAttribute'];
335 335
                             $value = self::GetAttribute($nodes->item(0), $attribute);
336 336
                             if ((is_null($value) &&
337 337
                                 (isset($attributes['EdmType']) &&
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                             }
349 349
 
350 350
                             if (empty($value)) {
351
-                                $query1 = $propertyQuery.$propertyName;
351
+                                $query1 = $propertyQuery . $propertyName;
352 352
                                 $nodes1 = $xPath->Query($query1);
353 353
                                 if ($nodes1->length) {
354 354
                                     $value1 = self::GetAttribute($nodes1->item(0), 'm:null');
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                 }
399 399
             }
400 400
 
401
-            $query = $propertyQuery.$propertyName;
401
+            $query = $propertyQuery . $propertyName;
402 402
             $nodes = $xPath->Query($query);
403 403
             if ($nodes->length) {
404 404
                 $value = $nodes->item(0)->nodeValue;
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
         //Check and Process Complex Type
430 430
         //
431 431
         //make query string ex: "/m:properties/d:BoxArt"
432
-        $query = $propertyQuery.$propertyName;
432
+        $query = $propertyQuery . $propertyName;
433 433
         $nodes = $xPath->Query($query);
434 434
         if (!$nodes->length) {
435 435
             return false;
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
         $type = ClientType::Create(get_class($object));
520 520
         $keyPropertyNames = $type->geyKeyProperties();
521 521
         foreach ($keyPropertyNames as $keyPropertyName) {
522
-            $properties = $xPath->query(self::$QUERY_PROPERTY2.$keyPropertyName);
522
+            $properties = $xPath->query(self::$QUERY_PROPERTY2 . $keyPropertyName);
523 523
             if ($properties->length) {
524 524
                 $value = $properties->item(0)->nodeValue;
525 525
                 \POData\Common\ReflectionHandler::setProperty($object, $keyPropertyName, $value);
Please login to merge, or discard this patch.
src/POData/Providers/Query/SimpleQueryProvider.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
                 ++$index;
132 132
                 //Keys have already been validated, so this is not a SQL injection surface
133 133
                 $where .= $where ? ' AND ' : '';
134
-                $where .= $key.' = :param'.$index;
135
-                $parameters[':param'.$index] = $value[0];
134
+                $where .= $key . ' = :param' . $index;
135
+                $parameters[':param' . $index] = $value[0];
136 136
             }
137 137
         }
138 138
         foreach ($whereCondition as $fieldName => $fieldValue) {
139 139
             ++$index;
140 140
             $where .= $where ? ' AND ' : '';
141
-            $where .= $fieldName.' = :param'.$index;
142
-            $parameters[':param'.$index] = $fieldValue;
141
+            $where .= $fieldName . ' = :param' . $index;
142
+            $parameters[':param' . $index] = $fieldValue;
143 143
         }
144
-        $where = $where ? ' WHERE '.$where : '';
144
+        $where = $where ? ' WHERE ' . $where : '';
145 145
         $entityClassName = $resourceSet->getResourceType()->getInstanceType()->name;
146 146
         $entityName = $this->getEntityName($entityClassName);
147
-        $sql = 'SELECT * FROM '.$this->getTableName($entityName).$where.' LIMIT 1';
147
+        $sql = 'SELECT * FROM ' . $this->getTableName($entityName) . $where . ' LIMIT 1';
148 148
         $result = $this->queryAll($sql, $parameters);
149 149
         if ($result) {
150 150
             $result = $result[0];
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
             //tell mysql we want to know the count prior to the LIMIT
174 174
             //$option = 'SQL_CALC_FOUND_ROWS';
175 175
         }
176
-        $where = $filterInfo ? ' WHERE '.$filterInfo->getExpressionAsString() : '';
177
-        $order = $orderBy ? ' ORDER BY '.$this->getOrderByExpressionAsString($orderBy) : '';
178
-        $sqlCount = 'SELECT COUNT(*) FROM '.$tableName.$where;
176
+        $where = $filterInfo ? ' WHERE ' . $filterInfo->getExpressionAsString() : '';
177
+        $order = $orderBy ? ' ORDER BY ' . $this->getOrderByExpressionAsString($orderBy) : '';
178
+        $sqlCount = 'SELECT COUNT(*) FROM ' . $tableName . $where;
179 179
         if ($queryType == QueryType::ENTITIES() || $queryType == QueryType::ENTITIES_WITH_COUNT()) {
180
-            $sql = 'SELECT '.$option.' * FROM '.$tableName.$where.$order
181
-                    .($top ? ' LIMIT '.$top : '').($skip ? ' OFFSET '.$skip : '');
180
+            $sql = 'SELECT ' . $option . ' * FROM ' . $tableName . $where . $order
181
+                    .($top ? ' LIMIT ' . $top : '') . ($skip ? ' OFFSET ' . $skip : '');
182 182
             $data = $this->queryAll($sql);
183 183
 
184 184
             if ($queryType == QueryType::ENTITIES_WITH_COUNT()) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 //$result->count = $this->queryScalar('SELECT FOUND_ROWS()');
187 187
                 $result->count = $this->queryScalar($sqlCount);
188 188
             }
189
-            $result->results = array_map($entityClassName.'::fromRecord', $data);
189
+            $result->results = array_map($entityClassName . '::fromRecord', $data);
190 190
         } elseif ($queryType == QueryType::COUNT()) {
191 191
             $result->count = QueryResult::adjustCountForPaging(
192 192
                 $this->queryScalar($sqlCount),
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     ) {
225 225
         // Correct filter
226 226
         $srcClass = get_class($sourceEntityInstance);
227
-        $filterFieldName = $this->getTableName($this->getEntityName($srcClass)).'_id';
227
+        $filterFieldName = $this->getTableName($this->getEntityName($srcClass)) . '_id';
228 228
         $navigationPropertiesUsedInTheFilterClause = null;
229 229
         $filterExpAsDataSourceExp = '';
230 230
         if ($filterInfo) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $filterExpAsDataSourceExp = $filterInfo->getExpressionAsString();
233 233
         }
234 234
         $filterExpAsDataSourceExp .= $filterExpAsDataSourceExp ? ' AND ' : '';
235
-        $filterExpAsDataSourceExp .= $filterFieldName.' = '.$sourceEntityInstance->id;
235
+        $filterExpAsDataSourceExp .= $filterFieldName . ' = ' . $sourceEntityInstance->id;
236 236
         $completeFilterInfo = new FilterInfo($navigationPropertiesUsedInTheFilterClause, $filterExpAsDataSourceExp);
237 237
 
238 238
         return $this->getResourceSet($queryType, $targetResourceSet, $completeFilterInfo, $orderBy, $top, $skip);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     ) {
251 251
         $entityClassName = $sourceResourceSet->getResourceType()->getInstanceType()->name;
252 252
         $entityName = $this->getEntityName($entityClassName);
253
-        $fieldName = $this->getTableName($entityName).'_id';
253
+        $fieldName = $this->getTableName($entityName) . '_id';
254 254
 
255 255
         return $this->getResource($targetResourceSet, $keyDescriptor, [
256 256
             $fieldName => $sourceEntityInstance->id,
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     ) {
269 269
         $entityClassName = $targetResourceSet->getResourceType()->getInstanceType()->name;
270 270
         $entityName = $this->getEntityName($entityClassName);
271
-        $fieldName = $this->getTableName($entityName).'_id';
271
+        $fieldName = $this->getTableName($entityName) . '_id';
272 272
 
273 273
         return $this->getResource($targetResourceSet, null, [
274 274
             'id' => $sourceEntityInstance->$fieldName,
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/Type/Double.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
      */
100 100
     public function convertToOData($value)
101 101
     {
102
-        return $value.'D';
102
+        return $value . 'D';
103 103
     }
104 104
 
105 105
     /**
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/Type/DateTime.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             return false;
67 67
         }
68 68
 
69
-        $outValue = "'".$value."'";
69
+        $outValue = "'" . $value . "'";
70 70
 
71 71
         return true;
72 72
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function convertToOData($value)
108 108
     {
109
-        return 'datetime\''.urlencode($value).'\'';
109
+        return 'datetime\'' . urlencode($value) . '\'';
110 110
     }
111 111
 
112 112
     /**
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/Type/Guid.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
      */
108 108
     public function convertToOData($value)
109 109
     {
110
-        return 'guid\''.urlencode($value).'\'';
110
+        return 'guid\'' . urlencode($value) . '\'';
111 111
     }
112 112
 
113 113
     /**
Please login to merge, or discard this patch.
src/POData/Providers/Metadata/Type/Int64.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
      */
97 97
     public function convertToOData($value)
98 98
     {
99
-        return $value.'L';
99
+        return $value . 'L';
100 100
     }
101 101
 
102 102
     /**
Please login to merge, or discard this patch.