diff --git a/.gitignore b/.gitignore index b5c50c7..bca00ce 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ vendor report test.php composer.phar +composer.lock phpunit.xml .idea/* .php_cs.cache \ No newline at end of file diff --git a/composer.json b/composer.json index b60e33b..da0fddc 100755 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "psr-4": {"Porox\\Dropmefiles\\Tests\\": "tests/"} }, "require": { - "php": ">=7.0", + "php": ">=7.2", "guzzlehttp/guzzle": "~6.3", "ext-json": "*" }, diff --git a/src/Client.php b/src/Client.php index a4d6c93..55ab624 100644 --- a/src/Client.php +++ b/src/Client.php @@ -4,10 +4,19 @@ use Porox\Dropmefiles\Client\Exception\DropmefilesException; +/** + * Class Client. + */ class Client implements DropmefilesClientInterface { - protected DropmefilesAPIInteface $api; + /** + * @var DropmefilesAPIInteface + */ + protected $api; + /** + * Client constructor. + */ public function __construct(DropmefilesAPIInteface $api) { $this->api = $api; diff --git a/src/CreateFileConfig.php b/src/CreateFileConfig.php index c502e0f..6deae4f 100644 --- a/src/CreateFileConfig.php +++ b/src/CreateFileConfig.php @@ -7,16 +7,16 @@ */ class CreateFileConfig { - protected bool $needPassword = false; + protected $needPassword = false; /** * @var \SplFileInfo [] */ - protected array $files = []; + protected $files = []; - protected int $size = 0; + protected $size = 0; - protected int $period = PeriodTypes::DAYS_3; + protected $period = PeriodTypes::DAYS_3; public function isNeedPassword(): bool { diff --git a/src/DropmefilesAPI.php b/src/DropmefilesAPI.php index beb9369..e3f949e 100644 --- a/src/DropmefilesAPI.php +++ b/src/DropmefilesAPI.php @@ -2,11 +2,11 @@ namespace Porox\Dropmefiles\Client; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\RequestOptions; use Porox\Dropmefiles\Client\Dto\DropmefilesDto; use Porox\Dropmefiles\Client\Dto\DropmefilesFileDto; use Porox\Dropmefiles\Client\Exception\DropmefilesException; -use GuzzleHttp\ClientInterface; -use GuzzleHttp\RequestOptions; /** * Class DropmefilesAPI. @@ -17,7 +17,7 @@ class DropmefilesAPI implements DropmefilesAPIInteface const CHUNK_SIZE = 4194304; - protected ClientInterface $httpClient; + protected $httpClient; /** * DropmefilesAPI constructor. diff --git a/src/Dto/DropmefilesDto.php b/src/Dto/DropmefilesDto.php index 19b4593..2be7676 100644 --- a/src/Dto/DropmefilesDto.php +++ b/src/Dto/DropmefilesDto.php @@ -2,13 +2,25 @@ namespace Porox\Dropmefiles\Client\Dto; +/** + * Class DropmefilesDto. + */ class DropmefilesDto { - protected string $uid; + /** + * @var string + */ + protected $uid; - protected string $password; + /** + * @var string + */ + protected $password; - protected array $files = []; + /** + * @var array + */ + protected $files = []; public function getUid(): string { diff --git a/src/Dto/DropmefilesFileDto.php b/src/Dto/DropmefilesFileDto.php index c797c3b..6e50e89 100644 --- a/src/Dto/DropmefilesFileDto.php +++ b/src/Dto/DropmefilesFileDto.php @@ -2,26 +2,71 @@ namespace Porox\Dropmefiles\Client\Dto; +/** + * Class DropmefilesFileDto. + */ class DropmefilesFileDto implements \JsonSerializable { - protected string $id; - - protected string $name; - - protected string $type = 'application\zip'; - - protected string $relativePath = ''; - - protected int $size; - protected int $origSize; - protected int $loaded; - protected int $percent = 100; - protected int $status = 5; - protected string $lastModifiedDate = '2021-01-28T14:18:14.996Z'; - protected int $completeTimestamp; - protected string $dir; - protected int $logstatus = 2; - + /** + * @var string + */ + protected $id; + + /** + * @var string + */ + protected $name; + + /** + * @var string + */ + protected $type = 'application\zip'; + + /** + * @var string + */ + protected $relativePath = ''; + + /** + * @var int + */ + protected $size; + /** + * @var int + */ + protected $origSize; + /** + * @var int + */ + protected $loaded; + /** + * @var int + */ + protected $percent = 100; + /** + * @var int + */ + protected $status = 5; + /** + * @var string + */ + protected $lastModifiedDate = '2021-01-28T14:18:14.996Z'; + /** + * @var int + */ + protected $completeTimestamp; + /** + * @var string + */ + protected $dir; + /** + * @var int + */ + protected $logstatus = 2; + + /** + * DropmefilesFileDto constructor. + */ public function __construct(string $id, string $name, int $size, string $dir) { $this->id = $id; @@ -163,6 +208,9 @@ public function setLastModifiedDate(string $lastModifiedDate): void $this->lastModifiedDate = $lastModifiedDate; } + /** + * @return array|mixed + */ public function jsonSerialize() { return get_object_vars($this); diff --git a/src/Response.php b/src/Response.php index a7f19f0..476fb72 100644 --- a/src/Response.php +++ b/src/Response.php @@ -7,15 +7,30 @@ */ class Response implements ResponseInterface { - protected bool $success = false; - - protected string $url = ''; - - protected ?string $password = null; - - protected string $errorText = ''; - - protected ?int $errorCode = null; + /** + * @var bool + */ + protected $success = false; + + /** + * @var string + */ + protected $url = ''; + + /** + * @var string|null + */ + protected $password = null; + + /** + * @var string + */ + protected $errorText = ''; + + /** + * @var int|null + */ + protected $errorCode = null; public function getUrl(): string {