@@ -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 | } |
@@ -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; |
@@ -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 | } |