Welcome Guest, Not a member yet? Register   Sign In
What the logic behind config files being classes?

(04-21-2016, 05:20 AM)sv3tli0 Wrote: I don't think that there is huge difference between class / object / array configs.

How ever in such class as https://github.com/lonnieezell/CodeIgnit...rvices.php
I don't like all of those static method definitions. Configs should be as cleanest as possible (even if they are classes).

That "config" file acts more like a factory than a standard config file, and the static methods aid in usability. Services::routes() vs new Config\Services()->routes(); Static methods are not always evil, not matter what the internet might like to say. They just make testing a little more difficult. For cases like these, they work great.

(04-21-2016, 05:20 AM)sv3tli0 Wrote: And its a little bit of strange to have such important things outside the system. As I see it, it is +1 dependency for the system to work.
In CI 3 it was index.php > SYSTEM && APP , and now it is index.php > System && Config && App

I think that the flow should be:
index > init System (no configs here) > init App (configs && app)

I believe we've had this discussion before.... but we allow the application folder to act as a namespace, and we allow that namespace to be changed by the user. The only clean way to do that is to have Config always stay the same so system files can find it.

Messages In This Thread
RE: What the logic behind config files being classes? - by kilishan - 04-21-2016, 07:47 AM

Theme © iAndrew 2016 - Forum software by © MyBB