Exemplo n.º 1
0
 /**
  *
  * @param \blaze\lang\Reflectable $object
  * @todo implement a working version(recursive writeObjectOverride!)
  */
 public function writeObjectOverride(\blaze\lang\Reflectable $object)
 {
     if (!$object instanceof \blaze\io\Serializable) {
         throw new \blaze\io\NotSerializableException();
     }
     $class = $object->getClass();
     $method = $class->getMethod('writeObject');
     if ($method != null) {
         $className = $class->getName();
         $ser = 'O:' . $className->length() . ':"' . $className->toNative() . '":';
         $this->current = $object;
         $method->invoke($object, $this);
         $this->current = null;
     } else {
         $this->out->write(serialize($object));
     }
 }
Exemplo n.º 2
0
 /**
  * Whether loaded properties array contains specified property name.
  * @return boolean
  */
 public function containsKey(\blaze\lang\Reflectable $key)
 {
     return isset($this->properties[$key->toString()->toNative()]);
 }
Exemplo n.º 3
0
 public function indexOf(\blaze\lang\Reflectable $obj)
 {
     foreach ($this->data as $key => $element) {
         if ($obj->equals($element)) {
             return $key;
         }
     }
     return -1;
 }
Exemplo n.º 4
0
 public function lastIndexOf(\blaze\lang\Reflectable $obj)
 {
     for ($i = $this->size - 1; $i >= 0; $i--) {
         if ($obj->equals($this->elementData[$i])) {
             return $i;
         }
     }
     return -1;
 }