Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 2, 2023
1 parent 6b0a522 commit 066c077
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/FolioManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ class FolioManager
*/
public function route(string $path = null, ?string $uri = '/', array $middleware = []): PendingRoute
{
$path = $path ? $path : config('view.paths')[0].'/pages';

return new PendingRoute($this, $path, $uri, $middleware);
return new PendingRoute(
$this,
$path ? $path : config('view.paths')[0].'/pages',
$uri,
$middleware
);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/MountPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function __construct(
public ?string $domain,
) {
$this->path = str_replace('/', DIRECTORY_SEPARATOR, $path);

$this->middleware = new PathBasedMiddlewareList($middleware);
}

Expand Down
2 changes: 1 addition & 1 deletion src/PendingRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class PendingRoute
{
/**
* Creates a new pending route instance.
* Create a new pending route instance.
*
* @param array<string, array<int, string>> $middleware
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function match(Request $request, string $uri): ?MatchedView
{
$uri = strlen($uri) > 1 ? trim($uri, '/') : $uri;

if ($view = $this->matchAtPath($this->mountPath, $request, $uri)) {
if ($view = $this->matchAtPath($request, $uri)) {
return $view;
}

Expand All @@ -46,19 +46,19 @@ public function match(Request $request, string $uri): ?MatchedView
/**
* Resolve the given URI via page based routing at the given mount path.
*/
protected function matchAtPath(MountPath $mountPath, Request $request, string $uri): ?MatchedView
protected function matchAtPath(Request $request, string $uri): ?MatchedView
{
$state = new State(
uri: $uri,
mountPath: $mountPath->path,
mountPath: $this->mountPath->path,
segments: explode('/', $uri)
);

for ($i = 0; $i < $state->uriSegmentCount(); $i++) {
$value = (new Pipeline)
->send($state->forIteration($i))
->through([
new EnsureMatchesDomain($request, $mountPath),
new EnsureMatchesDomain($request, $this->mountPath),
new EnsureNoDirectoryTraversal,
new TransformModelBindings($request),
new SetMountPathOnMatchedView,
Expand Down

0 comments on commit 066c077

Please sign in to comment.