1 | <?php |
||
24 | final class File implements FileInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $path; |
||
30 | |||
31 | /** |
||
32 | * @var string; |
||
33 | */ |
||
34 | private $rootPath; |
||
35 | |||
36 | /** |
||
37 | * @var string; |
||
38 | */ |
||
39 | private $relativePath; |
||
40 | |||
41 | /** |
||
42 | * @var integer |
||
43 | */ |
||
44 | private $size; |
||
45 | |||
46 | /** |
||
47 | * @var \DateTimeInterface |
||
48 | */ |
||
49 | private $createdAt; |
||
50 | |||
51 | /** |
||
52 | * @var \DateTimeInterface |
||
53 | */ |
||
54 | private $modifiedAt; |
||
55 | |||
56 | 38 | public function __construct($path, $rootPath, $size, $createdAt, $modifiedAt) |
|
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | 26 | public function getPath() |
|
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | public function getRootPath() |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | 28 | public function getRelativePath() |
|
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | 24 | public function getSize() |
|
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public function getCreatedAt() |
||
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | 2 | public function getModifiedAt() |
|
124 | |||
125 | /** |
||
126 | * Create File instance from local, mounted filesystem. |
||
127 | * |
||
128 | * @param string $path Path to file. |
||
129 | * @param null|string $rootPath Root path of file. |
||
130 | * @return File Created backup file instance. |
||
131 | */ |
||
132 | 38 | public static function fromLocal($path, $rootPath = null) |
|
142 | |||
143 | /** |
||
144 | * Create file instance from \SplFileInfo instance. |
||
145 | * |
||
146 | * @param \SplFileInfo $file |
||
147 | * @param null|string $rootPath Root path of file. |
||
148 | * @return File |
||
149 | */ |
||
150 | 10 | public static function fromSplFileInfo(\SplFileInfo $file, $rootPath = null) |
|
160 | |||
161 | /** |
||
162 | * Create file instance from Flysystem file metadata. |
||
163 | * |
||
164 | * @param array $metadata Flysystem file metadata. |
||
165 | * @param null|string $rootPath Root path of file. |
||
166 | * @return File |
||
167 | */ |
||
168 | 4 | public static function fromFlysystemMetadata(array $metadata, $rootPath = null) |
|
178 | } |
||
179 |