@@ -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 | } |
@@ -13,76 +13,76 @@ |
||
| 13 | 13 | class Antifraud extends Model |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @param array|null $data |
|
| 18 | - * array de dados do recurso `Antifraud` |
|
| 19 | - * |
|
| 20 | - * + [`'provider'`] array (opcional) dos dados do Address. |
|
| 21 | - * +   [`'name'`] string (opcional). |
|
| 22 | - * +   [`'credentials'`] array (opcional). |
|
| 23 | - * + [`'settings'`] array (opcional) dos dados do Address. |
|
| 24 | - * +   [`'enabled'`] bool (opcional). |
|
| 25 | - * +   [`'environment'`] enum {`'production'` | `'test'`} (opcional). |
|
| 26 | - * +   [`'consult_mode'`] enum {`'auto'` | `'manual'`} (opcional). |
|
| 27 | - * +   [`'capture_on_approval'`] bool (opcional). |
|
| 28 | - * +   [`'cancel_on_refused'`] bool (opcional). |
|
| 29 | - * +   [`'review_score_threshold'`] float (opcional). |
|
| 30 | - */ |
|
| 31 | - public function __construct(?array $data = []) |
|
| 32 | - { |
|
| 16 | + /** |
|
| 17 | + * @param array|null $data |
|
| 18 | + * array de dados do recurso `Antifraud` |
|
| 19 | + * |
|
| 20 | + * + [`'provider'`] array (opcional) dos dados do Address. |
|
| 21 | + * +   [`'name'`] string (opcional). |
|
| 22 | + * +   [`'credentials'`] array (opcional). |
|
| 23 | + * + [`'settings'`] array (opcional) dos dados do Address. |
|
| 24 | + * +   [`'enabled'`] bool (opcional). |
|
| 25 | + * +   [`'environment'`] enum {`'production'` | `'test'`} (opcional). |
|
| 26 | + * +   [`'consult_mode'`] enum {`'auto'` | `'manual'`} (opcional). |
|
| 27 | + * +   [`'capture_on_approval'`] bool (opcional). |
|
| 28 | + * +   [`'cancel_on_refused'`] bool (opcional). |
|
| 29 | + * +   [`'review_score_threshold'`] float (opcional). |
|
| 30 | + */ |
|
| 31 | + public function __construct(?array $data = []) |
|
| 32 | + { |
|
| 33 | 33 | parent::__construct($data); |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - protected function schema(SchemaBuilder $schema): Schema |
|
| 37 | - { |
|
| 36 | + protected function schema(SchemaBuilder $schema): Schema |
|
| 37 | + { |
|
| 38 | 38 | $schema->has('provider', AntifraudProvider::class)->nullable(); |
| 39 | 39 | $schema->has('settings', AntifraudSettings::class)->nullable(); |
| 40 | 40 | |
| 41 | 41 | return $schema->build(); |
| 42 | - } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Retorna o valor da propriedade `provider`. |
|
| 46 | - * |
|
| 47 | - * @return AntifraudProvider|null |
|
| 48 | - */ |
|
| 49 | - public function getProvider(): ?AntifraudProvider |
|
| 50 | - { |
|
| 44 | + /** |
|
| 45 | + * Retorna o valor da propriedade `provider`. |
|
| 46 | + * |
|
| 47 | + * @return AntifraudProvider|null |
|
| 48 | + */ |
|
| 49 | + public function getProvider(): ?AntifraudProvider |
|
| 50 | + { |
|
| 51 | 51 | return $this->get('provider'); |
| 52 | - } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Seta o valor da propriedade `provider`. |
|
| 56 | - * |
|
| 57 | - * @param AntifraudProvider|null $provider |
|
| 58 | - * @return self |
|
| 59 | - */ |
|
| 60 | - public function setProvider(?AntifraudProvider $provider = null): self |
|
| 61 | - { |
|
| 54 | + /** |
|
| 55 | + * Seta o valor da propriedade `provider`. |
|
| 56 | + * |
|
| 57 | + * @param AntifraudProvider|null $provider |
|
| 58 | + * @return self |
|
| 59 | + */ |
|
| 60 | + public function setProvider(?AntifraudProvider $provider = null): self |
|
| 61 | + { |
|
| 62 | 62 | $this->set('provider', $provider); |
| 63 | 63 | return $this; |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Retorna o valor da propriedade `settings`. |
|
| 68 | - * |
|
| 69 | - * @return AntifraudSettings|null |
|
| 70 | - */ |
|
| 71 | - public function getSettings(): ?AntifraudSettings |
|
| 72 | - { |
|
| 66 | + /** |
|
| 67 | + * Retorna o valor da propriedade `settings`. |
|
| 68 | + * |
|
| 69 | + * @return AntifraudSettings|null |
|
| 70 | + */ |
|
| 71 | + public function getSettings(): ?AntifraudSettings |
|
| 72 | + { |
|
| 73 | 73 | return $this->get('settings'); |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Seta o valor da propriedade `settings`. |
|
| 78 | - * |
|
| 79 | - * @param AntifraudSettings|null $settings |
|
| 80 | - * @return self |
|
| 81 | - */ |
|
| 82 | - public function setSettings(?AntifraudSettings $settings = null): self |
|
| 83 | - { |
|
| 76 | + /** |
|
| 77 | + * Seta o valor da propriedade `settings`. |
|
| 78 | + * |
|
| 79 | + * @param AntifraudSettings|null $settings |
|
| 80 | + * @return self |
|
| 81 | + */ |
|
| 82 | + public function setSettings(?AntifraudSettings $settings = null): self |
|
| 83 | + { |
|
| 84 | 84 | $this->set('settings', $settings); |
| 85 | 85 | return $this; |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | \ No newline at end of file |
@@ -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) || |