@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * contain the query string as well. |
| 30 | 30 | * |
| 31 | 31 | * @param string $method HTTP method. |
| 32 | - * @param string|UriInterface $uri URI object or string. |
|
| 32 | + * @param string $uri URI object or string. |
|
| 33 | 33 | * @param array $options Request options to apply. |
| 34 | 34 | * |
| 35 | 35 | * @return ResponseInterface |
@@ -2,12 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace juniorb2ss\DeathByCaptcha\Abstracts; |
| 4 | 4 | |
| 5 | -use Psr\Http\Message\ResponseInterface; |
|
| 6 | 5 | use GuzzleHttp\Exception\GuzzleException; |
| 6 | +use Psr\Http\Message\ResponseInterface; |
|
| 7 | +use juniorb2ss\DeathByCaptcha\Abstracts\HttpHandlerResponseAbstract; |
|
| 7 | 8 | use juniorb2ss\DeathByCaptcha\DeathByCaptcha; |
| 8 | -use juniorb2ss\DeathByCaptcha\Exceptions\ClientException; |
|
| 9 | 9 | use juniorb2ss\DeathByCaptcha\Interfaces\ClientInterface; |
| 10 | -use juniorb2ss\DeathByCaptcha\Abstracts\HttpHandlerResponseAbstract; |
|
| 11 | 10 | |
| 12 | 11 | abstract class HttpDeathByCaptchaAbstract extends HttpHandlerResponseAbstract implements ClientInterface |
| 13 | 12 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $options = array_merge(['query' => $query], $this->getClientOptions($headers)); |
| 65 | 65 | |
| 66 | - $response = $this->request('GET', static::API_URL . $path, $options); |
|
| 66 | + $response = $this->request('GET', static::API_URL.$path, $options); |
|
| 67 | 67 | |
| 68 | 68 | return $response; |
| 69 | 69 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $headers = $this->getHeadersForClientRequest($headers); |
| 82 | 82 | |
| 83 | 83 | $options = array_merge(['form_params' => $query], $this->getClientOptions($headers)); |
| 84 | - $response = $this->request('POST', static::API_URL . $path, $options); |
|
| 84 | + $response = $this->request('POST', static::API_URL.$path, $options); |
|
| 85 | 85 | |
| 86 | 86 | return $response; |
| 87 | 87 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Psr\Http\Message\ResponseInterface; |
| 6 | 6 | use juniorb2ss\DeathByCaptcha\DeathByCaptcha; |
| 7 | -use juniorb2ss\DeathByCaptcha\Interfaces\ServiceInterface; |
|
| 8 | 7 | use juniorb2ss\DeathByCaptcha\Exceptions\InvalidResponseAttributeException; |
| 8 | +use juniorb2ss\DeathByCaptcha\Interfaces\ServiceInterface; |
|
| 9 | 9 | |
| 10 | 10 | abstract class ServiceAbstract implements ServiceInterface |
| 11 | 11 | { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public function setResponse(ResponseInterface $response) |
| 13 | 13 | { |
| 14 | - $bodyResponse = (string)$response->getBody(); |
|
| 14 | + $bodyResponse = (string) $response->getBody(); |
|
| 15 | 15 | |
| 16 | 16 | $this->objectResponse = json_decode(rtrim($bodyResponse)); |
| 17 | 17 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function getResponse(): \StdClass |
| 22 | 22 | { |
| 23 | - return (object)$this->objectResponse; |
|
| 23 | + return (object) $this->objectResponse; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function getResponseAttribute(string $attribute) |
@@ -34,6 +34,6 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function toArray(): array |
| 36 | 36 | { |
| 37 | - return (array)$this->getResponse(); |
|
| 37 | + return (array) $this->getResponse(); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -37,9 +37,6 @@ |
||
| 37 | 37 | /** |
| 38 | 38 | * @param string $username |
| 39 | 39 | * @param string $password |
| 40 | - * @param ClientInterface|null $client |
|
| 41 | - * @param AccountInterface|null $account |
|
| 42 | - * @param StatusInterface|null $status |
|
| 43 | 40 | */ |
| 44 | 41 | public function __construct( |
| 45 | 42 | string $username, |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use GuzzleHttp\Client as GuzzleClient; |
| 6 | 6 | use GuzzleHttp\ClientInterface; |
| 7 | -use GuzzleHttp\Psr7\Response; |
|
| 8 | 7 | use juniorb2ss\DeathByCaptcha\Abstracts\HttpDeathByCaptchaAbstract; |
| 9 | 8 | use juniorb2ss\DeathByCaptcha\Interfaces\AccountInterface; |
| 10 | 9 | use juniorb2ss\DeathByCaptcha\Interfaces\DeathByCaptchaInterface; |
@@ -23,7 +23,6 @@ |
||
| 23 | 23 | /** |
| 24 | 24 | * Envia o captcha pro serviço ou recupera o resultado |
| 25 | 25 | * de um captcha previamente enviado |
| 26 | - * @param $mix $captcha ID do captcha ou imagem |
|
| 27 | 26 | * @return ResolverInterface |
| 28 | 27 | */ |
| 29 | 28 | public function resolver($mix): ResolverInterface; |
@@ -2,9 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace juniorb2ss\DeathByCaptcha\Interfaces; |
| 4 | 4 | |
| 5 | -use juniorb2ss\DeathByCaptcha\Interfaces\StatusInterface; |
|
| 6 | 5 | use juniorb2ss\DeathByCaptcha\Interfaces\AccountInterface; |
| 7 | 6 | use juniorb2ss\DeathByCaptcha\Interfaces\ResolverInterface; |
| 7 | +use juniorb2ss\DeathByCaptcha\Interfaces\StatusInterface; |
|
| 8 | 8 | |
| 9 | 9 | interface DeathByCaptchaInterface |
| 10 | 10 | { |
@@ -10,21 +10,21 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function status(): int |
| 12 | 12 | { |
| 13 | - return (int)$this->getResponseAttribute('status'); |
|
| 13 | + return (int) $this->getResponseAttribute('status'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function todaysAccuracy(): float |
| 17 | 17 | { |
| 18 | - return (float)$this->getResponseAttribute('todays_accuracy'); |
|
| 18 | + return (float) $this->getResponseAttribute('todays_accuracy'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function solvedIn(): int |
| 22 | 22 | { |
| 23 | - return (int)$this->getResponseAttribute('solved_in'); |
|
| 23 | + return (int) $this->getResponseAttribute('solved_in'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function isServiceOverloaded(): bool |
| 27 | 27 | { |
| 28 | - return (bool)$this->getResponseAttribute('is_service_overloaded'); |
|
| 28 | + return (bool) $this->getResponseAttribute('is_service_overloaded'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -10,16 +10,16 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function isCorrect(): bool |
| 12 | 12 | { |
| 13 | - return (bool)$this->getResponseAttribute('is_correct'); |
|
| 13 | + return (bool) $this->getResponseAttribute('is_correct'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function text(): string |
| 17 | 17 | { |
| 18 | - return (string)$this->getResponseAttribute('text'); |
|
| 18 | + return (string) $this->getResponseAttribute('text'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function status(): int |
| 22 | 22 | { |
| 23 | - return (int)$this->getResponseAttribute('status'); |
|
| 23 | + return (int) $this->getResponseAttribute('status'); |
|
| 24 | 24 | } |
| 25 | 25 | } |
@@ -10,26 +10,26 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function isBanned(): bool |
| 12 | 12 | { |
| 13 | - return (bool)$this->getResponseAttribute('is_banned'); |
|
| 13 | + return (bool) $this->getResponseAttribute('is_banned'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function getStatus(): int |
| 17 | 17 | { |
| 18 | - return (int)$this->getResponseAttribute('status'); |
|
| 18 | + return (int) $this->getResponseAttribute('status'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function getRate(): int |
| 22 | 22 | { |
| 23 | - return (int)$this->getResponseAttribute('rate'); |
|
| 23 | + return (int) $this->getResponseAttribute('rate'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function getBalance(): float |
| 27 | 27 | { |
| 28 | - return (double)$this->getResponseAttribute('balance'); |
|
| 28 | + return (double) $this->getResponseAttribute('balance'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function getUser(): int |
| 32 | 32 | { |
| 33 | - return (int)$this->getResponseAttribute('user'); |
|
| 33 | + return (int) $this->getResponseAttribute('user'); |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -10,21 +10,21 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function isCorrect(): bool |
| 12 | 12 | { |
| 13 | - return (bool)$this->getResponseAttribute('is_correct'); |
|
| 13 | + return (bool) $this->getResponseAttribute('is_correct'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function text(): string |
| 17 | 17 | { |
| 18 | - return (string)$this->getResponseAttribute('text'); |
|
| 18 | + return (string) $this->getResponseAttribute('text'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function status(): int |
| 22 | 22 | { |
| 23 | - return (int)$this->getResponseAttribute('status'); |
|
| 23 | + return (int) $this->getResponseAttribute('status'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function captchaId(): int |
| 27 | 27 | { |
| 28 | - return (int)$this->getResponseAttribute('captcha'); |
|
| 28 | + return (int) $this->getResponseAttribute('captcha'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace juniorb2ss\DeathByCaptcha\Abstracts; |
| 4 | 4 | |
| 5 | -use Psr\Http\Message\ResponseInterface; |
|
| 6 | 5 | use juniorb2ss\DeathByCaptcha\Exceptions\AccessDeniedException; |
| 7 | 6 | use juniorb2ss\DeathByCaptcha\Exceptions\CaptchaNotFoundException; |
| 8 | 7 | use juniorb2ss\DeathByCaptcha\Exceptions\InternalServiceException; |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | // accept de json, técnicamente deverá retornar |
| 61 | 61 | // o content type como json |
| 62 | 62 | // mas... nunca se sabe, né? |
| 63 | - if (($contentType !== $this->contentTypeOk) or (empty((string)$response->getBody()))) { |
|
| 63 | + if (($contentType !== $this->contentTypeOk) or (empty((string) $response->getBody()))) { |
|
| 64 | 64 | throw new InvalidServiceResponseException; |
| 65 | 65 | } |
| 66 | 66 | } |