@@ -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 | } |
@@ -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 |
@@ -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; |
@@ -13,69 +13,69 @@ |
||
13 | 13 | class AntifraudProvider extends Model |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @param array $data |
|
18 | - * array de dados do recurso `AntifraudProvider` |
|
19 | - * |
|
20 | - * + [`'name'`] string (opcional). |
|
21 | - * + [`'credentials'`] array (opcional). |
|
22 | - */ |
|
16 | + /** |
|
17 | + * @param array $data |
|
18 | + * array de dados do recurso `AntifraudProvider` |
|
19 | + * |
|
20 | + * + [`'name'`] string (opcional). |
|
21 | + * + [`'credentials'`] array (opcional). |
|
22 | + */ |
|
23 | 23 | |
24 | - public function __construct(?array $data = []) |
|
25 | - { |
|
24 | + public function __construct(?array $data = []) |
|
25 | + { |
|
26 | 26 | parent::__construct($data); |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - protected function schema(SchemaBuilder $schema): Schema |
|
30 | - { |
|
29 | + protected function schema(SchemaBuilder $schema): Schema |
|
30 | + { |
|
31 | 31 | $schema->string('name')->nullable(); |
32 | 32 | $schema->any('credentials')->nullable(); |
33 | 33 | |
34 | 34 | return $schema->build(); |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Retorna o valor da propriedade `name`. |
|
39 | - * |
|
40 | - * @return string|null |
|
41 | - */ |
|
42 | - public function getName(): ?string |
|
43 | - { |
|
37 | + /** |
|
38 | + * Retorna o valor da propriedade `name`. |
|
39 | + * |
|
40 | + * @return string|null |
|
41 | + */ |
|
42 | + public function getName(): ?string |
|
43 | + { |
|
44 | 44 | return $this->get('name'); |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Seta o valor da propriedade `name`. |
|
49 | - * |
|
50 | - * @param string|null $name |
|
51 | - * @return self |
|
52 | - */ |
|
53 | - public function setName(?string $name = null): self |
|
54 | - { |
|
47 | + /** |
|
48 | + * Seta o valor da propriedade `name`. |
|
49 | + * |
|
50 | + * @param string|null $name |
|
51 | + * @return self |
|
52 | + */ |
|
53 | + public function setName(?string $name = null): self |
|
54 | + { |
|
55 | 55 | $this->set('name', $name); |
56 | 56 | return $this; |
57 | - } |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Retorna o valor da propriedade `credentials`. |
|
61 | - * |
|
62 | - * @return array|null |
|
63 | - */ |
|
64 | - public function getCredentials(): ?array |
|
65 | - { |
|
59 | + /** |
|
60 | + * Retorna o valor da propriedade `credentials`. |
|
61 | + * |
|
62 | + * @return array|null |
|
63 | + */ |
|
64 | + public function getCredentials(): ?array |
|
65 | + { |
|
66 | 66 | return $this->get('credentials'); |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Seta o valor da propriedade `credentials`. |
|
71 | - * |
|
72 | - * @param array|null $credentials |
|
73 | - * @return self |
|
74 | - */ |
|
75 | - public function setCredentials(?array $credentials = null): self |
|
76 | - { |
|
69 | + /** |
|
70 | + * Seta o valor da propriedade `credentials`. |
|
71 | + * |
|
72 | + * @param array|null $credentials |
|
73 | + * @return self |
|
74 | + */ |
|
75 | + public function setCredentials(?array $credentials = null): self |
|
76 | + { |
|
77 | 77 | $this->set('credentials', $credentials); |
78 | 78 | return $this; |
79 | - } |
|
79 | + } |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -128,21 +128,25 @@ |
||
128 | 128 | { |
129 | 129 | $responseData = $response->getParsedPath('message'); |
130 | 130 | |
131 | - if (is_string($responseData)) |
|
132 | - return [$responseData]; |
|
131 | + if (is_string($responseData)) { |
|
132 | + return [$responseData]; |
|
133 | + } |
|
133 | 134 | |
134 | - if (is_array($responseData)) |
|
135 | - return ArrayUtil::extractStrings($responseData); |
|
135 | + if (is_array($responseData)) { |
|
136 | + return ArrayUtil::extractStrings($responseData); |
|
137 | + } |
|
136 | 138 | |
137 | 139 | $responseData = $response->getParsedPath('error'); |
138 | 140 | |
139 | - if (is_array($responseData)) |
|
140 | - return ArrayUtil::extractStrings($responseData); |
|
141 | + if (is_array($responseData)) { |
|
142 | + return ArrayUtil::extractStrings($responseData); |
|
143 | + } |
|
141 | 144 | |
142 | 145 | $responseData = $response->getParsedPath('data'); |
143 | 146 | |
144 | - if (is_array($responseData)) |
|
145 | - return ArrayUtil::extractStrings($responseData); |
|
147 | + if (is_array($responseData)) { |
|
148 | + return ArrayUtil::extractStrings($responseData); |
|
149 | + } |
|
146 | 150 | } |
147 | 151 | |
148 | 152 | } |
149 | 153 | \ No newline at end of file |
@@ -13,8 +13,9 @@ |
||
13 | 13 | |
14 | 14 | public function __construct(string $environment) |
15 | 15 | { |
16 | - if (!$this->isValidEnv($environment)) |
|
17 | - throw new \UnexpectedValueException("The environment must be valid"); |
|
16 | + if (!$this->isValidEnv($environment)) { |
|
17 | + throw new \UnexpectedValueException("The environment must be valid"); |
|
18 | + } |
|
18 | 19 | |
19 | 20 | parent::__construct($environment); |
20 | 21 | } |