Parameter
| From: | John Comerford | Date: | Wed, 12 Mar 2008 09:22:50 +0000 |
| Subject: | Parameter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-271335@lists.php.net to get a copy of this message | ||
Hi Folks,
I am thinking of putting together a class to handle passing parameters to a class. Basically when you define a class you would define your class to extend the parameter class.
The parameter class would be JSON compliant so in the end when you call a class it you could pass the parameters as a JSON string.
(rough) eg.
myClass("label:test,title:this is text");
the parameter class would allow you to do something like:
echo myClass->get("label");
The advantages are:
- You don't have to have a declaration for every variable used within your class
- I could make the parameter class case independent (I know I need a flame suit for this but case dependency get on my nerves)
- I can wrap a lot of functionality into the parameter class, stuff like 'ifNotNull("label") .......'
So far disadvantages are:
- Eclipse etc. has code completion, which means all the parameters you pass to a function can be presented to the developer as part of "code completion"
I'd like to know:
- Have any of you guys already done something like I am talking about.
- As developers do you reckon losing code completion is worth the advantages of a parameter class
- Have I overlooked something major ?
Let me know what you think,
JC