Passed
Push — master ( 6957cf...3bb145 )
by Joachim
04:59
created

FtpTransport::send()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusStockMovementPlugin\Transport;
6
7
use League\Flysystem\Adapter\Ftp;
8
use League\Flysystem\Filesystem;
9
use League\Flysystem\FilesystemInterface;
10
use Setono\SyliusStockMovementPlugin\Model\ReportConfigurationInterface;
11
use Setono\SyliusStockMovementPlugin\Model\ReportInterface;
12
13
final class FtpTransport implements TransportInterface
14
{
15
    /** @var FilesystemInterface */
16
    private $filesystem;
17
18
    public function __construct(FilesystemInterface $filesystem)
19
    {
20
        $this->filesystem = $filesystem;
21
    }
22
23
    public function send(string $file, array $configuration, ReportInterface $report, ReportConfigurationInterface $reportConfiguration): void
24
    {
25
        $configuration['root'] = $configuration['path'] ?? null;
26
27
        $filesystem = new Filesystem(new Ftp($configuration));
28
        $filesystem->putStream($file, $this->filesystem->readStream($file));
29
    }
30
}
31