diff --git a/composer.json b/composer.json index 705a250..ed77850 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "OfflineAgency\\FattureInCloud\\FattureInCloudServiceProvider" ], "aliases": { - "FattureInCloud": "GarbinLuca\\FattureInCloud\\FattureInCloudFacade" + "FattureInCloud": "OfflineAgency\\FattureInCloud\\FattureInCloudFacade" } } } diff --git a/src/Auth.php b/src/Auth.php index 888b011..9965fde 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -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; @@ -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 { @@ -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, @@ -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, @@ -163,6 +198,10 @@ private function handleThrottle( } } + /** + * @param $error_message + * @return float|int + */ private function getRetrySeconds( $error_message ) @@ -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); @@ -195,6 +242,10 @@ public function post( ); } + /** + * @param $headers + * @return array + */ private function parseHeaders( $headers ): array diff --git a/src/FattureInCloudFacade.php b/src/FattureInCloudFacade.php index 95d13f1..2270a9f 100644 --- a/src/FattureInCloudFacade.php +++ b/src/FattureInCloudFacade.php @@ -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'; } -} \ No newline at end of file +}