Passed
Push — master ( d2743c...7dbeaf )
by Nícollas
01:44
created

Functions::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace MinasRouter\Helpers;
4
5
use MinasRouter\Router\Route;
6
7
class Functions
8
{
9
    /**
10
     * Method responsible for returning the
11
     * active RouteCollection instance.
12
     * 
13
     * @return null|\MinasRouter\Router\RouteCollection
14
     */
15
    protected function collection()
16
    {
17
        return Route::$collection;
18
    }
19
20
    /**
21
     * Method responsible for returning a route.
22
     * 
23
     * @param string $name
24
     * 
25
     * @return null|\MinasRouter\Router\RouteManager
26
     */
27
    public function get(String $routerName)
28
    {
29
        return $this->collection()->getByName($routerName);
30
    }
31
32
    /**
33
     * Method responsible for returning the
34
     * current route.
35
     * 
36
     * @return null|\MinasRouter\Router\RouteManager
37
     */
38
    public function current()
39
    {
40
        return $this->collection()->getCurrentRoute();
41
    }
42
}