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
Push — master ( b6fac6...dceac4 )
by Dušan
01:15
created

MultipleOperationsTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2
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