Passed
Push — master ( 39666f...8b4565 )
by Бабичев
09:02
created

Prefix   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A storage() 0 16 2
1
<?php
2
3
namespace Bavix\Router\Type;
4
5
use Bavix\Slice\Slice;
6
7
class Prefix extends Http
8
{
9
10
    /**
11
     * @var bool
12
     */
13
    protected $pathRequired = true;
14
15
    /**
16
     * @param string $key
17
     * @param Slice  $slice
18
     *
19
     * @return array
20
     */
21
    protected function storage($key, Slice $slice)
22
    {
23
        list($path, $regex) = $this->path($slice);
24
25
        $methods = $this->slice->getData('methods');
26
27
        return [
28
            'defaults' => (array)$this->slice->getData('defaults') + $this->defaults,
29
            'methods'  => empty($methods) ? $this->methods : $methods,
30
            'protocol' => $this->protocol,
31
            'host'     => $this->host,
32
            'regex'    => $regex,
33
            'path'     => $this->path . $path,
34
            'key'      => $this->key . '.' . $key,
35
        ];
36
    }
37
38
}
39