PHPstan analysis.
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user