@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * @return Me |
26 | 26 | */ |
27 | - public function register(array $fields): Me |
|
28 | - { |
|
29 | - $this->request( |
|
30 | - "POST", |
|
31 | - "/auth/register", |
|
32 | - $fields |
|
33 | - ); |
|
27 | + public function register(array $fields): Me |
|
28 | + { |
|
29 | + $this->request( |
|
30 | + "POST", |
|
31 | + "/auth/register", |
|
32 | + $fields |
|
33 | + ); |
|
34 | 34 | |
35 | - return $this; |
|
36 | - } |
|
35 | + return $this; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @return Me |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @return Me |
55 | 55 | */ |
56 | - public function auth(string $email, string $password): Me |
|
57 | - { |
|
58 | - $this->request( |
|
59 | - "POST", |
|
60 | - "/auth/token", |
|
61 | - array("email" => $email, "password" => $password) |
|
62 | - ); |
|
56 | + public function auth(string $email, string $password): Me |
|
57 | + { |
|
58 | + $this->request( |
|
59 | + "POST", |
|
60 | + "/auth/token", |
|
61 | + array("email" => $email, "password" => $password) |
|
62 | + ); |
|
63 | 63 | |
64 | 64 | $this->token(); |
65 | 65 | |
66 | 66 | return $this; |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @return Me |
@@ -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 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * login |
34 | 34 | */ |
35 | - echo "<h1>Login</h1>"; |
|
35 | + echo "<h1>Login</h1>"; |
|
36 | 36 | |
37 | - $user = $me->auth("[email protected]","123456789"); |
|
38 | - var_dump($user->response()); |
|
39 | - var_dump($user->error()); |
|
37 | + $user = $me->auth("[email protected]","123456789"); |
|
38 | + var_dump($user->response()); |
|
39 | + var_dump($user->error()); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * me |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * logout |
51 | 51 | */ |
52 | - echo "<h1>Logout</h1>"; |
|
52 | + echo "<h1>Logout</h1>"; |
|
53 | 53 | |
54 | - $user = $me->logout(); |
|
55 | - var_dump($user->response()); |
|
54 | + $user = $me->logout(); |
|
55 | + var_dump($user->response()); |
|
56 | 56 |
@@ -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 |
@@ -74,16 +74,16 @@ |
||
74 | 74 | * @param array $fields |
75 | 75 | * @return StateTaxes |
76 | 76 | */ |
77 | - public function update(string $statetax_id, array $fields): StateTaxes |
|
78 | - { |
|
79 | - $this->request( |
|
80 | - "PUT", |
|
81 | - "/companies/{$this->company}/statetaxes/{$statetax_id}", |
|
82 | - $fields |
|
83 | - ); |
|
77 | + public function update(string $statetax_id, array $fields): StateTaxes |
|
78 | + { |
|
79 | + $this->request( |
|
80 | + "PUT", |
|
81 | + "/companies/{$this->company}/statetaxes/{$statetax_id}", |
|
82 | + $fields |
|
83 | + ); |
|
84 | 84 | |
85 | - return $this; |
|
86 | - } |
|
85 | + return $this; |
|
86 | + } |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @param string $statetax_id |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | */ |
29 | 29 | echo "<h1>CREATE</h1>"; |
30 | 30 | |
31 | - $certificate = ($_FILES["certificate"] ?? null); |
|
32 | - $password = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRIPPED); |
|
33 | - if (!empty($certificate) && !empty($password)) { |
|
31 | + $certificate = ($_FILES["certificate"] ?? null); |
|
32 | + $password = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRIPPED); |
|
33 | + if (!empty($certificate) && !empty($password)) { |
|
34 | 34 | $create = $certificates->create([ |
35 | 35 | "certificate" => $certificate['tmp_name'], |
36 | 36 | "password" => $password['password'], |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | } else { |
42 | 42 | var_dump($create->response()); |
43 | 43 | } |
44 | - } |
|
45 | - ?> |
|
44 | + } |
|
45 | + ?> |
|
46 | 46 | <form action="" method="post" enctype="multipart/form-data"> |
47 | 47 | <input type="file" name="certificate"/> |
48 | 48 | <input type="password" name="password"/> |
@@ -28,12 +28,12 @@ |
||
28 | 28 | */ |
29 | 29 | echo "<h1>CREATE</h1>"; |
30 | 30 | |
31 | - $certificate = ($_FILES["certificate"] ?? null); |
|
31 | + $certificate = ($_FILES[ "certificate" ] ?? null); |
|
32 | 32 | $password = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRIPPED); |
33 | 33 | if (!empty($certificate) && !empty($password)) { |
34 | 34 | $create = $certificates->create([ |
35 | - "certificate" => $certificate['tmp_name'], |
|
36 | - "password" => $password['password'], |
|
35 | + "certificate" => $certificate[ 'tmp_name' ], |
|
36 | + "password" => $password[ 'password' ], |
|
37 | 37 | ]); |
38 | 38 | |
39 | 39 | if ($create->error()) { |
@@ -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)?null:array("Authorization"=>"Bearer {$token}"); |
|
36 | + $headers = empty($token) ?null:array("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 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | $curl = curl_init(); |
97 | 97 | |
98 | - if (empty($this->fields["files"])) { |
|
98 | + if (empty($this->fields[ "files" ])) { |
|
99 | 99 | $this->fields = (!empty($this->fields) ? http_build_query($this->fields) : null); |
100 | 100 | } |
101 | 101 |
@@ -51,8 +51,8 @@ |
||
51 | 51 | "/companies/{$this->company}/certificates", |
52 | 52 | array( |
53 | 53 | "files" => true, |
54 | - "certificate" => curl_file_create($files["certificate"],"application/x-pkcs12"), |
|
55 | - "password" => $files["password"] |
|
54 | + "certificate" => curl_file_create($files[ "certificate" ], "application/x-pkcs12"), |
|
55 | + "password" => $files[ "password" ] |
|
56 | 56 | ) |
57 | 57 | ); |
58 | 58 |