27 foreach ( self::$routes as $routePath => $routeDetails ) {
28 if (! isset ( $routeDetails [
'controller'] )) {
29 $routeDetails = \current ( $routeDetails );
31 if(\is_string($routeDetails [
'controller'])){
32 if ($controller === \str_replace(
'\\\\',
'\\',$routeDetails [
'controller']) && $action === $routeDetails [
'action']) {
33 $routeDetails [
'path'] = $routePath;
43 foreach ( self::$routes as $routePath => $routeDetails ) {
44 if (! isset ( $routeDetails [
'controller'] )) {
45 foreach ( $routeDetails as $method => $routeInfo ) {
46 if ($routeInfo [
'controller'] === $controller) {
51 if ($routeDetails [
'controller'] === $controller) {
60 $method = new \ReflectionMethod ( $controller, $routeInfo [
'action'] );
61 $parameters = $method->getParameters ();
62 $routeParams = $routeInfo [
'parameters'];
63 $pattern =
"@\(.*?\)@";
65 foreach ( $routeParams as $param ) {
67 $params [] = $parameters [\count ( $params )]->getName ();
69 $index = ( int ) \filter_var ( $param, FILTER_SANITIZE_NUMBER_INT );
70 $params [] = $parameters [$index]->getName ();
74 foreach ( $params as $param ) {
75 $path = \preg_replace ( $pattern,
'{' . $param .
'}', $path, 1 );
86 $path = self::slashPath ( $path );
87 foreach ( self::$routes as $routePath => $routeDetails ) {
88 if (\preg_match (
"@^{$routePath}\$@s", $path, $matches ) || \stripslashes ( $routePath ) == $path) {
89 if (! isset ( $routeDetails [
'controller'] )) {
90 return \current ( $routeDetails );
100 foreach ( self::$routes as $routePath => $routeDetails ) {
101 if (! isset ( $routeDetails [
'controller'] )) {
102 $routeDetails = \current ( $routeDetails );
104 if ($routeDetails [
'controller'] === $controllerName && $routeDetails [
'action'] === $actionName)
105 $result [$routePath] = $routeDetails;