GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#56)
by Issei
02:22
created

MultipleOperationsTest::testIt()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 1
nop 0
dl 0
loc 30
rs 9.44
c 0
b 0
f 0
1
<?php
2
3
namespace DusanKasan\Knapsack\Tests\Scenarios;
4
5
use DusanKasan\Knapsack\Collection;
6
use PHPUnit_Framework_TestCase;
7
8
class MultipleOperationsTest extends PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * Example of a longer pipeline. If this was real code, you should probably split it into smaller chunks.
12
     */
13
    public function testIt()
14
    {
15
        $array = [1, 2, 8, 3, 7, 5, 1, 4, 4,];
16
        $collection = new Collection($array);
17
18
        $result = $collection
19
            ->reject(function ($v) {
20
                return $v > 2;
21
            })
22
            ->filter(function ($k) {
23
                return $k > 5;
24
            })
25
            ->distinct()
26
            ->concat([1, 2])
27
            ->map(function ($i) {
28
                return [$i, $i + 1];
29
            })
30
            ->flatten()
31
            ->sort(function ($a, $b) {
32
                return $a > $b;
33
            })
34
            ->slice(2, 5)
35
            ->groupBy(function ($v) {
36
                return $v % 2 == 0 ? 'even' : 'odd';
37
            })
38
            ->get('even')
39
            ->toArray();
40
41
        $this->assertEquals([2], $result);
42
    }
43
}
44