1 | <?php |
||
13 | class SizeDriverAggregator implements ISizeDriver |
||
14 | { |
||
15 | /** |
||
16 | * @var ISizeDriver[] |
||
17 | */ |
||
18 | private $drivers = []; |
||
19 | |||
20 | /** |
||
21 | * @var ISizeDriver |
||
22 | */ |
||
23 | private $lastUsedDriver = null; |
||
24 | |||
25 | /** |
||
26 | * @var Exception[] |
||
27 | */ |
||
28 | private $lastExceptions = []; |
||
29 | |||
30 | /** |
||
31 | * @param ISizeDriver[] $drivers Ordered array of driver instances |
||
32 | */ |
||
33 | public function __construct(array $drivers) |
||
39 | |||
40 | private function addDriver(ISizeDriver $driver) |
||
44 | |||
45 | /** |
||
46 | * Returns first non-failing driver from last used of getFileSize() |
||
47 | * @return ISizeDriver |
||
48 | * @internal Should be used for debugging only |
||
49 | */ |
||
50 | public function getLastUsedDriver() |
||
54 | |||
55 | /** |
||
56 | * Returns file size |
||
57 | * @param string $path Full path to file |
||
58 | * @return BigInteger |
||
59 | * @throws Exception |
||
60 | */ |
||
61 | public function getFileSize($path) |
||
80 | } |
||
81 |