Test Failed
Push — master ( b480ce...8fe18f )
by Terzi
03:48
created

Chain::make()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Terranet\Administrator;
4
5
class Chain
6
{
7
    /**
8
     * Create chain of responsibility.
9
     *
10
     * @param array $queue
11
     */
12
    public static function make(array $queue = [])
13
    {
14
        foreach ($queue as $i => &$instance) {
15
            if ($next = array_get($queue, $i + 1)) {
16
                $instance->setNext($next);
17
            }
18
        }
19
20
        return array_first($queue);
21
    }
22
}