Skip to content
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

Fix loadable route #18 #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 1 addition & 11 deletions src/Pecee/SimpleRouter/Route/ILoadableRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ public function setUrl(string $url): self;
*/
public function prependUrl(string $url): self;

/**
* Sets the router name, which makes it easier to obtain the url or router at a later point.
* Alias for LoadableRoute::setName().
*
* @param string|array $name
* @return static
* @see LoadableRoute::setName()
*/
public function name(array|string $name): self;

/**
* Returns the provided name for the router.
*
Expand Down Expand Up @@ -94,4 +84,4 @@ public function getMatch(): ?string;
*/
public function setMatch(string $regex): self;

}
}
12 changes: 11 additions & 1 deletion src/Pecee/SimpleRouter/Route/IRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ public function setWhere(array $options): self;
*/
public function where(array $options): self;

/**
* Sets the router name, which makes it easier to obtain the url or router at a later point.
* Alias for LoadableRoute::setName().
*
* @param string|array $name
* @return static
* @see LoadableRoute::setName()
*/
public function name(array|string $name): self;

/**
* Get parameters
*
Expand Down Expand Up @@ -246,4 +256,4 @@ public function getFilterEmptyParams(): bool;
* @return InputValidator|array|null
*/
public function getInputValidator(): InputValidator|array|null;
}
}
16 changes: 15 additions & 1 deletion src/Pecee/SimpleRouter/Route/RouteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ public function getPrefix(): ?string
{
return $this->prefix;
}

/**
* Sets the router name, which makes it easier to obtain the url or router at a later point.
* Alias for RouteGroup::setName().
*
* @param string $name
* @return static
* @see RouteGroup::setName()
*/
public function name(array|string $name): IGroupRoute
{
return $this->setName($name);
}

/**
* @param string $name
* @return static
Expand Down Expand Up @@ -284,4 +298,4 @@ public function toArray(): array
return array_merge($values, parent::toArray());
}

}
}
Loading