Passed
Push — master ( 1afdc5...93f20a )
by
unknown
01:15 queued 13s
created

DummyStreamDecorator::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Maxim Sokolovsky
4
 */
5
6
namespace WS\Utils\Collections;
7
8
class DummyStreamDecorator implements Stream
9
{
10
11
    /**
12
     * @var Stream
13
     */
14
    private $decoratedStream;
15
16 25
    public function __construct(Stream $originalStream)
17
    {
18 25
        $this->decoratedStream = $originalStream;
19 25
    }
20
21 1
    public function each(callable $consumer): Stream
22
    {
23 1
        return $this;
24
    }
25
26 1
    public function walk(callable $consumer, ?int $limit = null): Stream
27
    {
28 1
        return $this;
29
    }
30
31 5
    public function filter(callable $predicate): Stream
32
    {
33 5
        return $this;
34
    }
35
36 1
    public function reorganize(callable $reorganizer): Stream
37
    {
38 1
        return $this;
39
    }
40
41 1
    public function allMatch(callable $predicate): bool
42
    {
43 1
        return $this->decoratedStream->allMatch($predicate);
44
    }
45
46 1
    public function anyMatch(callable $predicate): bool
47
    {
48 1
        return $this->decoratedStream->anyMatch($predicate);
49
    }
50
51 1
    public function map(callable $converter): Stream
52
    {
53 1
        return $this;
54
    }
55
56 1
    public function collect(callable $collector)
57
    {
58 1
        return $this->decoratedStream->collect($collector);
59
    }
60
61 1
    public function findAny()
62
    {
63 1
        return $this->decoratedStream->findAny();
64
    }
65
66 1
    public function findFirst(callable $filter = null)
67
    {
68 1
        return $this->decoratedStream->findFirst();
69
    }
70
71 1
    public function findLast()
72
    {
73 1
        return $this->decoratedStream->findLast();
74
    }
75
76 1
    public function min(callable $comparator)
77
    {
78 1
        return $this->decoratedStream->min($comparator);
79
    }
80
81 1
    public function max(callable $comparator)
82
    {
83 1
        return $this->decoratedStream->max($comparator);
84
    }
85
86 1
    public function sort(callable $comparator): Stream
87
    {
88 1
        return $this;
89
    }
90
91 1
    public function sortBy(callable $extractor): Stream
92
    {
93 1
        return $this;
94
    }
95
96 1
    public function sortDesc(callable $comparator): Stream
97
    {
98 1
        return $this;
99
    }
100
101 1
    public function sortByDesc(callable $extractor): Stream
102
    {
103 1
        return $this;
104
    }
105
106 1
    public function reverse(): Stream
107
    {
108 1
        return $this;
109
    }
110
111 1
    public function reduce(callable $accumulator, $initialValue = null)
112
    {
113 1
        return $this->decoratedStream->reduce($accumulator, $initialValue);
114
    }
115
116 1
    public function limit(int $size): Stream
117
    {
118 1
        return $this;
119
    }
120
121 14
    public function getCollection(): Collection
122
    {
123 14
        return $this->decoratedStream->getCollection();
124
    }
125
126 2
    public function when(bool $condition): Stream
127
    {
128 2
        if ($condition) {
129 1
            return $this->decoratedStream;
130
        }
131
132 1
        return $this;
133
    }
134
135 1
    public function always(): Stream
136
    {
137 1
        return $this->decoratedStream;
138
    }
139
140
    /**
141
     * @inheritDoc
142
     */
143
    public function toArray(): array
144
    {
145
        return $this
146
            ->getCollection()
147
            ->toArray()
148
        ;
149
    }
150
151
    /**
152
     * @inheritDoc
153
     */
154
    public function getSet(): Set
155
    {
156
        return new HashSet($this->toArray());
157
    }
158
}
159