33 * @author : Jakiboy
44 * @package : FloatPHP
55 * @subpackage : Kernel Component
6- * @version : 1.3 .x
6+ * @version : 1.4 .x
77 * @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected] > 88 * @link : https://floatphp.com
99 * @license : MIT
@@ -36,9 +36,6 @@ final class Middleware
3636 */
3737 public function __construct (RouterInterface $ router )
3838 {
39- // Init configuration
40- $ this ->initConfig ();
41-
4239 // Prepare router from config
4340 $ router ->setBase ($ this ->getBaseRoute ());
4441
@@ -136,7 +133,7 @@ private function doInstance() : void
136133 $ class = $ this ->parseClass ();
137134 $ method = $ this ->parseMethod ();
138135 $ var = $ this ->parseVar ();
139- $ role = $ this ->parsePermissions ();
136+ $ role = $ this ->parsePermission ();
140137
141138 // Secure access
142139 $ instance = new $ class ();
@@ -191,7 +188,7 @@ private function doModuleInstance() : void
191188 $ class = $ this ->parseModuleClass ();
192189 $ method = $ this ->parseMethod ();
193190 $ var = $ this ->parseVar ();
194- $ role = $ this ->parsePermissions ();
191+ $ role = $ this ->parsePermission ();
195192
196193 // Secure access
197194 $ instance = new $ class ();
@@ -290,7 +287,7 @@ private function isAuthController($class) : bool
290287 if ( $ this ->hasObject ('parent ' , $ class , __NAMESPACE__ . '\AbstractAuthController ' ) ) {
291288 return true ;
292289
293- } elseif ( $ this ->hasAuthMiddlewareInterface ($ class ) ) {
290+ } elseif ( $ this ->hasAuthMiddleInterface ($ class ) ) {
294291 return true ;
295292 }
296293 return false ;
@@ -378,7 +375,7 @@ private function hasApiInterface($class) : bool
378375 * @param string $class
379376 * @return bool
380377 */
381- private function hasAuthMiddlewareInterface ($ class ) : bool
378+ private function hasAuthMiddleInterface ($ class ) : bool
382379 {
383380 return $ this ->hasObject ('interface ' , $ class , 'AuthMiddlewareInterface ' );
384381 }
@@ -412,7 +409,7 @@ private function parseModuleClass() : string
412409 $ this ->throwError (404 );
413410 }
414411 $ module = $ this ->removeString ('Module ' , $ class );
415- return $ this ->getModuleNamespace ( ) . "{$ module }\\{$ class }" ;
412+ return $ this ->getNamespace ( ' module ' ) . "{$ module }\\{$ class }" ;
416413 }
417414
418415 /**
@@ -428,7 +425,7 @@ private function parseClass() : string
428425 if ( !$ class ) {
429426 $ this ->throwError (404 );
430427 }
431- return "{$ this ->getControllerNamespace ( )}{$ class }" ;
428+ return "{$ this ->getNamespace ( ' controller ' )}{$ class }" ;
432429 }
433430
434431 /**
@@ -449,7 +446,7 @@ private function parseMethod() : string
449446 * @access private
450447 * @return mixed
451448 */
452- private function parsePermissions () : mixed
449+ private function parsePermission () : mixed
453450 {
454451 return $ this ->match ['permissions ' ] ?? false ;
455452 }
0 commit comments