STGroup   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A group() 0 8 1
1
<?php
2
/**
3
 * Setup group
4
 * User: moyo
5
 * Date: 2018/5/29
6
 * Time: 10:43 AM
7
 */
8
9
namespace Carno\Web\Chips\Router;
10
11
trait STGroup
12
{
13
    /**
14
     * @var string
15
     */
16
    private $prefix = '';
17
18
    /**
19
     * @var string
20
     */
21
    private $group = 'default';
22
23
    /**
24
     * @param string $prefix
25
     * @param string|null $name
26
     * @return static
27
     */
28
    public function group(string $prefix, string $name = null) : self
29
    {
30
        $setup = clone $this;
31
32
        $setup->prefix = rtrim($prefix, '/');
33
        $setup->group = $name ?? $this->group;
34
35
        return $setup;
36
    }
37
}
38