I am trying to figure out how I can use PHP interfaces in my MVC design. I want to make sure that the design implements an interface so that any new module adheres to it.
For example:
& lt ;? Php interface base API {public function post message ($ msg); } Class ServiceAPI implements BaseAPI {Public Function Post Message ($ msg) {Back to $ msg; }} Class Service_Two_API implies BaseAPI {public function post message ($ msg) {return "can not do this:". Msg msg; }}? & Gt;
I want to do it in CI. Is this possible? How should I design it?
Depends on what you are asking if you are asking if you have code igniter framework You can follow, you can follow your interface, but its framework will require complete refactoring, and probably will not be worth the work.
If you are asking if you can add the interface to your custom classes using Code Igniter, you can. CI does not limit your ability to create a custom code; in fact, what is it for me? I think the real answer is "What are you really asking?".
Comments
Post a Comment