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 | public function __construct($path, $rootPath, $size, $createdAt, $modifiedAt) |
||
65 | 32 | ||
66 | 32 | /** |
|
67 | 32 | * {@inheritdoc} |
|
68 | 32 | */ |
|
69 | 32 | public function getPath() |
|
73 | |||
74 | /** |
||
75 | 14 | * {@inheritdoc} |
|
76 | */ |
||
77 | 14 | public function getRootPath() |
|
81 | |||
82 | /** |
||
83 | 24 | * {@inheritdoc} |
|
84 | */ |
||
85 | 24 | public function getRelativePath() |
|
100 | |||
101 | 22 | /** |
|
102 | * {@inheritdoc} |
||
103 | 22 | */ |
|
104 | public function getSize() |
||
108 | |||
109 | /** |
||
110 | 22 | * {@inheritdoc} |
|
111 | */ |
||
112 | 22 | public function getCreatedAt() |
|
116 | |||
117 | /** |
||
118 | 18 | * {@inheritdoc} |
|
119 | */ |
||
120 | 18 | 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 | public static function fromLocal($path, $rootPath = null) |
||
142 | |||
143 | /** |
||
144 | * Create file instance from \SplFileInfo instance. |
||
145 | * |
||
146 | * @param \SplFileInfo $file |
||
147 | 32 | * @param null|string $rootPath Root path of file. |
|
148 | * @return File |
||
149 | 32 | */ |
|
150 | 32 | 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 | 10 | */ |
|
168 | public static function fromFlysystemMetadata(array $metadata, $rootPath = null) |
||
178 | } |
||
179 |