PHPstan analysis.

This commit is contained in:
2023-05-26 13:04:15 +00:00
parent acd209b351
commit 4c8f71d9d8
8 changed files with 264 additions and 55 deletions

View File

@ -6,27 +6,31 @@ use Symfony\Component\Process\Exception\ProcessFailedException;
class Rclone
{
protected $rclone_path;
protected $global_options = [];
protected string $rclone_path;
/**
* Global options
*
* @var array<string>
*/
protected array $global_options = [];
function __construct($rclone_path = "rclone")
function __construct(string $rclone_path = "rclone")
{
$this->rclone_path = $rclone_path;
}
function getVersion()
function getVersion(): string
{
return $this->exec('--version');
}
function getSize($path)
function getSize(string $path): int
{
$output = $this->exec('size', ['--json', $path]);
return (int)json_decode($output[0])->bytes;
return (int)json_decode($output)->bytes;
}
function copy($src, $dest, $bandwidth = null)
function copy(string $src, string $dest, string $bandwidth = null): string
{
$options = array();
@ -40,7 +44,11 @@ class Rclone
return $this->exec('copy', $options);
}
protected function exec(string $command, array $options = array())
/**
* @param $command Top level Rclone command
* @param array<String> $options
*/
protected function exec(string $command, array $options = array()) : string
{
$process = new Process(
array_merge(