1 | <?php |
||
11 | class IndexObject |
||
12 | { |
||
13 | public const TYPE_DIR = 1; |
||
14 | public const TYPE_FILE = 2; |
||
15 | public const TYPE_LINK = 3; |
||
16 | |||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $relativePath; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | protected $type; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | protected $mtime; |
||
32 | |||
33 | /** |
||
34 | * @var int |
||
35 | */ |
||
36 | protected $ctime; |
||
37 | |||
38 | /** |
||
39 | * Full file mode. |
||
40 | * May include additional modes like setuid, guid, etc. |
||
41 | * |
||
42 | * @var int |
||
43 | */ |
||
44 | protected $mode; |
||
45 | |||
46 | /** |
||
47 | * @var int |
||
48 | */ |
||
49 | protected $size; |
||
50 | |||
51 | /** |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $linkTarget; |
||
55 | |||
56 | /** |
||
57 | * @var HashContainer |
||
58 | */ |
||
59 | protected $hashes; |
||
60 | |||
61 | /** |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $blobId; |
||
65 | |||
66 | /** |
||
67 | * Prevent construction not using static factory methods. |
||
68 | */ |
||
69 | protected function __construct() {} |
||
70 | |||
71 | public function getRelativePath(): string |
||
75 | |||
76 | public function getBasename(): string |
||
82 | |||
83 | public function getType(): int |
||
87 | |||
88 | public function isDirectory(): bool |
||
92 | |||
93 | public function isFile(): bool |
||
97 | |||
98 | public function isLink(): bool |
||
102 | |||
103 | public function getMtime(): int |
||
107 | |||
108 | public function getCtime(): int |
||
112 | |||
113 | public function getMode(): int |
||
117 | |||
118 | public function getSize(): ?int |
||
122 | |||
123 | public function getLinkTarget(): ?string |
||
127 | |||
128 | public function getHashes(): ?HashContainer |
||
132 | |||
133 | public function getBlobId(): ?string |
||
137 | |||
138 | public function setBlobId(string $blobId): IndexObject |
||
144 | |||
145 | /** |
||
146 | * Equality check with all attributes. |
||
147 | * |
||
148 | * @param IndexObject $other |
||
149 | * @return bool |
||
150 | */ |
||
151 | public function equals(?IndexObject $other): bool |
||
175 | |||
176 | public function toScalarArray(): array |
||
190 | |||
191 | public static function fromScalarArray(array $array): IndexObject |
||
206 | |||
207 | /** |
||
208 | * Returns an instance representing the filesystem object that can be found under the given path. |
||
209 | * |
||
210 | * @param string $basePath |
||
211 | * @param string $relativePath |
||
212 | * @return IndexObject |
||
213 | */ |
||
214 | public static function fromPath(string $basePath, string $relativePath): IndexObject |
||
253 | } |
||
254 |