forked from fossology/fossology
-
Notifications
You must be signed in to change notification settings - Fork 0
PHP Object Baseclass
Michael edited this page Aug 19, 2015
·
1 revision
The object baseclass allows to have more readable classname access which is indifferent of name changes.
Any place where a class name is required one can use the method instead of String constant:
without object baseclass:
...
usort($data, '\Fossology\Lib\Foo', 'dataSorter'));
...
with object baseclass:
...
usort($data, array($this->classname(), 'dataSorter'));
...
If method known from other languages / newer php versions like equals() or hashcode() are required the can be implemented in the object baseclass as well.
Just extend the object baseclass from your class:
use Fossology\Lib\Util\Object;
class Foo extends Object {
}