@@ -20,8 +20,8 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct(string $apiUrl, string $email, string $password) |
| 22 | 22 | { |
| 23 | - $token = (new Me($apiUrl))->auth($email,$password)->response()->token; |
|
| 24 | - if( empty($token) ){ |
|
| 23 | + $token = (new Me($apiUrl))->auth($email, $password)->response()->token; |
|
| 24 | + if (empty($token)) { |
|
| 25 | 25 | throw new \Exception('Não é possível realizar login'); |
| 26 | 26 | } |
| 27 | 27 | parent::__construct($apiUrl, $token); |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * ApiNfeFasa constructor. |
| 31 | 31 | * @param string $apiUrl |
| 32 | 32 | */ |
| 33 | - public function __construct(string $apiUrl,?string $token = null) |
|
| 33 | + public function __construct(string $apiUrl, ?string $token = null) |
|
| 34 | 34 | { |
| 35 | 35 | $this->apiUrl = $apiUrl; |
| 36 | - $headers = empty($token)?array("Content-Type"=>"application/json"):array("Content-Type"=>"application/json","Authorization"=>"Bearer {$token}"); |
|
| 36 | + $headers = empty($token) ? array("Content-Type"=>"application/json") : array("Content-Type"=>"application/json", "Authorization"=>"Bearer {$token}"); |
|
| 37 | 37 | $this->headers($headers); |
| 38 | 38 | |
| 39 | 39 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | foreach ($headers as $key => $header) { |
| 87 | - $this->headers[] = "{$key}: {$header}"; |
|
| 87 | + $this->headers[ ] = "{$key}: {$header}"; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct(string $apiUrl, string $email, string $password, string $company_id) |
| 24 | 24 | { |
| 25 | - $token = (new Me($apiUrl))->auth($email,$password)->response()->token; |
|
| 26 | - if( empty($token) ){ |
|
| 25 | + $token = (new Me($apiUrl))->auth($email, $password)->response()->token; |
|
| 26 | + if (empty($token)) { |
|
| 27 | 27 | throw new \Exception('Não é possível realizar login'); |
| 28 | 28 | } |
| 29 | 29 | parent::__construct($apiUrl, $token); |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | */ |
| 87 | 87 | public function token(): Me |
| 88 | 88 | { |
| 89 | - if( !empty($this->response()->token) ){ |
|
| 89 | + if (!empty($this->response()->token)) { |
|
| 90 | 90 | $this->token = $this->response()->token; |
| 91 | 91 | $this->headers = array("Authorization"=>"Bearer {$this->response()->token}"); |
| 92 | 92 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | echo "<h1>Login</h1>"; |
| 36 | 36 | |
| 37 | - $user = $me->auth("[email protected]","123456789"); |
|
| 37 | + $user = $me->auth("[email protected]", "123456789"); |
|
| 38 | 38 | var_dump($user->response()); |
| 39 | 39 | var_dump($user->error()); |
| 40 | 40 | |