示例#1
0
 /**
  * Presents as xml
  * @param string|null $node default null
  * @return \SimpleXMLElement
  */
 public function asXml($node = null)
 {
     $object = System::getObject($this);
     $properties = $object->getProperties();
     $xml = '';
     foreach ($properties as $property) {
         $value = $property->getValue($this);
         if (is_object($value)) {
             $stdObject = new self($value);
             $value = $stdObject->asXml();
         }
         $xml .= '<' . $property->getName() . '>' . $value . '</' . $property->getName() . '>';
     }
     !is_null($node) ?: ($node = $object->getShortName());
     return new \SimpleXMLElement('<' . $node . '>' . $xml . '</' . $node . '>');
 }
示例#2
0
 /**
  * Adds callback
  * @param callable $callback
  * @throws \Copycat\System\Exception
  */
 public function add($callback)
 {
     System::checkCallable($callback);
     $this->_list->append($callback);
 }
示例#3
0
 /**
  * Generates
  * @param mixed $value
  * @return string
  */
 private function generateHash($value)
 {
     return System::getObjectHash($value);
 }