Search code examples
phppyrocms

what's meaning of the source code "new CI;" in pyrocms?


I want to research the source code of pyrocms, and when I read the Base.php, I can't understand the following code

new CI;

the file is system/cms/libraries/Base.php

My problems are

  1. why there has no a variable name, like $CI = new CI;
  2. why it can be used as CI::$APP->config->item('controller_suffix') in it's sub class MX_Controller since there does not have variable name?

Thank you very much!!!


Solution

    1. This object isn't stored in a variable because it seems we don't need to manipulate it. On the other hand, look at its constructor: it does a lot of things (since it also calls the constructor of CI_Controller, which in turns loads a Loader and initializer it, ....)

    So, we don't build it in order to manipulate it afterwards, but in order to run the code in its constructor.

    1. We can use CI::$APP-> whatever because $APP is a static member, hence it doesn't require to have an instance of CI to be manipulated