Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 1294
Zeile 19... Zeile 19...
19
     */
19
     */
20
    public function __construct(private iterable $listing)
20
    public function __construct(private iterable $listing)
21
    {
21
    {
22
    }
22
    }
Zeile -... Zeile 23...
-
 
23
 
-
 
24
    /**
-
 
25
     * @param callable(T): bool $filter
-
 
26
     * @return DirectoryListing<T>
23
 
27
     */
24
    public function filter(callable $filter): DirectoryListing
28
    public function filter(callable $filter): DirectoryListing
25
    {
29
    {
26
        $generator = (static function (iterable $listing) use ($filter): Generator {
30
        $generator = (static function (iterable $listing) use ($filter): Generator {
27
            foreach ($listing as $item) {
31
            foreach ($listing as $item) {
Zeile 32... Zeile 36...
32
        })($this->listing);
36
        })($this->listing);
Zeile 33... Zeile 37...
33
 
37
 
34
        return new DirectoryListing($generator);
38
        return new DirectoryListing($generator);
Zeile -... Zeile 39...
-
 
39
    }
-
 
40
 
-
 
41
    /**
-
 
42
     * @template R
-
 
43
     * @param callable(T): R $mapper
35
    }
44
     * @return DirectoryListing<R>
36
 
45
     */
37
    public function map(callable $mapper): DirectoryListing
46
    public function map(callable $mapper): DirectoryListing
38
    {
47
    {
39
        $generator = (static function (iterable $listing) use ($mapper): Generator {
48
        $generator = (static function (iterable $listing) use ($mapper): Generator {
Zeile 43... Zeile 52...
43
        })($this->listing);
52
        })($this->listing);
Zeile 44... Zeile 53...
44
 
53
 
45
        return new DirectoryListing($generator);
54
        return new DirectoryListing($generator);
Zeile -... Zeile 55...
-
 
55
    }
-
 
56
 
-
 
57
    /**
46
    }
58
     * @return DirectoryListing<T>
47
 
59
     */
48
    public function sortByPath(): DirectoryListing
60
    public function sortByPath(): DirectoryListing
Zeile 49... Zeile 61...
49
    {
61
    {