
Originally Posted by
arborint
I agree on the methods and I agree even more on moving on. Any last objections to these methods?
If not, what would be the next basic interface that would be useful to define?
of couse i have to object =) after some thought, it we are are doing to much with to generic an interface, the interface is supposed to be properties, but different developers have different ideas of properties. so lets break this all down
i don't care for the idea that get()/set() = __get()/__set() because you can't do $x->Property->anotherProperty and inside the class have get() access __get(), thats why __get() is magic. and in a framework like prado, __get(), __set() come in handy
depending on how you implement properties, you might not need exists() or has(), which leads to bloat.
IKeyed sounds like it is more for a hashtable, collection, dictionary, or what have you.
so we shouldn't have a properties interface.
PHP Code:
interface IKeyed {
public function setKey($key, $value);
public function getKey($key);
public function keyExists($key);
}
interface IGenericAccessors {
public function get($x); // $x could be a key, a function, a file path..etc
public function set($x, $value);
}
interface IMagicAccessors {
public function __get($property);
public function __set($property, $value);
}

Originally Posted by
jayboots
As to method return types -- there is no way to enforce such a thing in PHP so it too must remain a thing of documentation.
i whole heartedly agree. php doesn't have void and functions, it just has functions which can return mixed types. thus php interfaces do not and can not enforce a return type right now, then you would really need to implement overloading in php, then your changing the dynamic of the language.
@ahundiak, if you're looking for exceptions and and return types, then you are looking more for a framework, than an interface repository. interfaces are there to (not to point out the profound) interface.
you can have completely two different systems who do totally two different things with the data passed, but all you have to know is that this class implements this interface, so it must have this method to do whatever its got to do with the data you are passing to it.
your class doesn't have to know what it does, just that it has that certain method(s).
Bookmarks