CollectionSpec::mapBehavior()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PHPKitchen\Platform\Specs\Unit\Struct;
4
5
use PHPKitchen\Platform\Specs\Base;
6
use PHPKitchen\Platform\Struct\Collection;
7
8
/**
9
 * Specification for {@link Collection}
10
 *
11
 * @author Dmitry Kolodko <[email protected]>
12
 */
13
class CollectionSpec extends Base\Spec {
14
    /**
15
     * @test
16
     */
17
    public function constructorBehavior() {
18
        $collection = Collection::of([]);
19
        $this->tester->seeBool($collection->isNull())
20
                     ->isFalse();
21
    }
22
23
    /**
24
     * @test
25
     */
26
    public function isEmptyBehavior() {
27
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
28
29
        $I->describe('behavior of empty assert method');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
30
        $collection = Collection::of([1, 2, 3]);
31
32
        $I->expectThat('collection with data considered as not empty');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
33
        $I->seeBool($collection->isEmpty())
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
34
          ->isFalse();
35
36
        $collection = Collection::of([]);
37
38
        $I->expectThat('collection without data considered as empty');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
39
        $I->seeBool($collection->isEmpty())
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
40
          ->isTrue();
41
    }
42
43
    /**
44
     * @test
45
     */
46
    public function clearBehavior() {
47
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
48
49
        $I->describe('behavior of collection cleaning method');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
50
        $collection = Collection::of([1, 2, 3]);
51
        $collection->clear();
52
53
        $I->expectThat('after cleaning collection become empty');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
54
        $I->seeBool($collection->isEmpty())
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
55
          ->isTrue();
56
    }
57
58
    /**
59
     * @test
60
     */
61
    public function hasMethodsGroupBehavior() {
62
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
63
64
        $I->describe('behavior of "has" methods group');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
65
        $collection = Collection::of([1, 2, 3, null]);
66
67
        $I->expectThat('`hasKey` returns `true` for existing and `false` for not existing keys');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
68
        $I->seeBool($collection->hasKey($firstElementKey = 0))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
69
          ->isTrue();
70
        $I->seeBool($collection->hasKey($notExistingKey = 5))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
71
          ->isFalse();
72
73
        $I->expectThat('`has` returns `true` for existing and `false` for not existing element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
74
        $I->seeBool($collection->has($secondElement = 2))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
75
          ->isTrue();
76
        $I->seeBool($collection->has($notExistingElement = 56))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
77
          ->isFalse();
78
79
        $I->expectThat('`hasSet` returns `true` for set and `false` for not set and null elements at specified key');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
80
        $I->seeBool($collection->hasSet($firstElementKey = 0))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
81
          ->isTrue();
82
        $I->seeBool($collection->hasSet($nullElementKey = 3))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
83
          ->isFalse();
84
        $I->seeBool($collection->hasSet($notExistingElementKey = 5))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
85
          ->isFalse();
86
    }
87
88
    /**
89
     * @test
90
     */
91
    public function removeMethodsGroupBehavior() {
92
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
93
94
        $I->describe('behavior of "remove" methods group');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
95
        $collection = Collection::of([
96
            1,
97
            3,
98
            3,
99
            3,
100
            4,
101
            4,
102
            4,
103
        ]);
104
105
        $I->expectThat('`removeAt` unset element with specified key');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
106
107
        $collection->removeAt($firstElementKey = 0);
108
        $I->seeBool($collection->hasKey($firstElementKey = 0))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
109
          ->isFalse();
110
111
        $I->expectThat('`remove` unset first occurrences of specified element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
112
113
        $collection->remove($elementWithDuplicates = 3);
114
        $I->seeBool($collection->hasKey($firstDuplicateKey = 1))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
115
          ->isFalse();
116
        $I->seeBool($collection->hasKey($secondDuplicateKey = 2))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
117
          ->isTrue();
118
        $I->seeBool($collection->hasKey($thirdDuplicateKey = 3))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
119
          ->isTrue();
120
121
        $I->expectThat('`removeAll` unset all occurrences of specified element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
122
123
        $collection->removeAll($secondDuplicate = 4);
124
        $I->seeBool($collection->has($secondDuplicate = 4))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
125
          ->isFalse();
126
    }
127
128
    /**
129
     * @test
130
     */
131
    public function onEachBehavior() {
132
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
133
134
        $I->describe('`onEach` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
135
136
        $collection = Collection::of([1, 2, 3]);
137
138
        $I->expectThat('callback does not modify elements passed by value');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
139
140
        $collection->onEach(function ($element) {
141
            $element++;
142
        });
143
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
144
          ->isEqualTo(Collection::of([1, 2, 3]));
145
146
        $I->expectThat('callback can modify elements passed by link');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
147
148
        $collection->onEach(function (&$element) {
149
            $element++;
150
        });
151
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
152
          ->isEqualTo(Collection::of([2, 3, 4]));
153
    }
154
155
    /**
156
     * @test
157
     */
158
    public function onEachRecursiveBehavior() {
159
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
160
161
        $I->describe('`onEachRecursive` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
162
163
        $collection = Collection::of([1, 2, 3, [1, 2, 3]]);
164
165
        $I->expectThat('callback does not modify elements passed by value');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
166
167
        $collection->onEachRecursive(function ($element) {
168
            $element++;
169
        });
170
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
171
          ->isEqualTo(Collection::of([1, 2, 3, [1, 2, 3]]));
172
173
        $I->expectThat('callback can modify elements passed by link');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
174
175
        $collection->onEachRecursive(function (&$element) {
176
            $element++;
177
        });
178
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
179
          ->isEqualTo(Collection::of([2, 3, 4, [2, 3, 4]]));
180
    }
181
182
    /**
183
     * @test
184
     */
185
    public function filterBehavior() {
186
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
187
188
        $I->describe('`filter` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
189
190
        $collection = Collection::of([1, 2, 3, 3]);
191
192
        $I->expectThat('filter callable is able to change the collection ');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
193
194
        $filteredCollection = $collection->filter(function ($element) {
195
            if ($element == 3) {
0 ignored issues
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return !($element == 3);.
Loading history...
196
                return false;
197
            };
198
199
            return true;
200
        });
201
        $I->lookAt('collection filtered from `3` elements');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
202
        $I->see($filteredCollection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
203
          ->isEqualTo(Collection::of([1, 2]));
204
    }
205
206
    /**
207
     * @test
208
     */
209
    public function mapBehavior() {
210
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
211
212
        $I->describe('`map` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
213
214
        $collection = Collection::of([1, 2, 3]);
215
216
        $I->expectThat('map callable is able to change the collection ');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
217
218
        $mappedCollection = $collection->map(function ($element) {
219
            return $element * $element;
220
        });
221
        $I->lookAt('collection mapped by `square` function');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
222
        $I->see($mappedCollection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
223
          ->isEqualTo(Collection::of([1, 4, 9]));
224
    }
225
226
    /**
227
     * @test
228
     */
229
    public function reduceBehavior() {
230
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
231
232
        $I->describe('`reduce` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
233
234
        $collection = Collection::of([1, 2, 3]);
235
236
        $I->expectThat('reduce callable is able to traverse through collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
237
238
        $reduceValue = $collection->reduce(function ($result, $element) {
239
            $result += $element;
240
241
            return $result;
242
        });
243
        $I->lookAt('reduce callable is able to traverse through collection with initial value set');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
244
        $I->seeNumber($reduceValue)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
245
          ->isEqualTo($sumOfCollection = 6);
246
        $I->expectThat('reduce callable is able to change the collection ');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
247
248
        $reduceValue = $collection->reduce(function ($result, $element) {
249
            $result += $element;
250
251
            return $result;
252
        }, 4);
253
        $I->lookAt('collection value reduced by `sum` function with initial value');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
254
        $I->seeNumber($reduceValue)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
255
          ->isEqualTo($sumOfCollectionWithInitialValue = 10);
256
    }
257
258
    /**
259
     * @test
260
     */
261
    public function keyMethodsGroupBehavior() {
262
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
263
264
        $I->describe('`key` methods group behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
265
266
        $collection = Collection::of([1, 2, 3, 3, 3]);
267
268
        $I->expectThat('`keyOf` return key of a first occurrence of given element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
269
270
        $firstKeyOfDuplicate = $collection->keyOf(3);
271
        $I->lookAt('key of duplicated element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
272
        $I->seeNumber($firstKeyOfDuplicate)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
273
          ->isEqualTo(2);
274
275
        $I->expectThat('`lastKeyOf` return key of a last occurrence of given element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
276
277
        $lastKeyOfDuplicate = $collection->lastKeyOf(3);
278
        $I->lookAt('last key of duplicated element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
279
        $I->seeNumber($lastKeyOfDuplicate)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
280
          ->isEqualTo(4);
281
282
        $I->expectThat('`allKeysOf` return collection of keys of all occurrences of given element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
283
284
        $allKeysOfDuplicate = $collection->allKeysOf(3);
285
        $I->lookAt('collection duplicated element keys');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
286
        $I->seeArray($allKeysOfDuplicate)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
287
          ->isEqualTo(Collection::of([2, 3, 4]));
288
    }
289
290
    /**
291
     * @test
292
     */
293
    public function countValuesFrequencyBehavior() {
294
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
295
296
        $I->describe('`countValuesFrequency` methods group behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
297
298
        $collection = Collection::of([3, 3, 3, 1, 'Sam', 'sam']);
299
300
        $I->expectThat('`countValuesFrequency` honor string values case');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
301
302
        $caseSensitiveFrequency = $collection->countValuesFrequency();
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $caseSensitiveFrequency exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
303
        $I->lookAt('case sensitive values frequency');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
304
        $I->see($caseSensitiveFrequency)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
305
          ->isEqualTo(Collection::of([
306
              3 => 3,
307
              1 => 1,
308
              'Sam' => 1,
309
              'sam' => 1,
310
          ]));
311
312
        $I->expectThat('`countValuesFrequency` honor string values case');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
313
314
        $caseSensitiveFrequency = $collection->countValuesFrequencyIgnoringCase();
315
        $I->lookAt('case sensitive values frequency');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
316
        $I->see($caseSensitiveFrequency)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
317
          ->isEqualTo(Collection::of([
318
              3 => 3,
319
              1 => 1,
320
              'sam' => 2,
321
          ]));
322
    }
323
324
    /**
325
     * @test
326
     */
327 View Code Duplication
    public function calculateProductBehavior() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
328
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
329
330
        $I->describe('`calculateProduct` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
331
332
        $collection = Collection::of([2, 4, 3]);
333
334
        $I->expectThat('numeric collection product can be calculated');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
335
336
        $collectionProduct = $collection->calculateProduct();
337
338
        $I->seeNumber($collectionProduct)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
339
          ->isEqualTo(24);
340
341
        $collection = Collection::of([2, 'hi', 'there']);
342
343
        $I->expectThat('mixed collection product can be calculated');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
344
345
        $collectionProduct = $collection->calculateProduct();
346
347
        $I->seeNumber($collectionProduct)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
348
          ->isEqualTo(0);
349
    }
350
351
    /**
352
     * @test
353
     */
354 View Code Duplication
    public function popBehavior() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
355
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
356
357
        $I->describe('`pop` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
358
359
        $collection = Collection::of([2, 4, 3]);
360
361
        $I->expectThat('`pop` ejects last element fro the collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
362
363
        $poppedElement = $collection->pop();
364
365
        $I->lookAt('popped element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
366
        $I->seeNumber($poppedElement)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
367
          ->isEqualTo($lastCollectionElement = 3);
368
        $I->lookAt('collection without last(popped) element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
369
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
370
          ->isEqualTo(Collection::of([2, 4]));
371
    }
372
373
    /**
374
     * @test
375
     */
376 View Code Duplication
    public function shiftBehavior() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
377
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
378
379
        $I->describe('`shift` behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
380
381
        $collection = Collection::of([2, 4, 3]);
382
383
        $I->expectThat('`shift` ejects first element fro the collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
384
385
        $poppedElement = $collection->shift();
386
387
        $I->lookAt('shifted element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
388
        $I->seeNumber($poppedElement)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
389
          ->isEqualTo($firstCollectionElement = 2);
390
        $I->lookAt('collection without first(shifted) element');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
391
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
392
          ->isEqualTo(Collection::of([4, 3]));
393
    }
394
395
    /**
396
     * @test
397
     */
398
    public function addBehavior() {
399
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
400
401
        $I->describe('`add` method behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
402
        $collection = Collection::of([1, 2]);
403
404
        $I->expectThat('`add` method push element to the end of the collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
405
406
        $collection->add(3);
407
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
408
          ->isEqualTo(Collection::of([1, 2, 3]));
409
    }
410
411
    /**
412
     * @test
413
     */
414
    public function pushBehavior() {
415
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
416
417
        $I->describe('`push` method behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
418
        $collection = Collection::of([1, 2]);
419
420
        $I->expectThat('`push` with one argument push passed value to the end of the collection');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
421
422
        $collection->push(3);
423
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
424
          ->isEqualTo(Collection::of([1, 2, 3]));
425
        $I->expectThat('`push` with several arguments push all of the elements to the end of the collection keeping order');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
426
427
        $collection->push(4, 5);
428
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
429
          ->isEqualTo(Collection::of([1, 2, 3, 4, 5]));
430
    }
431
432
    /**
433
     * @test
434
     */
435
    public function padBehavior() {
436
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
437
438
        $I->describe('`pad` method behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
439
440
        $I->expectThat('`pad` with positive size add given value to the right side of the collection till collection rich required size');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
441
442
        $collection = Collection::of([1, 2]);
443
        $collection->pad(4, 9);
444
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
445
          ->isEqualTo(Collection::of([1, 2, 9, 9]));
446
447
        $I->expectThat('`pad` with negative size add given value to the left side of the collection till collection rich required size');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
448
449
        $collection = Collection::of([1, 2, 3]);
450
        $collection->pad(-4, 9);
451
        $I->see($collection)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
452
          ->isEqualTo(Collection::of([9, 1, 2, 3]));
453
    }
454
455
    /**
456
     * @test
457
     */
458
    public function chunkByBehavior() {
459
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
460
461
        $I->describe('`chunkBy` methods group behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
462
463
        $collection = Collection::of([1, 2, 3, 4]);
464
465
        $I->expectThat('`chunkBy` split collection on chunks with specified size not keeping original keys.');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
466
467
        $chunks = $collection->chunkBy(2);
468
        $I->see($chunks)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
469
          ->isEqualTo(Collection::of([
470
              Collection::of([1, 2]),
471
              Collection::of([3, 4]),
472
          ]));
473
474
        $I->expectThat('`chunkKeepingKeysBy` split collection on chunks with specified size keeping original keys.');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
475
476
        $chunks = $collection->chunkKeepingKeysBy(2);
477
        $I->see($chunks)
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
478
          ->isEqualTo(Collection::of([
479
              Collection::of([0 => 1, 1 => 2]),
480
              Collection::of([2 => 3, 3 => 4]),
481
          ]));
482
    }
483
484
    /**
485
     * @test
486
     */
487
    public function arrayAccessBehavior() {
488
        $I = $this->tester;
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $I. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
489
490
        $I->describe('array access behavior');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
491
492
        $collection = Collection::of([]);
493
494
        $I->expectThat('collection allows to set and read values through array access');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
495
496
        $collection[0] = 1;
497
        $collection['first'] = 1;
498
499
        $I->see($collection[0])
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
500
          ->isEqualTo(1);
501
        $I->see($collection['first'])
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
502
          ->isEqualTo(1);
503
504
        $I->expectThat('not set keys return `null` and considered as not set');
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
505
506
        $I->seeBool(isset($collection['not-existing']))
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
507
          ->isFalse();
508
        $I->see($collection['not-existing'])
0 ignored issues
show
Coding Style introduced by
$I does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
509
          ->isNull();
510
    }
511
}