Completed
Push — master ( ccde76...68a462 )
by Sebastian
12s
created

Sftp::unlink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace phpbu\App\Backup\File;
3
4
/**
5
 * File Sftp class
6
 *
7
 * @package phpbu\App\Backup\File
8
 */
9
class Sftp extends Remote
10
{
11
    /**
12
     * @var \phpseclib\Net\SFTP
13
     */
14
    protected $sftp;
15
16
    /**
17
     * Sftp constructor.
18
     *
19
     * @param \phpseclib\Net\SFTP $sftp
20
     * @param array               $fileInfo
21
     * @param string              $remotePath
22
     */
23 2
    public function __construct(\phpseclib\Net\SFTP $sftp, array $fileInfo, string $remotePath)
24
    {
25 2
        $this->sftp         = $sftp;
26 2
        $this->filename     = $fileInfo['filename'];
27 2
        $this->pathname     = $remotePath . '/' . $fileInfo['filename'];
28 2
        $this->size         = $fileInfo['size'];
29 2
        $this->lastModified = $fileInfo['mtime'];
30 2
    }
31
32
    /**
33
     * Deletes the file.
34
     */
35 1
    public function unlink()
36
    {
37 1
        $this->sftp->delete($this->pathname);
38
    }
39
}