Well the class hierachy is a bit complex, but anyway I will give a try:
Interface: Objective
<?php
namespace Resource\\Native;
/**
* The Objective Interface, it is the interface that all Mysidia classes should implement minus a few special cases.
* It defines a standard interface for Mysidia Objects, the root class Object also implements this interface.
* This interface is very useful for classes that extend from PHP's built-in classes, as they cannot extend from root Object Class.
* By Implementing Objective interface, objects of the specific class can be used in Collections Framework.
* @category Resource
* @package Native
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.3
* @todo Not much at this point.
*
*/
interface Objective{
/**
* The equals method, checks whether target object is equivalent to this one.
* @param Objective $object
* @access public
* @return Boolean
*/
public function equals(Objective $object);
/**
* The getClassName method, returns class name of an instance.
* The return value may differ depending on child classes.
* @access public
* @return String
*/
public function getClassName();
/**
* Magic method __clone() for Object Class, returns a copy of Object with additional operations.
* @access public
* @return Object
*/
public function __clone();
/**
* Magic method to_String() for Object class, returns object information.
* @access public
* @return String
*/
public function __toString();
}
?>
Abstract Class: Object
<?php
namespace Resource\\Native;
/**
* The Abstract Object Class, root of all Mysidia library files.
* Contrary to Java's Object root class, this one is abstract.
* For this reason, one cannot instantiate an object of this class.
* @category Resource
* @package Native
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.2
* @todo Not much at this point.
* @abstract
*
*/
abstract class Object implements Objective{
/**
* Constructor of Object Class, which simply serves as a marker for child classes.
* @access public
* @return Void
*/
public function __construct(){
}
/**
* Destructor of Object Class, which simply serves as a marker for child classes.
* @access public
* @return Void
*/
public function __destruct(){
}
/**
* Magic method __clone() for Object Class, returns a copy of Object with additional operations.
* @access public
* @return Object
*/
public function __clone(){
}
/**
* The getClassName method, returns class name of an instance.
* It is alias to getClass method, its existence is for backward compatibility.
* @access public
* @return String
*/
public function getClassName(){
return $this->getClass();
}
/**
* The equals method, checks whether target object is equivalent to this one.
* @param Objective $object
* @access public
* @return Boolean
*/
public function equals(Objective $object){
return ($this == $object);
}
/**
* The hashCode method, returns the hash code for the very Object.
* @access public
* @return Int
*/
public function hashCode(){
return hexdec(spl_object_hash($this));
}
/**
* The hasMethod method, examines if the object has a certain method.
* @param String $method
* @access public
* @return Boolean
*/
public function hasMethod($method){
return method_exists($this, $method);
}
/**
* The hasProperty method, finds if the object contains a certain property.
* @param String $property
* @access public
* @return Boolean
*/
public function hasProperty($property){
return property_exists($this, $property);
}
/**
* The serialize method, serializes an object into string format.
* A serialized string can be stored in Constants, Database and Sessions.
* @access public
* @return String
*/
public function serialize(){
return serialize($this);
}
/**
* The unserialize method, decode a string to its object representation.
* This method can be used to retrieve object info from Constants, Database and Sessions.
* @param String $string
* @access public
* @return String
*/
public function unserialize($string){
return unserialize($string);
}
/**
* Magic method __toString() for Object class, returns object information.
* @access public
* @return String
*/
public function __toString(){
return get_class($this);
}
}
?>
Concrete Class: Boolean(just an example, the real subclasses are way too long for posting here)
<?php
namespace Resource\\Native;
use Exception;
/**
* The Boolean Class, extending the root Object class.
* This class serves as a wrapper class for primitive data type boolean.
* It is a final class, no child class shall derive from Boolean.
* @category Resource
* @package Native
* @author Hall of Famer
* @copyright Mysidia Adoptables Script
* @link http://www.mysidiaadoptables.com
* @since 1.3.2
* @todo Not much at this point.
* @final
*
*/
final class Boolean extends Object{
/**
* Size constant, specifies the size a boolean value occupies.
*/
const Size = 8;
/**
* BooleanTrue constant, defines the True value for Boolean.
*/
const BooleanTRUE = TRUE;
/**
* BooleanFALSE constant, defines the False value for Boolean.
*/
const BooleanFALSE = FALSE;
/**
* The value property, which stores the primitive value for this Boolean object.
* @access private
* @var Boolean
*/
private $value;
/**
* Constructor of Boolean Class, initializes the Boolean wrapper class.
* If supplied argument is not of boolean type, type casting will be converted.
* @param Any $param
* @access public
* @return Void
*/
public function __construct($param){
if(!is_bool($param)) $param = (boolean)$param;
$this->value = $param;
}
/**
* The getValue method, returns the primitive boolean value.
* @access public
* @return Boolean
*/
public function getValue(){
return $this->value;
}
/**
* The compareTo method, compares a boolean object to another.
* @param Objective $target
* @access public
* @return Int
*/
public function compareTo(Objective $target){
if(!($target instanceof Boolean)) throw new Exception("Supplied argument must be a boolean value!");
return ($this->equals($target))?0:($this->value ? 1 : -1);
}
/**
* Magic method to_String() for Boolean class, casts boolean value into string.
* @access public
* @return String
*/
public function __toString(){
return (string)$this->value;
}
/**
* Magic method __invoke() for Boolean class, it returns the primitive data value for manipulation.
* @access public
* @return Number
*/
public function __invoke(){
return $this->value;
}
}
?>