@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * @since 7.0.0 |
51 | 51 | * @deprecated 14.0.0 Move over to QBMapper |
52 | 52 | */ |
53 | - public function __construct(IDBConnection $db, $tableName, $entityClass=null){ |
|
53 | + public function __construct(IDBConnection $db, $tableName, $entityClass = null) { |
|
54 | 54 | $this->db = $db; |
55 | - $this->tableName = '*PREFIX*' . $tableName; |
|
55 | + $this->tableName = '*PREFIX*'.$tableName; |
|
56 | 56 | |
57 | 57 | // if not given set the entity name to the class without the mapper part |
58 | 58 | // cache it here for later use since reflection is slow |
59 | - if($entityClass === null) { |
|
59 | + if ($entityClass === null) { |
|
60 | 60 | $this->entityClass = str_replace('Mapper', '', get_class($this)); |
61 | 61 | } else { |
62 | 62 | $this->entityClass = $entityClass; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @since 7.0.0 |
70 | 70 | * @deprecated 14.0.0 Move over to QBMapper |
71 | 71 | */ |
72 | - public function getTableName(){ |
|
72 | + public function getTableName() { |
|
73 | 73 | return $this->tableName; |
74 | 74 | } |
75 | 75 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * @since 7.0.0 - return value added in 8.1.0 |
82 | 82 | * @deprecated 14.0.0 Move over to QBMapper |
83 | 83 | */ |
84 | - public function delete(Entity $entity){ |
|
85 | - $sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?'; |
|
84 | + public function delete(Entity $entity) { |
|
85 | + $sql = 'DELETE FROM `'.$this->tableName.'` WHERE `id` = ?'; |
|
86 | 86 | $stmt = $this->execute($sql, [$entity->getId()]); |
87 | 87 | $stmt->closeCursor(); |
88 | 88 | return $entity; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @since 7.0.0 |
97 | 97 | * @deprecated 14.0.0 Move over to QBMapper |
98 | 98 | */ |
99 | - public function insert(Entity $entity){ |
|
99 | + public function insert(Entity $entity) { |
|
100 | 100 | // get updated fields to save, fields have to be set using a setter to |
101 | 101 | // be saved |
102 | 102 | $properties = $entity->getUpdatedFields(); |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | |
107 | 107 | // build the fields |
108 | 108 | $i = 0; |
109 | - foreach($properties as $property => $updated) { |
|
109 | + foreach ($properties as $property => $updated) { |
|
110 | 110 | $column = $entity->propertyToColumn($property); |
111 | - $getter = 'get' . ucfirst($property); |
|
111 | + $getter = 'get'.ucfirst($property); |
|
112 | 112 | |
113 | - $columns .= '`' . $column . '`'; |
|
113 | + $columns .= '`'.$column.'`'; |
|
114 | 114 | $values .= '?'; |
115 | 115 | |
116 | 116 | // only append colon if there are more entries |
117 | - if($i < count($properties)-1){ |
|
117 | + if ($i < count($properties) - 1) { |
|
118 | 118 | $columns .= ','; |
119 | 119 | $values .= ','; |
120 | 120 | } |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | |
125 | 125 | } |
126 | 126 | |
127 | - $sql = 'INSERT INTO `' . $this->tableName . '`(' . |
|
128 | - $columns . ') VALUES(' . $values . ')'; |
|
127 | + $sql = 'INSERT INTO `'.$this->tableName.'`('. |
|
128 | + $columns.') VALUES('.$values.')'; |
|
129 | 129 | |
130 | 130 | $stmt = $this->execute($sql, $params); |
131 | 131 | |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | * @since 7.0.0 - return value was added in 8.0.0 |
147 | 147 | * @deprecated 14.0.0 Move over to QBMapper |
148 | 148 | */ |
149 | - public function update(Entity $entity){ |
|
149 | + public function update(Entity $entity) { |
|
150 | 150 | // if entity wasn't changed it makes no sense to run a db query |
151 | 151 | $properties = $entity->getUpdatedFields(); |
152 | - if(count($properties) === 0) { |
|
152 | + if (count($properties) === 0) { |
|
153 | 153 | return $entity; |
154 | 154 | } |
155 | 155 | |
156 | 156 | // entity needs an id |
157 | 157 | $id = $entity->getId(); |
158 | - if($id === null){ |
|
158 | + if ($id === null) { |
|
159 | 159 | throw new \InvalidArgumentException( |
160 | 160 | 'Entity which should be updated has no id'); |
161 | 161 | } |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | |
171 | 171 | // build the fields |
172 | 172 | $i = 0; |
173 | - foreach($properties as $property => $updated) { |
|
173 | + foreach ($properties as $property => $updated) { |
|
174 | 174 | |
175 | 175 | $column = $entity->propertyToColumn($property); |
176 | - $getter = 'get' . ucfirst($property); |
|
176 | + $getter = 'get'.ucfirst($property); |
|
177 | 177 | |
178 | - $columns .= '`' . $column . '` = ?'; |
|
178 | + $columns .= '`'.$column.'` = ?'; |
|
179 | 179 | |
180 | 180 | // only append colon if there are more entries |
181 | - if($i < count($properties)-1){ |
|
181 | + if ($i < count($properties) - 1) { |
|
182 | 182 | $columns .= ','; |
183 | 183 | } |
184 | 184 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | $i++; |
187 | 187 | } |
188 | 188 | |
189 | - $sql = 'UPDATE `' . $this->tableName . '` SET ' . |
|
190 | - $columns . ' WHERE `id` = ?'; |
|
189 | + $sql = 'UPDATE `'.$this->tableName.'` SET '. |
|
190 | + $columns.' WHERE `id` = ?'; |
|
191 | 191 | $params[] = $id; |
192 | 192 | |
193 | 193 | $stmt = $this->execute($sql, $params); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @since 7.0.0 |
237 | 237 | * @deprecated 14.0.0 Move over to QBMapper |
238 | 238 | */ |
239 | - protected function execute($sql, array $params=[], $limit=null, $offset=null){ |
|
239 | + protected function execute($sql, array $params = [], $limit = null, $offset = null) { |
|
240 | 240 | $query = $this->db->prepare($sql, $limit, $offset); |
241 | 241 | |
242 | 242 | if ($this->isAssocArray($params)) { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $query->bindValue($key, $param, $pdoConstant); |
246 | 246 | } |
247 | 247 | } else { |
248 | - $index = 1; // bindParam is 1 indexed |
|
248 | + $index = 1; // bindParam is 1 indexed |
|
249 | 249 | foreach ($params as $param) { |
250 | 250 | $pdoConstant = $this->getPDOType($param); |
251 | 251 | $query->bindValue($index, $param, $pdoConstant); |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | * @since 7.0.0 |
273 | 273 | * @deprecated 14.0.0 Move over to QBMapper |
274 | 274 | */ |
275 | - protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null){ |
|
275 | + protected function findOneQuery($sql, array $params = [], $limit = null, $offset = null) { |
|
276 | 276 | $stmt = $this->execute($sql, $params, $limit, $offset); |
277 | 277 | $row = $stmt->fetch(); |
278 | 278 | |
279 | - if($row === false || $row === null){ |
|
279 | + if ($row === false || $row === null) { |
|
280 | 280 | $stmt->closeCursor(); |
281 | 281 | $msg = $this->buildDebugMessage( |
282 | 282 | 'Did expect one result but found none when executing', $sql, $params, $limit, $offset |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $row2 = $stmt->fetch(); |
287 | 287 | $stmt->closeCursor(); |
288 | 288 | //MDB2 returns null, PDO and doctrine false when no row is available |
289 | - if( ! ($row2 === false || $row2 === null )) { |
|
289 | + if (!($row2 === false || $row2 === null)) { |
|
290 | 290 | $msg = $this->buildDebugMessage( |
291 | 291 | 'Did not expect more than one result when executing', $sql, $params, $limit, $offset |
292 | 292 | ); |
@@ -308,12 +308,12 @@ discard block |
||
308 | 308 | * @since 9.1.0 |
309 | 309 | * @deprecated 14.0.0 Move over to QBMapper |
310 | 310 | */ |
311 | - private function buildDebugMessage($msg, $sql, array $params=[], $limit=null, $offset=null) { |
|
312 | - return $msg . |
|
313 | - ': query "' . $sql . '"; ' . |
|
314 | - 'parameters ' . print_r($params, true) . '; ' . |
|
315 | - 'limit "' . $limit . '"; '. |
|
316 | - 'offset "' . $offset . '"'; |
|
311 | + private function buildDebugMessage($msg, $sql, array $params = [], $limit = null, $offset = null) { |
|
312 | + return $msg. |
|
313 | + ': query "'.$sql.'"; '. |
|
314 | + 'parameters '.print_r($params, true).'; '. |
|
315 | + 'limit "'.$limit.'"; '. |
|
316 | + 'offset "'.$offset.'"'; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @deprecated 14.0.0 Move over to QBMapper |
327 | 327 | */ |
328 | 328 | protected function mapRowToEntity($row) { |
329 | - return call_user_func($this->entityClass .'::fromRow', $row); |
|
329 | + return call_user_func($this->entityClass.'::fromRow', $row); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | * @since 7.0.0 |
341 | 341 | * @deprecated 14.0.0 Move over to QBMapper |
342 | 342 | */ |
343 | - protected function findEntities($sql, array $params=[], $limit=null, $offset=null) { |
|
343 | + protected function findEntities($sql, array $params = [], $limit = null, $offset = null) { |
|
344 | 344 | $stmt = $this->execute($sql, $params, $limit, $offset); |
345 | 345 | |
346 | 346 | $entities = []; |
347 | 347 | |
348 | - while($row = $stmt->fetch()){ |
|
348 | + while ($row = $stmt->fetch()) { |
|
349 | 349 | $entities[] = $this->mapRowToEntity($row); |
350 | 350 | } |
351 | 351 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @since 7.0.0 |
369 | 369 | * @deprecated 14.0.0 Move over to QBMapper |
370 | 370 | */ |
371 | - protected function findEntity($sql, array $params=[], $limit=null, $offset=null){ |
|
371 | + protected function findEntity($sql, array $params = [], $limit = null, $offset = null) { |
|
372 | 372 | return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset)); |
373 | 373 | } |
374 | 374 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function __construct($action) { |
33 | 33 | $l = \OC::$server->getL10N('federation'); |
34 | - $message = 'Action "' . $action . '" not supported or implemented.'; |
|
34 | + $message = 'Action "'.$action.'" not supported or implemented.'; |
|
35 | 35 | $hint = $l->t('Action "%s" not supported or implemented.', [$action]); |
36 | 36 | parent::__construct($message, $hint); |
37 | 37 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | try { |
58 | - $folder = $this->appData->getFolder((string)$node->getId()); |
|
58 | + $folder = $this->appData->getFolder((string) $node->getId()); |
|
59 | 59 | $folder->delete(); |
60 | 60 | } catch (NotFoundException $e) { |
61 | 61 | //Nothing to do |
@@ -57,7 +57,7 @@ |
||
57 | 57 | public function connectWatcher() { |
58 | 58 | // Do not connect if we are not setup yet! |
59 | 59 | if ($this->config->getValue('instanceid', null) !== null) { |
60 | - $this->root->listen('\OC\Files', 'postWrite', function (Node $node) { |
|
60 | + $this->root->listen('\OC\Files', 'postWrite', function(Node $node) { |
|
61 | 61 | $this->getWatcher()->postWrite($node); |
62 | 62 | }); |
63 | 63 |
@@ -162,7 +162,7 @@ |
||
162 | 162 | if (\is_array($scope)) { |
163 | 163 | parent::setScope(json_encode($scope)); |
164 | 164 | } else { |
165 | - parent::setScope((string)$scope); |
|
165 | + parent::setScope((string) $scope); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * PHP platform. |
51 | 51 | */ |
52 | 52 | public function __construct() { |
53 | - $pow_2_53 = (float)self::POW_2_53_MINUS_1 + 1.0; |
|
53 | + $pow_2_53 = (float) self::POW_2_53_MINUS_1 + 1.0; |
|
54 | 54 | if ($this->formatUnsignedInteger($pow_2_53) !== self::POW_2_53) { |
55 | 55 | throw new \RuntimeException( |
56 | 56 | 'This class assumes floats to be double precision or "better".' |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | try { |
189 | 189 | $result = filemtime($fullPath); |
190 | 190 | } catch (\Exception $e) { |
191 | - $result =- 1; |
|
191 | + $result = - 1; |
|
192 | 192 | } |
193 | 193 | if ($result < 0) { |
194 | 194 | if (\OC_Helper::is_function_enabled('exec')) { |
195 | 195 | $os = strtolower(php_uname('s')); |
196 | 196 | if (strpos($os, 'linux') !== false) { |
197 | - return $this->exec('stat -c %Y ' . escapeshellarg($fullPath)); |
|
197 | + return $this->exec('stat -c %Y '.escapeshellarg($fullPath)); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | if ($response_type !== 'code') { |
73 | 73 | //Fail |
74 | - $url = $client->getRedirectUri() . '?error=unsupported_response_type&state=' . $state; |
|
74 | + $url = $client->getRedirectUri().'?error=unsupported_response_type&state='.$state; |
|
75 | 75 | return new RedirectResponse($url); |
76 | 76 | } |
77 | 77 |
@@ -98,7 +98,7 @@ |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // We handle the initial and refresh tokens the same way |
101 | - if ($grant_type === 'refresh_token' ) { |
|
101 | + if ($grant_type === 'refresh_token') { |
|
102 | 102 | $code = $refresh_token; |
103 | 103 | } |
104 | 104 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | $cursor = $qb->execute(); |
63 | 63 | |
64 | - while($row = $cursor->fetch()) { |
|
64 | + while ($row = $cursor->fetch()) { |
|
65 | 65 | $token = AccessToken::fromRow($row); |
66 | 66 | try { |
67 | 67 | $appToken = $this->tokenProvider->getTokenById($token->getTokenId()); |