@@ -43,10 +43,9 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $found = |
| 46 | - array_search |
|
| 47 | - ( |
|
| 46 | + array_search( |
|
| 48 | 47 | $state, |
| 49 | - array_map(function ($v) { |
|
| 48 | + array_map(function($v) { |
|
| 50 | 49 | return strtoupper(self::sanitizeString($v)); |
| 51 | 50 | }, self::$states) |
| 52 | 51 | ); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public static function extractStrings(array $data): array |
| 49 | 49 | { |
| 50 | - return array_reduce($data, function ($strings, $value) { |
|
| 50 | + return array_reduce($data, function($strings, $value) { |
|
| 51 | 51 | if (is_array($value)) { |
| 52 | 52 | return array_merge($strings, self::extractStrings($value)); |
| 53 | 53 | } elseif (is_string($value) && !is_numeric($value)) { |
@@ -28,10 +28,11 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function unSerialize(): self |
| 30 | 30 | { |
| 31 | - if (empty($this->raw) || gettype(json_decode($this->raw)) === 'string') |
|
| 32 | - $this->data = ['data' => $this->raw]; |
|
| 33 | - else |
|
| 34 | - $this->data = $this->serializer ? $this->serializer->unserialize($this->raw) : null; |
|
| 31 | + if (empty($this->raw) || gettype(json_decode($this->raw)) === 'string') { |
|
| 32 | + $this->data = ['data' => $this->raw]; |
|
| 33 | + } else { |
|
| 34 | + $this->data = $this->serializer ? $this->serializer->unserialize($this->raw) : null; |
|
| 35 | + } |
|
| 35 | 36 | |
| 36 | 37 | return $this; |
| 37 | 38 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | * @param array|null $filters |
| 58 | 58 | * @return Response |
| 59 | 59 | */ |
| 60 | - public function list(?array $filters = []): Response |
|
| 60 | + public function list(?array $filters = []) : Response |
|
| 61 | 61 | { |
| 62 | 62 | return $this->_GET($filters ?? []); |
| 63 | 63 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * @param array|null $filters |
| 23 | 23 | * @return Response |
| 24 | 24 | */ |
| 25 | - public function list(?array $filters = []): Response |
|
| 25 | + public function list(?array $filters = []) : Response |
|
| 26 | 26 | { |
| 27 | 27 | return $this->_GET($filters, [], '/transactions'); |
| 28 | 28 | } |
@@ -30,10 +30,8 @@ |
||
| 30 | 30 | return new Mutator( |
| 31 | 31 | null, |
| 32 | 32 | fn($value, $ctx) => |
| 33 | - is_null($value) ? $value : |
|
| 34 | - ( |
|
| 35 | - Assert::value($value)->array() ? $value : |
|
| 36 | - $ctx->raise('inválido (informe um array de actions de webhook)') |
|
| 33 | + is_null($value) ? $value : ( |
|
| 34 | + Assert::value($value)->array() ? $value : $ctx->raise('inválido (informe um array de actions de webhook)') |
|
| 37 | 35 | ) |
| 38 | 36 | ); |
| 39 | 37 | } |
@@ -24,8 +24,9 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function __construct(array $data = [], array $relations = [], ?string $name = null) |
| 26 | 26 | { |
| 27 | - if (is_numeric(key($data))) |
|
| 28 | - throw new \Exception('Dados mal formatados passado para o construtor da classe ' . ClassUtil::basename(static::class)); |
|
| 27 | + if (is_numeric(key($data))) { |
|
| 28 | + throw new \Exception('Dados mal formatados passado para o construtor da classe ' . ClassUtil::basename(static::class)); |
|
| 29 | + } |
|
| 29 | 30 | |
| 30 | 31 | $this->data = $data; |
| 31 | 32 | $this->relations = $relations; |
@@ -82,8 +82,7 @@ discard block |
||
| 82 | 82 | null, |
| 83 | 83 | fn($value, $ctx) => |
| 84 | 84 | is_null($value) ? |
| 85 | - $value : |
|
| 86 | - Assert::value($value)->asCpf(false)->or()->asCnpj(false)->get() ?? $ctx->raise('inválido') |
|
| 85 | + $value : Assert::value($value)->asCpf(false)->or()->asCnpj(false)->get() ?? $ctx->raise('inválido') |
|
| 87 | 86 | ); |
| 88 | 87 | } |
| 89 | 88 | |
@@ -93,8 +92,7 @@ discard block |
||
| 93 | 92 | null, |
| 94 | 93 | fn($value, $ctx) => |
| 95 | 94 | is_null($value) ? |
| 96 | - $value : |
|
| 97 | - Assert::value($value)->email()->get() ?? $ctx->raise('inválido') |
|
| 95 | + $value : Assert::value($value)->email()->get() ?? $ctx->raise('inválido') |
|
| 98 | 96 | ); |
| 99 | 97 | } |
| 100 | 98 | |
@@ -104,8 +102,7 @@ discard block |
||
| 104 | 102 | null, |
| 105 | 103 | fn($value, $ctx) => |
| 106 | 104 | is_null($value) ? |
| 107 | - $value : |
|
| 108 | - Assert::value($value)->asDigits()->lbetween(10, 11)->get() ?? $ctx->raise('inválido') |
|
| 105 | + $value : Assert::value($value)->asDigits()->lbetween(10, 11)->get() ?? $ctx->raise('inválido') |
|
| 109 | 106 | ); |
| 110 | 107 | } |
| 111 | 108 | |
@@ -113,7 +110,7 @@ discard block |
||
| 113 | 110 | { |
| 114 | 111 | return new Mutator( |
| 115 | 112 | null, |
| 116 | - function ($value, $ctx) { |
|
| 113 | + function($value, $ctx) { |
|
| 117 | 114 | $d = \DateTime::createFromFormat('Y-m-d', $value); |
| 118 | 115 | |
| 119 | 116 | return is_null($value) || |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | return new Mutator( |
| 40 | 40 | null, |
| 41 | - function ($value, $ctx) { |
|
| 41 | + function($value, $ctx) { |
|
| 42 | 42 | $d = \DateTime::createFromFormat('Y-m-d', $value); |
| 43 | 43 | |
| 44 | 44 | return is_null($value) || |