Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SwiftFileBackendFileList | |
14.29% |
1 / 7 |
|
50.00% |
1 / 2 |
8.67 | |
0.00% |
0 / 1 |
| current | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
6 | |||
| pageFromList | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * OpenStack Swift based file backend. |
| 4 | * |
| 5 | * @license GPL-2.0-or-later |
| 6 | * @file |
| 7 | * @ingroup FileBackend |
| 8 | * @author Russ Nelson |
| 9 | */ |
| 10 | |
| 11 | namespace Wikimedia\FileBackend\FileIteration; |
| 12 | |
| 13 | /** |
| 14 | * Iterator for listing regular files |
| 15 | */ |
| 16 | class SwiftFileBackendFileList extends SwiftFileBackendList { |
| 17 | /** |
| 18 | * @see Iterator::current() |
| 19 | * @return string|bool String (relative path) or false |
| 20 | */ |
| 21 | #[\ReturnTypeWillChange] |
| 22 | public function current() { |
| 23 | [ $path, $stat ] = current( $this->iterableBuffer ); |
| 24 | $relPath = substr( $path, $this->suffixStart ); |
| 25 | if ( is_array( $stat ) ) { |
| 26 | $storageDir = rtrim( $this->params['dir'], '/' ); |
| 27 | $this->backend->loadListingStatInternal( "$storageDir/$relPath", $stat ); |
| 28 | } |
| 29 | |
| 30 | return $relPath; |
| 31 | } |
| 32 | |
| 33 | /** @inheritDoc */ |
| 34 | protected function pageFromList( $container, $dir, &$after, $limit, array $params ) { |
| 35 | return $this->backend->getFileListPageInternal( $container, $dir, $after, $limit, $params ); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** @deprecated class alias since 1.43 */ |
| 40 | class_alias( SwiftFileBackendFileList::class, 'SwiftFileBackendFileList' ); |