Completed
Push — master ( 163fd9...314ef3 )
by Neomerx
02:36
created

Group::__construct()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
ccs 15
cts 15
cp 1
rs 8.8571
cc 5
eloc 11
nc 16
nop 1
crap 5
1
<?php namespace Limoncello\Core\Routing;
2
3
/**
4
 * Copyright 2015-2016 [email protected] (www.neomerx.com)
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
/**
20
 * @package Limoncello\Core
21
 */
22
class Group extends BaseGroup
23
{
24
    /**
25
     * @param array $parameters
26
     */
27 20
    public function __construct(array $parameters = [])
28
    {
29
        list($middleware, $configurators, $factoryWasGiven, $requestFactory, $name) =
30 20
            $this->normalizeGroupParameters($parameters);
31
32 20
        if (empty($middleware) === false) {
33 1
            $this->setMiddleware($middleware);
34 1
        }
35 20
        if (empty($configurators) === false) {
36 2
            $this->setConfigurators($configurators);
37 2
        }
38 20
        if (empty($name) === false) {
39 1
            $this->setName($name);
40 1
        }
41 20
        if ($factoryWasGiven === true) {
42 7
            $this->setRequestFactory($requestFactory);
43 7
        }
44 20
    }
45
46
    /**
47
     * @return null
48
     */
49 13
    public function parentGroup()
50
    {
51
        // null
52 13
        return parent::parentGroup();
53
    }
54
55
    /**
56
     * @return NestedGroup
57
     */
58 12
    protected function createGroup()
59
    {
60 12
        $group = (new NestedGroup($this))->setHasTrailSlash($this->hasTrailSlash());
61
62 12
        return $group;
63
    }
64
}
65