RouterFactory::createRouter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
/**
3
 * This file is part of the DS Framework.
4
 *
5
 * (c) Dan Smith <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Ds\Router;
11
12
use Ds\Router\Adaptor\FastRouteAdaptor;
13
use Ds\Router\Interfaces\AdaptorInterface;
14
use Ds\Router\Interfaces\RouteCollectionInterface;
15
use Ds\Router\Serializer\SuperClosure;
16
use SuperClosure\Serializer;
17
18
/**
19
 * Class RouterFactory
20
 *
21
 * Factory helper class for creating Routers.
22
 *
23
 * @package Ds\Router
24
 * @author  Dan Smith    <[email protected]>
25
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
26
 */
27
class RouterFactory
28
{
29
    /**
30
     * @param AdaptorInterface $adaptor
31
     * @param RouteCollectionInterface $collection
32
     * @param array $options
33
     *
34
     * @return Router
35
     */
36 1
    public static function createRouter(AdaptorInterface $adaptor, RouteCollectionInterface $collection, array $options = [])
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38 1
        return new Router($adaptor, $collection);
39
    }
40
41
    /**
42
     * @param array $options
43
     * @return Router
44
     * @throws \Rs\Router\Exceptions\RouterException
45
     */
46 1
    public static function createFastRouter(array $options = [])
47
    {
48 1
        return new Router(
49 1
            new FastRouteAdaptor(
50 1
                new SuperClosure(
51 1
                    new Serializer()
52
                ), $options
53
            ),
54 1
            new RouteCollection(),
55
            $options
56
        );
57
    }
58
}
59