Skip to content

Commit

Permalink
Remove redundant comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Dec 28, 2023
1 parent 007b239 commit 2e89913
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/FileRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Yiisoft\FileRouter;

use PHPUnit\Logging\Exception;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
Expand Down Expand Up @@ -69,14 +68,13 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

private function parseAction(ServerRequestInterface $request): ?string
{
$action = match ($request->getMethod()) {
return match ($request->getMethod()) {
'HEAD', 'GET' => 'index',
'POST' => 'create',
'PUT' => 'update',
'DELETE' => 'delete',
default => throw new Exception('Not implemented.'),
default => throw new \Exception('Not implemented.'),
};
return $action;
}

private function parseController(ServerRequestInterface $request): mixed
Expand Down Expand Up @@ -107,20 +105,6 @@ private function parseController(ServerRequestInterface $request): mixed
return $className;
}

// alternative version finding namespace by file


//$controllerDirectory = $this->aliases->get('src') . DIRECTORY_SEPARATOR . $this->baseControllerDirectory;
//$classPath = $controllerDirectory . DIRECTORY_SEPARATOR . $directoryPath . DIRECTORY_SEPARATOR . $controller;
//$filename = $classPath . '.php';
//if (file_exists($filename)) {
// $content = file_get_contents($filename);
// $namespace = preg_match('#namespace\s+(.+?);#', $content, $matches) ? $matches[1] : '';
// if (class_exists($namespace . '\\' . $controller)) {
// return $namespace . '\\' . $controller;
// }
//}

return null;
}
}

0 comments on commit 2e89913

Please sign in to comment.