Completed
Push — master ( f8aac3...6e7b55 )
by Sebastian
07:15
created

Simulation::unlink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
namespace phpbu\App\Backup\File;
3
4
use phpbu\App\Backup\File;
5
use SplFileInfo;
6
use phpbu\App\Exception;
7
8
/**
9
 * Simulation
10
 *
11
 * @package    phpbu
12
 * @subpackage Backup
13
 * @author     Sebastian Feldmann <[email protected]>
14
 * @copyright  Sebastian Feldmann <[email protected]>
15
 * @license    https://opensource.org/licenses/MIT The MIT License (MIT)
16
 * @link       http://phpbu.de/
17
 * @since      Class available since Release 5.1.0
18
 */
19
class Simulation implements File
20
{
21
    /**
22
     * @var int
23
     */
24
    private $time;
25
26
    /**
27
     * @var int
28
     */
29
    private $size;
30
31
    /**
32
     * @var string
33
     */
34
    private $path;
35
36
    /**
37
     * @var string
38
     */
39
    private $file;
40
41
    /**
42
     * Constructor
43
     *
44
     * @param int    $time
45
     * @param int    $size
46
     * @param string $path
47
     * @param string $file
48
     */
49
    public function __construct(int $time, int $size, string $path, string $file)
50
    {
51
        $this->time = $time;
52
        $this->size = $size;
53
        $this->path = $path;
54
        $this->file = $file;
55
    }
56
57
    /**
58
     * Return the filesize.
59
     *
60
     * @return integer
61
     */
62
    public function getSize(): int
63
    {
64
        return $this->size;
65
    }
66
67
    /**
68
     * Return the filename.
69
     *
70
     * @return string
71
     */
72
    public function getFilename(): string
73
    {
74
        return $this->file;
75
    }
76
77
    /**
78
     * Return the full path and filename.
79
     *
80
     * @return string
81
     */
82
    public function getPathname(): string
83
    {
84
        return $this->path . '/' . $this->file;
85
    }
86
87
    /**
88
     * Return the path.
89
     *
90
     * @return string
91
     */
92
    public function getPath()
93
    {
94
        return $this->path;
95
    }
96
97
    /**
98
     * Return last modified date as unix timestamp.
99
     *
100
     * @return integer
101
     */
102
    public function getMTime(): int
103
    {
104
        return $this->time;
105
    }
106
107
    /**
108
     * Return whether the file is writable or not.
109
     *
110
     * @return boolean
111
     */
112
    public function isWritable(): bool
113
    {
114
        return true;
115
    }
116
117
    /**
118
     * Deletes the file.
119
     */
120
    public function unlink()
121
    {
122
        // do nothing
123
    }
124
}
125