AbstractAdaptor::isCached()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 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\Adaptor;
11
12
use Ds\Router\Interfaces\AdaptorInterface;
13
use Ds\Router\Interfaces\RouteCollectionInterface;
14
use Ds\Router\Interfaces\SerializerInterface;
15
16
/**
17
 * Class AbstractAdaptor
18
 *
19
 * @package Ds\Router\Adaptor
20
 * @author  Dan Smith    <[email protected]>
21
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
22
 */
23
abstract class AbstractAdaptor implements AdaptorInterface
24
{
25
    /**
26
     * @var SerializerInterface
27
     */
28
    public $serializer;
29
    /**
30
     * @var array
31
     */
32
    protected $options = [];
33
34
    /**
35
     * Adaptor constructor.
36
     * @param SerializerInterface $serializer
37
     */
38 14
    public function __construct(SerializerInterface $serializer)
39
    {
40 14
        $this->serializer = $serializer;
41 14
    }
42
43
44
    /**
45
     * @inheritdoc
46
     */
47 4
    public function getOptions()
48
    {
49 4
        return $this->options;
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    public function getOption($key)
56
    {
57
        if (isset($this->options[$key])) {
58
            return $this->options[$key];
59
        }
60
        return null;
61
    }
62
63
    /**
64
     * @inheritdoc
65
     */
66 1
    public function withOptions(array $options = [])
67
    {
68 1
        $this->options = $options;
69 1
    }
70
71
    /**
72
     * @inheritdoc
73
     */
74
    abstract public function match(RouteCollectionInterface $routes, $method, $requestTarget);
75
76
    /**
77
     * @inheritdoc
78
     */
79
    abstract public function getCachedRoutes($context = '');
80
81
    /**
82
     * @inheritdoc
83
     */
84
    abstract public function isCached();
85
}
86