Completed
Push — master ( fdda97...b0b47a )
by Arman
17s queued 11s
created

route_callback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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.0.0
13
 */
14
use Quantum\Routes\RouteController;
15
16
if (!function_exists('current_middlewares')) {
17
18
    /**
19
     * Gets current middlewares
20
     * @return array|null
21
     */
22
    function current_middlewares()
23
    {
24
        return RouteController::getCurrentRoute()['middlewares'] ?? null;
25
    }
26
27
}
28
29
if (!function_exists('current_module')) {
30
31
    /**
32
     * Gets current module
33
     * @return string|null
34
     */
35
    function current_module()
36
    {
37
        return RouteController::getCurrentRoute()['module'] ?? null;
38
    }
39
40
}
41
42
if (!function_exists('current_controller')) {
43
44
    /**
45
     * Get current controller
46
     * @return string|null
47
     */
48
    function current_controller()
49
    {
50
        return RouteController::getCurrentRoute()['controller'] ?? null;
51
    }
52
53
}
54
55
if (!function_exists('current_action')) {
56
57
    /**
58
     * Gets current action
59
     * @return string|null
60
     */
61
    function current_action()
62
    {
63
        return RouteController::getCurrentRoute()['action'] ?? null;
64
    }
65
66
}
67
68
if (!function_exists('route_callback')) {
69
70
    /**
71
     * Get current callback
72
     * @return \Closure $callback|null
73
     */
74
    function route_callback()
75
    {
76
        return RouteController::getCurrentRoute()['callback'] ?? null;
77
    }
78
79
}
80
81
if (!function_exists('current_route')) {
82
83
    /**
84
     * Gets current route
85
     * @return string|null
86
     */
87
    function current_route()
88
    {
89
        return RouteController::getCurrentRoute()['route'] ?? null;
90
    }
91
92
}
93
94
if (!function_exists('current_route_args')) {
95
96
    /**
97
     * Gets current route args
98
     * @return array
99
     */
100
    function current_route_args()
101
    {
102
        return array_values(RouteController::getCurrentRoute()['args']) ?? [];
103
    }
104
105
}
106
107
if (!function_exists('current_route_pattern')) {
108
109
    /**
110
     * Gets current route pattern
111
     * @return string
112
     */
113
    function current_route_pattern()
114
    {
115
        return RouteController::getCurrentRoute()['pattern'] ?? '';
116
    }
117
118
}
119
120
if (!function_exists('current_route_method')) {
121
122
    /**
123
     * Gets current route method
124
     * @return string
125
     */
126
    function current_route_method()
127
    {
128
        return RouteController::getCurrentRoute()['method'] ?? '';
129
    }
130
131
}
132
133
if (!function_exists('current_route_uri')) {
134
135
    /**
136
     * Gets the current route uri
137
     * @return string
138
     */
139
    function current_route_uri()
140
    {
141
        return RouteController::getCurrentRoute()['uri'] ?? '';
142
    }
143
144
}