Esempio n. 1
0
 public function __construct($file, $mime, $code)
 {
     if (file_exists($file)) {
         parent::__construct($mime, $code);
         $this->file = $file;
     } else {
         throw new \Exception("No such file '" . $file . "'");
     }
 }
Esempio n. 2
0
 public static function parse(\DOMNode $node)
 {
     if ($node->nodeName == self::getNodeName()) {
         $actions = new ActionList();
         foreach (XMLUtils::getChildrenByName($node, AbstractAction::getNodeName()) as $action) {
             $actions->add(AbstractAction::parse($action));
         }
         return new Target(XMLUtils::getAttributeByName($node, "name")->nodeValue, Uri::fromString(XMLUtils::getChildByName($node, "uri")->nodeValue), $actions, AbstractView::parse(XMLUtils::getChildByName($node, AbstractView::getNodeName())));
     }
     throw new \Exception("Unexpected node '" . $node->nodeName . "', expected '" . self::getNodeName() . "'");
 }