Comments (7)
This constant is useless, I'm voting to remove it.
from codeigniter4.
I agree with @narfbg. In the 10 or so years that I've been working with CI, I don't think I've ever found a need for that. And it's handled by the $systemFolder variable if you want to change it.
from codeigniter4.
It's been removed.
from codeigniter4.
I think that the same remove can be made and on other constants. Path Class is a lot better choice to register and handle paths..
from codeigniter4.
I don't see a path class being beneficial here. The way CI has always done it is simple, by creating constants for paths that are constant. They're available sitewide. And they use less resources than a class would.
from codeigniter4.
I can't give any 100% important reason to have class instead of just constants.
But at least what I understand from OOP developement, hard coded constants are not really beautiful solution.
Instead all over the code to check if file_exists(SOMEPATH. 'folder/file') and to require it..
You can just use 1 already loaded resource to get the existing path of the file which you need and if it doesn't you will get proper exception/error (not existing no permissions and etc)..
Of course this has something to do and with the Loaders..
from codeigniter4.
Like anything else, OOP design can be taken to extremes it really doesn't need to be.
In this case, you're right, that's more to do with a loader, or some other class. But if you go the route of creating OOP wrappers for all of PHP's non-OOP functions, things get a little crazy. :) In this case, your example, while a valid function (not necessarily requiring an entire class, but could be ...) would replace if file_exists
calls with try/catch blocks
throughout the code, which can harm performance, and isn't anymore beautiful when all you want to do is see if file exists
....
I'm not saying your class idea doesn't have certain appeals for different situations, but for this one, I think it's overkill and complicates things instead of simplifies them.
from codeigniter4.
Related Issues (20)
- Bug: form_open with no URL supplied HOT 2
- Bug: `service('example')` null return if service is defined in the custom namespace in Manual Installation CI4.5.0 HOT 2
- Official User Guide is not updated HOT 1
- Bug: [Postgre] Unable to connect to the database HOT 5
- Bug: Failed to open stream: No such file or directory (root/index.php) HOT 4
- Bug: [QueryBuilder] join() with BETWEEN causes TypeError preg_quote(): Argument #1 ($str) must be of type string, false given HOT 7
- Bug: redirect()->back() caching issue HOT 2
- Bug: getInsertID is only returning 0 when using the Save() method HOT 3
- Bug: CI4 + Shield + Postgre Spark error HOT 3
- Bug: bootstrap on `preload` not updated to last v4.5.1 HOT 1
- Bug: [ErrorException] Undefined array key "opcache.enable" HOT 1
- Bug: [Model] when the query ($this->first()) result returns NULL we get TypeError HOT 2
- Bug: [OCI8] Argument #1 ($value) must be of type ?int, string given HOT 2
- Bug: Invalid date format for ORACLE database for created_at and updated_at HOT 2
- Bug: Entity::$dataCaster must not be accessed before initialization HOT 1
- How to add CI4 in a raw project and use the database class? HOT 2
- Bug: calling force_https() in 404 controller causes error HOT 8
- The lang function exposes the name of your language file if there is no record. HOT 1
- Bug: Error when run php spark cmd in testing env HOT 2
- Bug(SQLite3): Forge::dropColumn() seems to always return false 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 codeigniter4.