19declare(strict_types=1);
39 $this->irss =
$DIC->resourceStorage();
44 return $this->view_request;
50 public function getEntries(): array
52 static $entries_at_current_level;
53 static $current_level;
55 if ($current_level !== $this->view_request->getPath()) {
56 unset($entries_at_current_level);
58 if (isset($entries_at_current_level)) {
59 return $entries_at_current_level;
62 $current_level = $this->view_request->getPath();
64 $entries_at_current_level = iterator_to_array(
65 $this->view_request->getWrapper()->getEntries()
69 usort($entries_at_current_level,
function (
File|Dir
$a,
File|Dir
$b):
int {
70 $size_a =
$a instanceof Dir ? 0 :
$a->getSize();
71 $size_b =
$b instanceof Dir ? 0 :
$b->getSize();
72 $type_a =
$a instanceof Dir ?
'' :
$a->getMimeType();
73 $type_b =
$b instanceof Dir ?
'' :
$b->getMimeType();
74 return match ($this->view_request->getSortation()) {
83 default => strcasecmp(
$a->getTitle(),
$b->getTitle()),
87 return $entries_at_current_level;
92 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