19declare(strict_types=1);
40 return $this->view_request;
46 public function getEntries(): array
48 static $entries_at_current_level;
49 static $current_level;
51 if ($current_level !== $this->view_request->getPath()) {
52 unset($entries_at_current_level);
54 if (isset($entries_at_current_level)) {
55 return $entries_at_current_level;
58 $current_level = $this->view_request->getPath();
60 $entries_at_current_level = iterator_to_array(
61 $this->view_request->getWrapper()->getEntries()
65 usort($entries_at_current_level,
function (
File|Dir
$a,
File|Dir
$b):
int {
66 $size_a =
$a instanceof Dir ? 0 :
$a->getSize();
67 $size_b =
$b instanceof Dir ? 0 :
$b->getSize();
68 $type_a =
$a instanceof Dir ?
'' :
$a->getMimeType();
69 $type_b =
$b instanceof Dir ?
'' :
$b->getMimeType();
70 return match ($this->view_request->getSortation()) {
79 default => strcasecmp(
$a->getTitle(),
$b->getTitle()),
83 return $entries_at_current_level;
88 return count($this->getEntries());
__construct(private Request $view_request,)
const BY_CREATION_DATE_DESC
const BY_CREATION_DATE_ASC
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples