Skip to content

Commit

Permalink
Fixed middleware class finding bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammetsafak committed Aug 20, 2022
1 parent 246bcb8 commit 556b1e1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Muhammet ŞAFAK <info@muhammetsafak.com.tr>
* @copyright Copyright © 2022 Muhammet ŞAFAK
* @license ./LICENSE MIT
* @version 1.1.2
* @version 1.1.3
* @link https://www.muhammetsafak.com.tr
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/PageNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Muhammet ŞAFAK <info@muhammetsafak.com.tr>
* @copyright Copyright © 2022 Muhammet ŞAFAK
* @license ./LICENSE MIT
* @version 1.1.2
* @version 1.1.3
* @link https://www.muhammetsafak.com.tr
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/RouterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Muhammet ŞAFAK <info@muhammetsafak.com.tr>
* @copyright Copyright © 2022 Muhammet ŞAFAK
* @license ./LICENSE MIT
* @version 1.1.2
* @version 1.1.3
* @link https://www.muhammetsafak.com.tr
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Muhammet ŞAFAK <info@muhammetsafak.com.tr>
* @copyright Copyright © 2022 Muhammet ŞAFAK
* @license ./LICENSE MIT
* @version 1.1.2
* @version 1.1.3
* @link https://www.muhammetsafak.com.tr
*/

Expand Down
8 changes: 4 additions & 4 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Muhammet ŞAFAK <info@muhammetsafak.com.tr>
* @copyright Copyright © 2022 Muhammet ŞAFAK
* @license ./LICENSE MIT
* @version 1.1.2
* @version 1.1.3
* @link https://www.muhammetsafak.com.tr
*/

Expand Down Expand Up @@ -875,13 +875,13 @@ private function middleware_class_find(string $class): string
if(!isset($this->current_route) || \class_exists($class)){
return $class;
}
$namespace = $this->current_route['namespaces']['middleware'];
$namespace = $this->current_route['options']['namespaces']['middleware'];
$class_full_name = \rtrim($namespace, '\\') . '\\' . \ltrim($class, '\\');
if(\class_exists($class_full_name)){
return $class_full_name;
}
if(!empty($this->current_route['paths']['middleware'])){
$path = \rtrim($this->current_route['paths']['middleware'], '/\\') . \DIRECTORY_SEPARATOR . \ltrim($class, '\\/') . '.php';
if(!empty($this->current_route['options']['paths']['middleware'])){
$path = \rtrim($this->current_route['options']['paths']['middleware'], '/\\') . \DIRECTORY_SEPARATOR . \ltrim($class, '\\/') . '.php';
if(\is_file($path)){
require $path;
if(\class_exists($class_full_name)){
Expand Down
2 changes: 1 addition & 1 deletion src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Muhammet ŞAFAK <info@muhammetsafak.com.tr>
* @copyright Copyright © 2022 Muhammet ŞAFAK
* @license ./LICENSE MIT
* @version 1.1.2
* @version 1.1.3
* @link https://www.muhammetsafak.com.tr
*/

Expand Down

0 comments on commit 556b1e1

Please sign in to comment.