Match::getRoute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Mpociot\ApiDoc\Matching\RouteMatcher;
4
5
use Illuminate\Routing\Route;
6
7
class Match implements \ArrayAccess
8
{
9
    /**
10
     * @var Route
11
     */
12
    protected $route;
13
14
    /**
15
     * @var array
16
     */
17
    protected $rules;
18
19
    /**
20
     * Match constructor.
21
     *
22
     * @param Route $route
23
     * @param array $applyRules
24
     */
25
    public function __construct(Route $route, array $applyRules)
26
    {
27
        $this->route = $route;
28
        $this->rules = $applyRules;
29
    }
30
31
    /**
32
     * @return Route
33
     */
34
    public function getRoute()
35
    {
36
        return $this->route;
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function getRules()
43
    {
44
        return $this->rules;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function offsetExists($offset)
51
    {
52
        return is_callable([$this, 'get' . ucfirst($offset)]);
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function offsetGet($offset)
59
    {
60
        return call_user_func([$this, 'get' . ucfirst($offset)]);
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function offsetSet($offset, $value)
67
    {
68
        return $this->$offset = $value;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function offsetUnset($offset)
75
    {
76
        $this->$offset = null;
77
    }
78
}
79