This is a discussion on Parameter within the PHP General forums, part of the PHP Programming Forums category; Hi Folks, I am thinking of putting together a class to handle passing parameters to a class. Basically when you ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |