Advertisement
fruffl

Untitled

Sep 16th, 2011
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.66 KB | None | 0 0
  1.     abstract class Object extends SystemObject implements Object_Interface
  2.     {
  3.             const           Blank                   = NULL;
  4.         final   public          function copy()             { $copy = $this->getTemp(); $copy->set($this->__buffer); return $copy; }
  5.         final   public          function duplicate()            { $copy = $this->getTemp(); $copy->set($this->__buffer)->setCopy($this->__copy); return $copy; }
  6.         final   public          function get()              { return $this->__copy; }
  7.         final   public          function restore()          { $this->setCopy($this->__buffer); return $this; }
  8.         final   public          function registerMember(Hash $hash) { $this->__usedBy[] = $hash->getHashCode()->get(); }
  9.             public          function set($value)            { try{ if(FALSE === $this->internalTypeIsModifiable()) return $this; $this->__buffer = $value; return $this->setCopy($this->__buffer); } catch(UnauthorizedAccessException $e){throw new ObjectHandlerWriteException(ObjectHandlerWriteException::ERROR_CAN_NOT_WRITE, $e);} }
  10.         final   public          function apply()            { try{ if($this->internalTypeIsModifiable()) return $this->set($this->__copy); } catch(UnauthorizedAccessException $e){throw new ObjectHandlerWriteException(ObjectHandlerWriteException::ERROR_CAN_NOT_WRITE, $e);} }
  11.             public          function __construct($value)        { parent::__construct(); $this->set($value); }
  12.             private         $__copy                 = self::Blank;
  13.             private         $__buffer               = self::Blank;
  14.             private         $__usedBy               = array();
  15.         final   protected       function getTemp()          { $c = get_class($this); return new $c($this->get()); }
  16.         final   protected       function setCopy($value)        { $this->__copy = $value; return $this; }
  17.         final   protected       function _compareTo(Object $object) { return new Boolean($this->get() === $object->get()); }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement