Skip to content

Commit

Permalink
feat: add methods description
Browse files Browse the repository at this point in the history
  • Loading branch information
SanaviaNicolas committed Oct 21, 2021
1 parent ea83dc8 commit d055e85
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"OfflineAgency\\FattureInCloud\\FattureInCloudServiceProvider"
],
"aliases": {
"FattureInCloud": "GarbinLuca\\FattureInCloud\\FattureInCloudFacade"
"FattureInCloud": "OfflineAgency\\FattureInCloud\\FattureInCloudFacade"
}
}
}
Expand Down
75 changes: 63 additions & 12 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ class Auth
private $attempts;
private $params = [];

/**
* @param string $apiUid
* @param string $apiKey
* @throws Exception
*/
public function __construct(
$apiUid = '',
$apiKey = ''
string $apiUid = '',
string $apiKey = ''
)
{
$this->attempts = 0;
Expand All @@ -27,13 +32,22 @@ public function __construct(
];
}

/**
* @param string $url
* @param array $data
* @param string $method
* @param array $additional_data
* @param string $action
* @param string $type
* @return mixed|object
*/
private function call(
$url = '',
$data = [],
$method = 'post',
$additional_data = [],
$action = '',
$type = ''
string $url = '',
array $data = [],
string $method = 'post',
array $additional_data = [],
string $action = '',
string $type = ''
)
{
try {
Expand Down Expand Up @@ -94,6 +108,17 @@ private function call(
}
}

/**
* @param $response
* @param $url
* @param $data
* @param $method
* @param $additional_data
* @param $action
* @param $type
* @return mixed
* @throws Exception
*/
private function parseResponse(
$response,
$url,
Expand Down Expand Up @@ -128,6 +153,16 @@ private function parseResponse(
return $json;
}

/**
* @param $json
* @param $url
* @param $data
* @param $method
* @param $additional_data
* @param $action
* @param $type
* @throws Exception
*/
private function handleThrottle(
$json,
$url,
Expand Down Expand Up @@ -163,6 +198,10 @@ private function handleThrottle(
}
}

/**
* @param $error_message
* @return float|int
*/
private function getRetrySeconds(
$error_message
)
Expand All @@ -176,12 +215,20 @@ private function getRetrySeconds(
return $seconds * 1000;
}

/**
* @param $path
* @param array $data
* @param array $additional_data
* @param string $action
* @param string $type
* @return mixed|object
*/
public function post(
$path,
$data = [],
$additional_data = [],
$action = '',
$type = ''
array $data = [],
array $additional_data = [],
string $action = '',
string $type = ''
)
{
$params = array_merge($this->params, $data);
Expand All @@ -195,6 +242,10 @@ public function post(
);
}

/**
* @param $headers
* @return array
*/
private function parseHeaders(
$headers
): array
Expand Down
6 changes: 4 additions & 2 deletions src/FattureInCloudFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace OfflineAgency\FattureInCloud;

class FattureInCloudFacade extends \Illuminate\Support\Facades\Facade
use Illuminate\Support\Facades\Facade;

class FattureInCloudFacade extends Facade
{
public static function getFacadeAccessor()
{
return 'fatture-in-cloud';
}
}
}

0 comments on commit d055e85

Please sign in to comment.