Completed
Push — master ( db978a...536211 )
by Aydin
31s queued 11s
created

Collection::values()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpSchool\CliMenu\Util;
6
7
class Collection
8
{
9
    /**
10
     * @var array
11
     */
12
    private $items;
13
14
    public function __construct(array $items)
15
    {
16
        $this->items = $items;
17
    }
18
19
    public function map(callable $cb) : self
20
    {
21
        return new self(mapWithKeys($this->items, $cb));
22
    }
23
24
    public function filter(callable $cb) : self
25
    {
26
        return new self(filter($this->items, $cb));
27
    }
28
29
    public function values() : self
30
    {
31
        return new self(array_values($this->items));
32
    }
33
34
    public function each(callable $cb) : self
35
    {
36
        each($this->items, $cb);
37
38
        return $this;
39
    }
40
41
    public function all() : array
42
    {
43
        return $this->items;
44
    }
45
}
46