DASPRiD / Dash

Flexible PSR-7 compliant HTTP router
BSD 2-Clause "Simplified" License
29 stars 9 forks source link

`GenericFactory` should build a `Generic` route with a `GenericOptions` object #10

Closed Ocramius closed 10 years ago

Ocramius commented 10 years ago

As of https://github.com/DASPRiD/Dash/blob/2271fdbfdb7a627f22cb8cb51223a6ec1a98aeeb/src/Dash/Mvc/Router/Http/Route/GenericFactory.php#L34, the route is built and then modified.

It would be better to pass in an options object to allow strictness, or alternatively to pass in the array of correct keys at construct time to remove any kind of overhead

DASPRiD commented 10 years ago

The generic route is perfectly valid without any configuration at all. None of the configuration is required, so there are no hard dependencies. I'm also no fan of options arrays in a constructor, since they move factory logic into the class.