/** * 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 . '>'); }
/** * Adds callback * @param callable $callback * @throws \Copycat\System\Exception */ public function add($callback) { System::checkCallable($callback); $this->_list->append($callback); }
/** * Generates * @param mixed $value * @return string */ private function generateHash($value) { return System::getObjectHash($value); }