5
5
* @subpackage : Kernel Component
6
6
* @version : 1.0.0
7
7
* @category : PHP framework
8
- * @copyright : (c) 2017 - 2021 JIHAD SINNAOUR <[email protected] >
8
+ * @copyright : (c) 2017 - 2022 Jihad Sinnaour <[email protected] >
9
9
* @link : https://www.floatphp.com
10
- * @license : MIT License
10
+ * @license : MIT
11
11
*
12
- * This file if a part of FloatPHP Framework
12
+ * This file if a part of FloatPHP Framework.
13
13
*/
14
14
15
+ declare (strict_types=1 );
16
+
15
17
namespace FloatPHP \Kernel ;
16
18
17
- use FloatPHP \Classes \Http \ Response ;
18
- use FloatPHP \ Classes \ Filesystem \TypeCheck ;
19
- use FloatPHP \ Classes \ Filesystem \ Stringify ;
20
- use FloatPHP \ Classes \ Filesystem \ Arrayify ;
19
+ use FloatPHP \Classes \{
20
+ Filesystem \ TypeCheck , Filesystem \ Stringify , Filesystem \Arrayify ,
21
+ Http \ Response
22
+ } ;
21
23
use FloatPHP \Interfaces \Classes \RouterInterface ;
22
24
23
25
final class Middleware
@@ -30,32 +32,32 @@ final class Middleware
30
32
private $ match ;
31
33
32
34
/**
33
- * Middleware system
34
- * $router->addMatchTypes(['name'=>'regex']);
35
+ * Middleware system.
35
36
*
36
37
* @param RouterInterface $router
38
+ * @see $router->addMatchTypes(['name'=>'regex']);
37
39
*/
38
40
public function __construct (RouterInterface $ router )
39
41
{
40
42
// Init configuration
41
43
$ this ->initConfig ();
42
44
43
- // prepare router from config
45
+ // Prepare router from config
44
46
$ router ->setBasePath ($ this ->getBaseRoute ());
45
47
46
- // set global router
48
+ // Set global router
47
49
$ router ->addRoutes ($ this ->getRoutes ());
48
50
49
- // set modules router
51
+ // Set modules router
50
52
$ module = new Module ();
51
53
$ router ->addRoutes ($ module ->getModulesRoutes ());
52
54
53
- // match request
55
+ // Match request
54
56
$ this ->match = $ router ->match ();
55
57
}
56
58
57
59
/**
58
- * Dispatch request & provide response
60
+ * Dispatch request & provide response.
59
61
*
60
62
* @access public
61
63
* @param void
@@ -82,7 +84,7 @@ public function dispatch()
82
84
}
83
85
84
86
/**
85
- * If controller is a function
87
+ * Whether controller is a function.
86
88
*
87
89
* @access private
88
90
* @param void
@@ -97,7 +99,7 @@ private function isCallable() : bool
97
99
}
98
100
99
101
/**
100
- * If controller is a class
102
+ * Whether controller is a class.
101
103
*
102
104
* @access private
103
105
* @param void
@@ -112,7 +114,7 @@ private function isClassMethod() : bool
112
114
}
113
115
114
116
/**
115
- * Execute callable
117
+ * Execute callable.
116
118
*
117
119
* @access private
118
120
* @param void
@@ -486,7 +488,7 @@ private function parsePermissions()
486
488
}
487
489
488
490
/**
489
- * Parse request var
491
+ * Parse request var.
490
492
*
491
493
* @access private
492
494
* @param void
0 commit comments