Comments (9)
Someone else brought this up before too. :)
That's actually what it's currently using in CI3, and matches the naming scheme of the other methods. The unset
method of a class doesn't class with a standalone function name.
from codeigniter4.
Hmmm. The latest NetBeans, with PHP7 support, flags that as an error.
If it isn't used anywhere, do we need it?
from codeigniter4.
Um... it's how the users unset data from the session that they've set. So, the framework doesn't use it, but the users do. :)
from codeigniter4.
We could be compliant with the PHP reserved name list if we changed the "unset" method name.
For instance, java.util.Map (comparable container) uses get/put/remove where we use get/set/unset.
What do you think of having get, set & put, and remove? "put" would be alias for set.
from codeigniter4.
Another thing I notice is that we have set, setTempdata and setFlashdata. The latter two can take a key & value, OR an associative array with keys & related values implied. This feels like the PHP equivalent of an overloaded method in Java.
It looks like the same is expected of "set", though that isn't spelled out in the docs ... will fix :)
from codeigniter4.
While I don't 100% think it's necessary to change them, it's not a bad idea. I mean, it has worked throughout all of CI 2 and 3 that way so there's no technical reason to - at the moment. But, quoting from the PHP reserved keywords page:
You cannot use any of the following words as constants, class names, function or method names.
So it's probably best to rename them now just in case the interpreter decides to enforce that at some point.
I'm fine with get
, set
, and remove
, but think that aliasing in put
is unnecessary and confusing. And set is used throughout the framework and I really don't feel like changing everything. :) We will have to keep an eye out for other places where we have methods with similar roles (cache layer will have this, and probably others) so that we can keep a consistent naming scheme.
from codeigniter4.
Another thing I notice is that we have set, setTempdata and setFlashdata. The latter two can take a key & value, OR an associative array with keys & related values implied. This feels like the PHP equivalent of an overloaded method in Java.
You are correct. And it's always been used in the query builder that way too. I don't generally have a problem with it in these cases.
from codeigniter4.
Ok - will prep a PR for unset->remove, and update the API docs for these.
from codeigniter4.
I think this can be closed - methods have been renamed & API docs updated.
The user guide still needs work, but that is a separate issue.
from codeigniter4.
Related Issues (20)
- Bug: spark routes doesn't work with `(.+)` HOT 2
- Bug: nested $routes->group() with same filter name doesn't work as exepcted HOT 14
- Bug: system/Database/OCI8/Connection.php fails to parse valid DSN HOT 10
- Bug: When Install fresh codeigniter 4 Project I am getting "does not comply with psr-4 autoloading standard" HOT 1
- Bug(OCI8): $validDSNs regex for Oracle service names should support periods HOT 1
- Bug: [QueryBuilder] select() TypeError: trim(): Argument #1 ($string) must be of type string, CodeIgniter\Database\RawSql given HOT 4
- Validation `valid_date` does not work with time HOT 2
- Bug: Auto Routing (Legacy) does not behave like legacy anymore. HOT 9
- Bug: validation level dont work as expected HOT 6
- Bug: Class 'file' not found in SYSTEMPATH\Config\Services.php on line 686. HOT 5
- Bug: `spark phpini:check` TypeError HOT 4
- Bug: ENVIRONMENT is not updated when changed via .ENV ( 4.5.3) HOT 5
- [Feat] Routing: Support to PHP Attributes HOT 4
- Bug: routes not work in ci 4.3.5 HOT 2
- Bug: debug bar content not show with daisyUI ver 4.12.10 HOT 4
- Bug: TypeError in pg_ping() HOT 7
- Add to $filters except urls like in globals HOT 1
- Bug: Module/Config/Registrar.php cause infinite loop in codeigniter4\framework\system\Autoloader\FileLocator.php on line 226
- Bug: Boot Order HOT 3
- Bug: Routing groups and in-group routes use filters that are only effective within the group. 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.