Completed
Push — master ( 27a7eb...61672c )
by Arman
16s queued 12s
created

route_args()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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