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

Chain   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 9 3
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
}