@@ -131,20 +131,20 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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, |
@@ -99,7 +99,7 @@ |
||
99 | 99 | */ |
100 | 100 | public function convertToOData($value) |
101 | 101 | { |
102 | - return $value.'D'; |
|
102 | + return $value . 'D'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -66,7 +66,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -107,7 +107,7 @@ |
||
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 | /** |
@@ -96,7 +96,7 @@ |
||
96 | 96 | */ |
97 | 97 | public function convertToOData($value) |
98 | 98 | { |
99 | - return $value.'L'; |
|
99 | + return $value . 'L'; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function convertToOData($value) |
107 | 107 | { |
108 | - return 'binary\''.bin2hex($value).'\''; |
|
108 | + return 'binary\'' . bin2hex($value) . '\''; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public static function validateWithoutPrefix($value, &$outValue) |
120 | 120 | { |
121 | 121 | $length = strlen($value); |
122 | - if (0 == $length || 0 != $length % 2) { |
|
122 | + if (0 == $length || 0 != $length%2) { |
|
123 | 123 | return false; |
124 | 124 | } |
125 | 125 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | */ |
100 | 100 | public function convertToOData($value) |
101 | 101 | { |
102 | - return $value.'F'; |
|
102 | + return $value . 'F'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -100,7 +100,7 @@ |
||
100 | 100 | */ |
101 | 101 | public function convertToOData($value) |
102 | 102 | { |
103 | - return '\''.str_replace('%27', "''", urlencode(utf8_encode($value))).'\''; |
|
103 | + return '\'' . str_replace('%27', "''", urlencode(utf8_encode($value))) . '\''; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -77,7 +77,7 @@ |
||
77 | 77 | */ |
78 | 78 | public function convertToOData($value) |
79 | 79 | { |
80 | - return $value.'M'; |
|
80 | + return $value . 'M'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |