-
-
Notifications
You must be signed in to change notification settings - Fork 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
Refine routes list functionality #58
Open
settermjd
wants to merge
20
commits into
mezzio:2.10.x
Choose a base branch
from
settermjd:refine-routes-list-functionality
base: 2.10.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+795
−788
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
74360ac
Refactor RoutesFilter to use a RouteFilterOptionsInterface object
settermjd c1d7005
Add docblock comments for RouteFilterOptionsInterface methods
settermjd d6428c4
Refactor filter options as class member variables
settermjd 59af694
Refactor RouteFilterOptions to require specific types without defaults
settermjd 5db68d1
Replace the Exception with a Throwable in RoutesFilter
settermjd 924dce8
Refactor ListRoutesCommand to take a RouteCollector directly
settermjd 8ebec29
Minor code clean up
settermjd d9d312b
Refactor how ListRoutesCommandFactory retrieves a ConfigLoaderInterface
settermjd 85272ab
Add a default way of retrieving routes from the application
settermjd 8629833
Load the DefaultRoutesConfigLoaderFactory with Mezzio Tooling
settermjd faca61d
Update src/Routes/Filter/RouteFilterOptionsInterface.php
settermjd 4d43eea
Update src/Routes/Filter/RouteFilterOptions.php
settermjd 1e444fc
Clean up file to match changes in recent commits
settermjd f060930
Update README to match style guide
settermjd 85fb178
Remove redundant EmptyRouteFilterOptions
settermjd 0196ed9
Update RouteFilterOptions to match RouteFilterOptionsInterface
settermjd b698744
Remove unrequired RouteFilterOptionsInterface parameter
settermjd 59cd05c
Update ConfigProvider configuration for RoutesFileConfigLoader
settermjd ec8cff7
Remove redundant toArray method from RouteFilterOptions
settermjd 0155d7d
Fix up a small bug in RouteFilterOptions
settermjd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mezzio\Tooling\Routes; | ||
|
||
use Mezzio\Application; | ||
use Mezzio\MiddlewareFactory; | ||
use Psr\Container\ContainerInterface; | ||
|
||
/** | ||
* This class provides a default factory implementation for retrieving an app's routes | ||
|
||
* The assumption with this "default" config loader factory is that you're | ||
* loading routes from config/routes.php in your Mezzio application. So, if | ||
* that's not the case in your application, create a custom loader | ||
* implementation and override the alias in the DiC. | ||
*/ | ||
final class DefaultRoutesConfigLoaderFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): ConfigLoaderInterface | ||
{ | ||
/** @var Application $application */ | ||
$application = $container->get(Application::class); | ||
|
||
/** @var MiddlewareFactory $factory */ | ||
$factory = $container->get(MiddlewareFactory::class); | ||
|
||
return new RoutesFileConfigLoader( | ||
'config/routes.php', | ||
$application, | ||
$factory, | ||
$container | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mezzio\Tooling\Routes\Filter; | ||
|
||
interface RouteFilterOptionsInterface | ||
{ | ||
/** | ||
* Determines if the specified filter ($filterOption) has been set | ||
*/ | ||
public function has(string $filterOption): bool; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
/** | ||
* Retrieves a route middleware filter the available routing data by | ||
*/ | ||
public function getMiddleware(): string|null; | ||
|
||
/** | ||
* Retrieves a route name filter the available routing data by | ||
*/ | ||
public function getName(): string|null; | ||
|
||
/** | ||
* Retrieves a route path to filter the available routing data by | ||
*/ | ||
public function getPath(): string|null; | ||
|
||
/** | ||
* Returns any route methods to filter the available routing data by | ||
* | ||
* @return list<string> | ||
*/ | ||
public function getMethods(): array; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface seems unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still used in
RoutesFilter
and seems worth keeping.