I am learning CodeIgniter (CI). I have seen CI supports OOP concepts but I am wondering in every example all over the web and forums, method declared in Controllers use public keyword. I think this is not a dumb question. Even in CI userguide I have seen they always use public keyword. Then what happens to encapsulation?
can you help me to clear this.
As we all know CI is MVC frame work
As the figure show the the view can call the controller and the model.
controller can call the model and view and the model can call a view .
in this cases most of the methods in controllers are called by the view and this function have the logic to process that request from the View.We can write private methods in controllers and model, this can only called form the same Class(As you says, Most of the examples try to illustrate a features on CI , there is no need of writing private methods ie, you didn’t familiar in private methods-this will only used in more structured applications ).There is no matter about the encapsulation and all.“