Skip to content

v1.6.1 fix daemon mode #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/Business/Executor/RouteExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function execute(Request $request, bool $flush = true): Response
{
$route = $this->urlMatcher->match($request);
$this->containerRegistry->register(Request::class, fn (): Request => $request);
$this->containerRegistry->register(Request::class, fn (): Request => $request, true);
$callback = $this->responseCallbackFactory->create($route);

try {
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Executor/RouteExecutorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function create(): RouteExecutorInterface
{
return new RouteExecutor(
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Generator/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public function __construct(private RouteCollectionInterface $routeCollection)
{
}

/**
* {@inheritDoc}
*/
public function generateUrlByRouteName(string $routeName, array|null $parameters = []): string
{
$route = $this->routeCollection->getRouteByName($routeName);
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Generator/UrlGeneratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function create(): UrlGeneratorInterface
{
return new UrlGenerator($this->routeCollectionFactory->create());
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Locator/RouteLocatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function create(): RouteLocatorInterface
{
$providerType = mb_strtolower($this->configuration->getRouteLocatorType());
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Matcher/Route/Matchers/MethodMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
*/
class MethodMatcher implements RouteMatcherInterface
{
/**
* {@inheritDoc}
*/
public function match(RouteInterface $route, Request $request): bool
{
return \in_array(mb_strtoupper($request->getMethod()), $route->getMethods());
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Matcher/Route/Matchers/UriMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
*/
class UriMatcher implements RouteMatcherInterface
{
/**
* {@inheritDoc}
*/
public function match(RouteInterface $route, Request $request): bool
{
$pathInfo = $request->getPathInfo();
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Matcher/Route/RouteMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function match(RouteInterface $route, Request $request): bool
{
foreach ($this->matchers as $matcher) {
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Matcher/UrlMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function match(Request $request): RouteInterface
{
foreach ($this->routeCollection->iterateRoutes() as $route) {
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Matcher/UrlMatcherFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function create(): UrlMatcherInterface
{
return new UrlMatcher(
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Response/Callback/ResponseCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function __invoke(): mixed
{
$controller = $this->route->getController();
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Response/Transformer/ResponseTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function transform(Request $request, Response $response, mixed &$responseData): bool
{
$transformed = false;
Expand Down
20 changes: 0 additions & 20 deletions src/Business/Route/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
{
/**
* @param array<class-string, string|null>|class-string|\Closure|object $controller
* @param string|null $pattern
* @param array|null $parameters
*
* @phpstan-ignore-next-line
*/
Expand All @@ -35,49 +33,31 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function getUri(): string
{
return $this->uri;
}

/**
* {@inheritDoc}
*/
public function getController(): callable|string|array|object
{
return $this->controller;
}

/**
* {@inheritDoc}
*/
public function getMethods(): array
{
return $this->methods;
}

/**
* {@inheritDoc}
*/
public function getName(): string|null
{
return $this->name;
}

/**
* {@inheritDoc}
*/
public function getPattern(): string|null
{
return $this->pattern;
}

/**
* {@inheritDoc}
*/
public function getParameters(): array|null
{
return $this->parameters;
Expand Down
23 changes: 4 additions & 19 deletions src/Business/Route/RouteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,13 @@ public function __construct(
$this->methods = $this->methodsByDefault;
}

/**
* {@inheritDoc}
*/
public function setName(string $name): self
{
$this->name = $name;

return $this;
}

/**
* {@inheritDoc}
*/
public function addMethod(string $method): self
{
if (!\in_array($method, $this->methods)) {
Expand All @@ -70,9 +64,6 @@ public function addMethod(string $method): self
return $this;
}

/**
* {@inheritDoc}
*/
public function setMethods(array $methods): self
{
$this->methods = [];
Expand All @@ -84,19 +75,13 @@ public function setMethods(array $methods): self
return $this;
}

/**
* {@inheritDoc}
*/
public function setController(string|array|\Closure $action): self
{
$this->action = $action;

return $this;
}

/**
* {@inheritDoc}
*/
public function setUri(string $uri): self
{
$this->uri = $uri;
Expand Down Expand Up @@ -128,10 +113,10 @@ public function build(): RouteInterface
}

if (
$this->action &&
(
!\is_callable($this->action) &&
(\is_string($this->action) && (class_exists($this->action) && !$this->name))
$this->action
&& (
!\is_callable($this->action)
&& (\is_string($this->action) && (class_exists($this->action) && !$this->name))
)
) {
$exceptions[] = 'The route action should be callable. Examples: `[object, "method|<route_name>"], [Classname, "metnod|<routeName>"], Classname::method, Classname, function() {}` Current value: '.$this->action;
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Route/RouteBuilderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
readonly class RouteBuilderFactory implements RouteBuilderFactoryInterface
{
/**
* {@inheritDoc}
*/
public function create(): RouteBuilderInterface
{
return new RouteBuilder();
Expand Down
18 changes: 0 additions & 18 deletions src/Business/Route/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public function __construct(array $routes = [])
$this->setRoutes($routes);
}

/**
* {@inheritDoc}
*/
public function setRoutes(iterable $routes): self
{
$this->routes = [];
Expand All @@ -64,9 +61,6 @@ public function setRoutes(iterable $routes): self
return $this;
}

/**
* {@inheritDoc}
*/
public function addRoute(RouteInterface $route): self
{
$routeName = $route->getName();
Expand All @@ -90,9 +84,6 @@ public function addRoute(RouteInterface $route): self
return $this;
}

/**
* {@inheritDoc}
*/
public function getRouteByName(string $name): RouteInterface
{
if (!\array_key_exists($name, $this->routes)) {
Expand All @@ -102,25 +93,16 @@ public function getRouteByName(string $name): RouteInterface
return $this->routes[$name];
}

/**
* {@inheritDoc}
*/
public function getRoutes(): iterable
{
return array_values($this->routes);
}

/**
* {@inheritDoc}
*/
public function getRoutesNames(): array
{
return array_keys($this->routes);
}

/**
* {@inheritDoc}
*/
public function iterateRoutes(): iterable
{
foreach ($this->routesNamesStatic as $routeName) {
Expand Down
3 changes: 0 additions & 3 deletions src/Business/Route/RouteCollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function __construct(
$this->routeCollection = null;
}

/**
* {@inheritDoc}
*/
public function create(): RouteCollectionInterface
{
if ($this->routeCollection) {
Expand Down
5 changes: 1 addition & 4 deletions src/Exception/HttpBadRequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
*/
class HttpBadRequestException extends HttpException
{
/**
* @param \Throwable|null $previous
*/
public function __construct(string $message = 'Bad Request.', \Throwable|null $previous = null)
public function __construct(string $message = 'Bad Request.', \Throwable $previous = null)
{
parent::__construct($message, 400, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HttpException extends \RuntimeException
public function __construct(
string $message = '',
int $code = 0,
?\Throwable $previous = null
\Throwable $previous = null
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpForbiddenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class HttpForbiddenException extends HttpException
{
public function __construct(string $message = 'Forbidden.', ?\Throwable $previous = null)
public function __construct(string $message = 'Forbidden.', \Throwable $previous = null)
{
parent::__construct($message, 403, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpInternalServerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class HttpInternalServerException extends HttpException
{
public function __construct(string $message = 'Internal Server Error.', ?\Throwable $previous = null)
public function __construct(string $message = 'Internal Server Error.', \Throwable $previous = null)
{
parent::__construct($message, 500, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class HttpNotFoundException extends HttpException
{
public function __construct(string $message = 'Not Found.', ?\Throwable $previous = null)
public function __construct(string $message = 'Not Found.', \Throwable $previous = null)
{
parent::__construct($message, 404, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpUnauthorizedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class HttpUnauthorizedException extends HttpException
{
public function __construct(string $message = 'Unauthorized.', ?\Throwable $previous = null)
public function __construct(string $message = 'Unauthorized.', \Throwable $previous = null)
{
parent::__construct($message, 401, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ResponseInvalidException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ResponseInvalidException extends \RuntimeException
{
private mixed $responseData;

public function __construct(mixed $responseData, int $code = 0, ?\Throwable $previous = null)
public function __construct(mixed $responseData, int $code = 0, \Throwable $previous = null)
{
parent::__construct('Invalid response object type.', $code, $previous);

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/RouteAlreadyDeclaredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class RouteAlreadyDeclaredException extends RouteConfigurationException
{
public function __construct(string $routeName, int $code = 0, ?\Throwable $previous = null)
public function __construct(string $routeName, int $code = 0, \Throwable $previous = null)
{
parent::__construct(sprintf('The route "%s" already defined and can not be redeclare.', $routeName), $code, $previous);
}
Expand Down
Loading