Skip to content

Commit

Permalink
Поддержка php 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ydombrovsky committed Feb 2, 2021
1 parent 13aa4b3 commit 7e6b2c1
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ vendor
report
test.php
composer.phar
composer.lock
phpunit.xml
.idea/*
.php_cs.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"psr-4": {"Porox\\Dropmefiles\\Tests\\": "tests/"}
},
"require": {
"php": ">=7.0",
"php": ">=7.2",
"guzzlehttp/guzzle": "~6.3",
"ext-json": "*"
},
Expand Down
11 changes: 10 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/CreateFileConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions src/DropmefilesAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -17,7 +17,7 @@ class DropmefilesAPI implements DropmefilesAPIInteface

const CHUNK_SIZE = 4194304;

protected ClientInterface $httpClient;
protected $httpClient;

/**
* DropmefilesAPI constructor.
Expand Down
18 changes: 15 additions & 3 deletions src/Dto/DropmefilesDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
84 changes: 66 additions & 18 deletions src/Dto/DropmefilesFileDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -163,6 +208,9 @@ public function setLastModifiedDate(string $lastModifiedDate): void
$this->lastModifiedDate = $lastModifiedDate;
}

/**
* @return array|mixed
*/
public function jsonSerialize()
{
return get_object_vars($this);
Expand Down
33 changes: 24 additions & 9 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 7e6b2c1

Please sign in to comment.