Comments (7)
We can't have PSR-1 and PSR-2 at this point, @WinterSilence.
I would go one step further to define the interfaces for those classes.
- Make Router interface dependent on Route interface
- Make the Request dependent on Router interface
This way we can have multiple implementations of Route:
- Route_Legacy (the route we currently have with
directory
andprefix
- Route_Dynamic (the route we want to acheive in #571 with FCQN controller maybe with
namespace
andsuffix
Controller - Route_Static (a static route that does not get affected by a
controller
parameter, it just routes to the controller and action defined in that route)
Also, we can have multiple implementation of Router interface, one of them would be to load from config.
Moreover:
- add a
process
method to Router, so that processing will be handled inside the Router from Request and should return matched Route along with the controller.
Add unit tests :)
Cheers!
from core.
At this stage, discuss common issues.
I don't suggest using these classes, this is only sketches. At first, we need to discuss the principles of classes. I just described my classes to highlight the major changes.
from core.
Alright @WinterSilence. 👍 for separating router and route.
from core.
Make Router interface dependent on Route interface
I agree, but we need to make a list of the main methods.
Moreover: add a process method to Router, so that processing will be handled inside the Router from Request and should return matched Route along with the controller.
I dont understand, you can write an example?
Add unit tests
Too early for this.
Add sketches for your version - interfaces and dummy-classes (empty methods)
from core.
add a process method to Router
I was saying if we can remove this method from Request and put it where it belongs:
https://github.com/kohana/core/blob/3.3/master/classes/Kohana/Request.php#L457
from core.
Update: added interfaces for routes (IRoute), requests (IRequest) and public function Router::process(IRequest $request)
from core.
- Do not prefix interfaces names with
I
, we do not have a naming convention for that. Just choose the most generic name possible, in this caseRoute
andRouter
are sufficient. - Add a
Router
interface withprocess
,get_route
andset_route
- At this point, we should not mess with Request (also there are interfaces for that already), so maybe
process
should only care about$uri
andmethod
? Is there anything elseRouter
needs to process from Request?
from core.
Related Issues (20)
- Use of mikey179/vfsStream for Log tests breaks module builds HOT 3
- 3.4.0 current status HOT 49
- Change detecting urls starting with //
- Improvements on website HOT 10
- 1 repo to rule them all HOT 12
- .git files in modules release for 3.3.5 HOT 4
- 4.0.0 release HOT 16
- Ubuntu packages HOT 9
- modules and composer - play together nicer HOT 2
- Should we remove 'action', 'controller', 'directory' from request params? HOT 4
- Implementation of external requests in Minion Task HOT 5
- [Security] Encrypt HOT 34
- Issues with PHP 7.0.6 and ORM HOT 3
- Use Route:url in Minion Task HOT 1
- ERROR: Kohana_Exception [ 0 ]: Directory APPPATH/cache must be writable HOT 8
- "content-length" -header calculation in Response
- Server Upgraded to PHP7 Error: __toString() must not throw an exception HOT 4
- Error en Core Handle
- Function Valid::date for timestamp HOT 1
- [Proposal] Make middlewares HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.