Welcome Guest, Not a member yet? Register   Sign In
[5.0] RouteCollection as a collection
#1

Hi.
I want to express my opinion about the RouteCollection class.
It seems to me that the RouteCollection class is overloaded with functionality that does not relate to the concept of a collection.
For example, for me the normal behavior is to put data into collection and get data from the collection.
But what does the class do?

1. Does not add routes to the collection if the specified subdomain does not match the current one. 
For example, this affects the list of routes returned by the spark routes command.

2. Processes data. Replacing placeholders, defining a namespace, working with a route handler, etc.
It seems to me that the logic can be implemented in a new Route class. It will be executed on demand. And since it is an object, then save the state when reused.

3. Options are extracted from the route and stored separately. What for?

4. Search for route filters or whether the route is a redirect. This is not the competence of the collection.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB