@@ -21,10 +21,10 @@ |
||
| 21 | 21 | $ar = explode(':', $payload); |
| 22 | 22 | if (is_array($ar)) { |
| 23 | 23 | if (isset($ar[0])) { |
| 24 | - $res->roleId = (string)$ar[0]; |
|
| 24 | + $res->roleId = (string) $ar[0]; |
|
| 25 | 25 | } |
| 26 | 26 | if (isset($ar[1])) { |
| 27 | - $res->userId = (string)$ar[1]; |
|
| 27 | + $res->userId = (string) $ar[1]; |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | return $res; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->parentRepository = $parentRepository; |
| 36 | 36 | $this->serializer = $serializer; |
| 37 | 37 | $this->client = $client; |
| 38 | - $this->keyPrefix = $versionPrefix === '' ? '' : $versionPrefix . '-'; |
|
| 38 | + $this->keyPrefix = $versionPrefix === '' ? '' : $versionPrefix.'-'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | // Implement lock to make other request waiting for cache warming. |
| 73 | 73 | $book = $this->transaction( |
| 74 | 74 | $this->client, |
| 75 | - $this->keyPrefix . 'lock-book-' . $id, |
|
| 75 | + $this->keyPrefix.'lock-book-'.$id, |
|
| 76 | 76 | static::LOCK_TTL, |
| 77 | - function () use ($id) { |
|
| 77 | + function() use ($id) { |
|
| 78 | 78 | $book = $this->parentRepository->load($id); |
| 79 | 79 | // And after that we can warm our temporary-storage. |
| 80 | 80 | if ($book) { |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | protected function formatKey($id, bool $withIncludes): string |
| 183 | 183 | { |
| 184 | - $res = $this->keyPrefix . 'book-'; |
|
| 184 | + $res = $this->keyPrefix.'book-'; |
|
| 185 | 185 | if ($withIncludes) { |
| 186 | 186 | $res .= 'wi-'; |
| 187 | 187 | } |
| 188 | - return $res . $id; |
|
| 188 | + return $res.$id; |
|
| 189 | 189 | } |
| 190 | 190 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $this->parentRepository = $parentRepository; |
| 43 | 43 | $this->serializer = $serializer; |
| 44 | 44 | $this->client = $client; |
| 45 | - $this->keyPrefix = $versionPrefix === '' ? '' : $versionPrefix . '-'; |
|
| 45 | + $this->keyPrefix = $versionPrefix === '' ? '' : $versionPrefix.'-'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | // Implement lock to make other request waiting for cache warming. |
| 81 | 81 | $author = $this->transaction( |
| 82 | 82 | $this->client, |
| 83 | - $this->keyPrefix . 'lock-author-' . $id, |
|
| 83 | + $this->keyPrefix.'lock-author-'.$id, |
|
| 84 | 84 | static::LOCK_TTL, |
| 85 | - function () use ($id) { |
|
| 85 | + function() use ($id) { |
|
| 86 | 86 | $author = $this->parentRepository->load($id); |
| 87 | 87 | // And after that we can warm our temporary-storage. |
| 88 | 88 | if ($author) { |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | protected function formatKey($id, bool $withIncludes): string |
| 195 | 195 | { |
| 196 | - $res = $this->keyPrefix . 'author-'; |
|
| 196 | + $res = $this->keyPrefix.'author-'; |
|
| 197 | 197 | if ($withIncludes) { |
| 198 | 198 | $res .= 'wi-'; |
| 199 | 199 | } |
| 200 | - return $res . $id; |
|
| 200 | + return $res.$id; |
|
| 201 | 201 | } |
| 202 | 202 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $object = null; |
| 25 | 25 | |
| 26 | 26 | if ($data != '') { |
| 27 | - $object = $this->serializer->deserialize((string)$data); |
|
| 27 | + $object = $this->serializer->deserialize((string) $data); |
|
| 28 | 28 | |
| 29 | 29 | if (!($object instanceof $classname)) { |
| 30 | 30 | // Do not generate error, just ignore not correct value. |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function prepareConnection(string $host, string $user, string $password, string $dbname): void |
| 23 | 23 | { |
| 24 | - $this->connection = function () use ($host, $user, $password, $dbname): \PDO { |
|
| 24 | + $this->connection = function() use ($host, $user, $password, $dbname): \PDO { |
|
| 25 | 25 | if (!$this->pdoReady) { |
| 26 | 26 | $this->pdo = new \PDO( |
| 27 | 27 | sprintf('mysql:dbname=%s;host=%s', $dbname, $host), |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $stmt = $pdo->prepare("SELECT * FROM $table WHERE id = ? LIMIT 1"); |
| 50 | 50 | if ($stmt === false) { |
| 51 | - throw new Exception("Can not init PDO: " . json_encode($pdo->errorInfo()), (int)$pdo->errorCode()); |
|
| 51 | + throw new Exception("Can not init PDO: ".json_encode($pdo->errorInfo()), (int) $pdo->errorCode()); |
|
| 52 | 52 | } |
| 53 | 53 | $stmt->execute([$id]); |
| 54 | 54 | $res = $stmt->fetch(\PDO::FETCH_ASSOC); |
@@ -78,18 +78,18 @@ discard block |
||
| 78 | 78 | // Prepare SQL with params. |
| 79 | 79 | $sql = "SELECT * FROM $table"; |
| 80 | 80 | if ($condition != '') { |
| 81 | - $sql .= ' WHERE ' . $condition; |
|
| 81 | + $sql .= ' WHERE '.$condition; |
|
| 82 | 82 | } |
| 83 | 83 | if ($order != '') { |
| 84 | - $sql .= ' ORDER BY ' . $order; |
|
| 84 | + $sql .= ' ORDER BY '.$order; |
|
| 85 | 85 | } |
| 86 | 86 | if ($limit > 0) { |
| 87 | - $sql .= ' LIMIT ' . $limit; |
|
| 87 | + $sql .= ' LIMIT '.$limit; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $stmt = $pdo->prepare($sql); |
| 91 | 91 | if ($stmt === false) { |
| 92 | - throw new Exception("Can not init PDO: " . json_encode($pdo->errorInfo()), (int)$pdo->errorCode()); |
|
| 92 | + throw new Exception("Can not init PDO: ".json_encode($pdo->errorInfo()), (int) $pdo->errorCode()); |
|
| 93 | 93 | } |
| 94 | 94 | $stmt->execute($conditionData); |
| 95 | 95 | $res = $stmt->fetchAll(\PDO::FETCH_ASSOC); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $rowValues .= ','; |
| 119 | 119 | } |
| 120 | 120 | $rowNames .= $name; |
| 121 | - $rowValues .= ':' . $name; |
|
| 121 | + $rowValues .= ':'.$name; |
|
| 122 | 122 | } else { |
| 123 | 123 | unset($data[$name]); |
| 124 | 124 | } |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | $pdo = ($this->connection)(); |
| 129 | 129 | $stmt = $pdo->prepare("INSERT INTO $table ($rowNames) VALUES ($rowValues)"); |
| 130 | 130 | if ($stmt === false) { |
| 131 | - throw new Exception("Can not init PDO: " . json_encode($pdo->errorInfo()), (int)$pdo->errorCode()); |
|
| 131 | + throw new Exception("Can not init PDO: ".json_encode($pdo->errorInfo()), (int) $pdo->errorCode()); |
|
| 132 | 132 | } |
| 133 | 133 | if (!$stmt->execute($data)) { |
| 134 | - throw new Exception("Can not insert data in PDO: " . json_encode($pdo->errorInfo()), (int)$pdo->errorCode()); |
|
| 134 | + throw new Exception("Can not insert data in PDO: ".json_encode($pdo->errorInfo()), (int) $pdo->errorCode()); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | return $pdo->lastInsertId(); |
@@ -37,6 +37,6 @@ |
||
| 37 | 37 | return true; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - return $this->authorRepository->loadByNameBirthdate((string)$value, $this->birthdate) === null; |
|
| 40 | + return $this->authorRepository->loadByNameBirthdate((string) $value, $this->birthdate) === null; |
|
| 41 | 41 | } |
| 42 | 42 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if (count($bearer) >= 1) { |
| 69 | 69 | $ar = explode(' ', $bearer[0]); |
| 70 | 70 | if (count($ar) >= 2 && $ar[0] === 'Bearer') { |
| 71 | - $this->proceedData((string)base64_decode($ar[1])); |
|
| 71 | + $this->proceedData((string) base64_decode($ar[1])); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | // Authenticate only if secret is valid. |
| 89 | 89 | $this->isAuthenticated = true; |
| 90 | 90 | if (isset($decoded->payload)) { |
| 91 | - $this->payload = (string)$decoded->payload; |
|
| 91 | + $this->payload = (string) $decoded->payload; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function get(): string |
| 13 | 13 | { |
| 14 | - return (string)file_get_contents('php://input'); |
|
| 14 | + return (string) file_get_contents('php://input'); |
|
| 15 | 15 | } |
| 16 | 16 | } |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | protected function getDispatcher(): Dispatcher |
| 156 | 156 | { |
| 157 | 157 | if (!isset($this->dispatcher)) { |
| 158 | - $this->dispatcher = \FastRoute\simpleDispatcher(function (\FastRoute\RouteCollector $r) { |
|
| 158 | + $this->dispatcher = \FastRoute\simpleDispatcher(function(\FastRoute\RouteCollector $r) { |
|
| 159 | 159 | $r->addRoute('GET', '/', 'index'); |
| 160 | 160 | |
| 161 | 161 | $r->addRoute('GET', '/healthcheck', 'healthcheck'); |