Passed
Push — master ( 39ef33...5f4097 )
by Arman
03:00 queued 15s
created

RouteController::__call()   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
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.9.5
13
 */
14
15
namespace Quantum\Router;
16
17
use Quantum\Exceptions\ControllerException;
18
19
/**
20
 * RouterController Class
21
 * @package Quantum\Router
22
 */
23
abstract class RouteController
24
{
25
26
    /**
27
     * List of routes
28
     * @var array
29
     */
30
    protected static $routes = [];
31
32
    /**
33
     * Contains current route information
34
     * @var array
35
     */
36
    protected static $currentRoute = null;
37
38
    /**
39
     * @var bool
40
     */
41
    public $csrfVerification = true;
42
43
    /**
44
     * Gets the current route
45
     * @return array
46
     */
47
    public static function getCurrentRoute(): ?array
48
    {
49
        return self::$currentRoute;
50
    }
51
52
    /**
53
     * @param array $route
54
     */
55
    public static function setCurrentRoute(array $route)
56
    {
57
        self::$currentRoute = $route;
58
    }
59
60
    /**
61
     * Set Routes
62
     * @param array $routes
63
     */
64
    public static function setRoutes(array $routes)
65
    {
66
        static::$routes = $routes;
67
    }
68
69
    /**
70
     * Get Routes
71
     * @return array
72
     */
73
    public static function getRoutes(): array
74
    {
75
        return static::$routes;
76
    }
77
78
    /**
79
     * Handles the missing methods of the controller
80
     * @param string $method
81
     * @param array $arguments
82
     * @throws ControllerException
83
     */
84
    public function __call(string $method, array $arguments)
85
    {
86
        throw ControllerException::undefinedMethod($method);
87
    }
88
}
89