@@ -269,7 +269,7 @@ |
||
| 269 | 269 | $replace = []; |
| 270 | 270 | $args = func_get_args(); |
| 271 | 271 | |
| 272 | - for ($i = 1, $max = count($args); $i < $max; $i ++) { |
|
| 272 | + for ($i = 1, $max = count($args); $i < $max; $i++) { |
|
| 273 | 273 | $replace['{arg:' . $i . '}'] = $args[$i]; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | function site(string $param = null): string { |
| 9 | - if($param && !empty(SITE[$param])) { |
|
| 9 | + if ($param && !empty(SITE[$param])) { |
|
| 10 | 10 | return SITE[$param]; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function flash(string $type = null, string $message = null): ?string { |
| 43 | - if($type && $message) { |
|
| 43 | + if ($type && $message) { |
|
| 44 | 44 | $_SESSION['flash'] = [ |
| 45 | 45 | 'type' => $type, |
| 46 | 46 | 'message' => $message |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | return null; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if(!empty($_SESSION['flash']) && $flash = $_SESSION['flash']) { |
|
| 51 | + if (!empty($_SESSION['flash']) && $flash = $_SESSION['flash']) { |
|
| 52 | 52 | unset($_SESSION['flash']); |
| 53 | 53 | return "<div class=\"message {$flash["type"]}\">{$flash["message"]}</div>"; |
| 54 | 54 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | curl_close($curl); |
| 174 | 174 | |
| 175 | 175 | if ($curlError) { |
| 176 | - return [ 'curl_error' => $curlError ]; |
|
| 176 | + return ['curl_error' => $curlError]; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return [ |
@@ -91,8 +91,7 @@ |
||
| 91 | 91 | */ |
| 92 | 92 | try { |
| 93 | 93 | $route->dispatch(); |
| 94 | -} |
|
| 95 | -catch (\Throwable $throwable) { |
|
| 94 | +} catch (\Throwable $throwable) { |
|
| 96 | 95 | $Message = new stdClass(); |
| 97 | 96 | $Message->status = '500 ' . HTTP_500; |
| 98 | 97 | $Message->message = $throwable->getMessage(); |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | public function __construct(string $message = null, int $code = 0) |
| 44 | 44 | { |
| 45 | 45 | if (!$message) { |
| 46 | - throw new $this('Unknown '. get_class($this)); |
|
| 46 | + throw new $this('Unknown ' . get_class($this)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | parent::__construct($message, $code); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $email = filter_var($data["email"], FILTER_VALIDATE_EMAIL); |
| 33 | 33 | $passwd = filter_var($data["password"], FILTER_DEFAULT); |
| 34 | 34 | |
| 35 | - if(!$email || !$passwd) { |
|
| 35 | + if (!$email || !$passwd) { |
|
| 36 | 36 | $this->Message->message = 'Informe seu e-mail e senha para logar'; |
| 37 | 37 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 38 | 38 | return; |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | $first_name = filter_var($data["first_name"], FILTER_DEFAULT); |
| 74 | 74 | $last_name = filter_var($data["last_name"], FILTER_DEFAULT); |
| 75 | 75 | |
| 76 | - if(!$email || !$passwd) { |
|
| 76 | + if (!$email || !$passwd) { |
|
| 77 | 77 | $this->Message->message = 'Informe um e-mail e uma senha para se cadastrar!'; |
| 78 | 78 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(!$first_name) { |
|
| 82 | + if (!$first_name) { |
|
| 83 | 83 | $this->Message->message = 'Informe seu primeiro nome para se cadastrar!'; |
| 84 | 84 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 85 | 85 | return; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if(!$last_name) { |
|
| 88 | + if (!$last_name) { |
|
| 89 | 89 | $this->Message->message = 'Informe seu ultimo nome para se cadastrar!'; |
| 90 | 90 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 91 | 91 | return; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $email = filter_var($data["email"], FILTER_VALIDATE_EMAIL); |
| 129 | 129 | |
| 130 | - if(!$email) { |
|
| 130 | + if (!$email) { |
|
| 131 | 131 | $this->Message->message = 'Informe um e-mail valido para continuar'; |
| 132 | 132 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 133 | 133 | return; |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | $passwd = filter_var($data["password"], FILTER_DEFAULT); |
| 192 | 192 | $passwdRepeat = filter_var($data["passwordRepeat"], FILTER_DEFAULT); |
| 193 | 193 | |
| 194 | - if(!$passwd || !$passwdRepeat) { |
|
| 194 | + if (!$passwd || !$passwdRepeat) { |
|
| 195 | 195 | $this->Message->message = 'Informe e repita sua nova senha!'; |
| 196 | 196 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if($passwd != $passwdRepeat) { |
|
| 200 | + if ($passwd != $passwdRepeat) { |
|
| 201 | 201 | $this->Message->message = 'As senhas nao batem!'; |
| 202 | 202 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 203 | 203 | return; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $Redis = (new Redis())->getClient(); |
| 235 | 235 | |
| 236 | - if ($Redis->del($token->id.$token->expirationTime) === 0) { |
|
| 236 | + if ($Redis->del($token->id . $token->expirationTime) === 0) { |
|
| 237 | 237 | $this->Message->message = 'Ocorreu algum erro!'; |
| 238 | 238 | (new Response())->setStatusCode(HTTP_OK)->send($this->Message); |
| 239 | 239 | return; |
@@ -77,12 +77,10 @@ discard block |
||
| 77 | 77 | if (!empty($data['filterColumn'])) { |
| 78 | 78 | if (!empty($data['selfId'])) { |
| 79 | 79 | $find = $Product->find("{$data['filterColumn']} = {$data['filterValue']} AND id != {$data['selfId']}"); |
| 80 | - } |
|
| 81 | - else { |
|
| 80 | + } else { |
|
| 82 | 81 | $find = $Product->find("{$data['filterColumn']} = {$data['filterValue']}"); |
| 83 | 82 | } |
| 84 | - } |
|
| 85 | - else { |
|
| 83 | + } else { |
|
| 86 | 84 | $find = $Product->find(); |
| 87 | 85 | } |
| 88 | 86 | |
@@ -255,8 +253,7 @@ discard block |
||
| 255 | 253 | |
| 256 | 254 | try { |
| 257 | 255 | $base64 = getimagesizefromstring(base64_decode(explode(',', $base64Image)[1])); |
| 258 | - } |
|
| 259 | - catch (\Exception $e) { |
|
| 256 | + } catch (\Exception $e) { |
|
| 260 | 257 | $this->Message->message = 'imagem invalida'; |
| 261 | 258 | (new Response())->setStatusCode(HTTP_BAD_REQUEST)->send($this->Message); |
| 262 | 259 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if (isset($data['first_name'])) { |
| 77 | 77 | $first_name = filter_var($data["first_name"], FILTER_DEFAULT); |
| 78 | 78 | |
| 79 | - if(!$first_name) { |
|
| 79 | + if (!$first_name) { |
|
| 80 | 80 | $this->Message->message = 'Nome inválido'; |
| 81 | 81 | (new Response())->setStatusCode(HTTP_PARTIAL_CONTENT)->send($this->Message); |
| 82 | 82 | return; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | if (isset($data['last_name'])) { |
| 87 | 87 | $last_name = filter_var($data["last_name"], FILTER_DEFAULT); |
| 88 | 88 | |
| 89 | - if(!$last_name) { |
|
| 89 | + if (!$last_name) { |
|
| 90 | 90 | $this->Message->message = 'Nome inválido'; |
| 91 | 91 | (new Response())->setStatusCode(HTTP_PARTIAL_CONTENT)->send($this->Message); |
| 92 | 92 | return; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if (isset($data['birth_date'])) { |
| 97 | 97 | $birth_date = filter_var($data["birth_date"], FILTER_DEFAULT); |
| 98 | 98 | |
| 99 | - if(!$birth_date) { |
|
| 99 | + if (!$birth_date) { |
|
| 100 | 100 | $this->Message->message = 'Data de nascimento inválida'; |
| 101 | 101 | (new Response())->setStatusCode(HTTP_PARTIAL_CONTENT)->send($this->Message); |
| 102 | 102 | return; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | protected function consume() |
| 28 | 28 | { |
| 29 | - $callback = function ($message) { $this->handler($message); }; |
|
| 29 | + $callback = function($message) { $this->handler($message); }; |
|
| 30 | 30 | $this->channel->basic_consume($this->getQueue(), 'consumer', false, $this->getReply(), false, false, $callback); |
| 31 | 31 | |
| 32 | 32 | $pid = pcntl_fork(); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | protected function safe(): ?array |
| 286 | 286 | { |
| 287 | - $safe = (array)$this->data; |
|
| 287 | + $safe = (array) $this->data; |
|
| 288 | 288 | foreach (static::$protected as $unset) { |
| 289 | 289 | unset($safe[$unset]); |
| 290 | 290 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | protected function required(): bool |
| 311 | 311 | { |
| 312 | - $data = (array)$this->data(); |
|
| 312 | + $data = (array) $this->data(); |
|
| 313 | 313 | foreach (static::$required as $field) { |
| 314 | 314 | if (empty($data[$field])) { |
| 315 | 315 | return false; |