Completed
Push — master ( 6aac25...fc5b3c )
by Sebastian
04:08 queued 01:04
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
 * Sftp file class.
6
 *
7
 * @package    phpbu
8
 * @subpackage Backup
9
 * @author     Sebastian Feldmann <[email protected]>
10
 * @author     Vitaly Baev <[email protected]>
11
 * @copyright  Sebastian Feldmann <[email protected]>
12
 * @license    https://opensource.org/licenses/MIT The MIT License (MIT)
13
 * @link       http://phpbu.de/
14
 * @since      Class available since Release 5.1.0
15
 */
16
class Sftp extends Remote
17
{
18
    /**
19
     * @var \phpseclib\Net\SFTP
20
     */
21
    protected $sftp;
22
23
    /**
24
     * Sftp constructor.
25
     *
26
     * @param \phpseclib\Net\SFTP $sftp
27
     * @param array               $fileInfo
28
     * @param string              $remotePath
29
     */
30 2
    public function __construct(\phpseclib\Net\SFTP $sftp, array $fileInfo, string $remotePath)
31
    {
32 2
        $this->sftp         = $sftp;
33 2
        $this->filename     = $fileInfo['filename'];
34 2
        $this->pathname     = $remotePath . '/' . $fileInfo['filename'];
35 2
        $this->size         = $fileInfo['size'];
36 2
        $this->lastModified = $fileInfo['mtime'];
37 2
    }
38
39
    /**
40
     * Deletes the file.
41
     */
42 1
    public function unlink()
43
    {
44 1
        $this->sftp->delete($this->pathname);
45 1
    }
46
}
47