public function run(array $args, \DomElement $element = null) { if ($this->dataKey === "root") { $data = $this->data->getData(null, 'data'); } else { $data = $this->data->getData($element, $this->dataKey); } $parser = new \Transphporm\Parser\Value($this->functionSet, true); $return = $parser->parseTokens(new \Transphporm\Parser\Tokens($args), $data); return $return[0]; }
public static function processAttr($attr, $element, $hash) { $attr = unserialize(base64_decode($attr)); $functionSet = self::$instances[$hash]->functionSet; $functionSet->setElement($element[0]); $attributes = array(); foreach ($element[0]->attributes as $attribute_name => $attribute_node) { $attributes[$attribute_name] = $attribute_node->nodeValue; } $parser = new \Transphporm\Parser\Value($functionSet, true); $return = $parser->parseTokens($attr, $attributes); return $return[0] === '' ? false : $return[0]; }
public function __call($name, $args) { try { if (!$this->functions[$name] instanceof TSSFunction\Data) { $tokens = $args[0]; $parser = new \Transphporm\Parser\Value($this); $args[0] = $parser->parseTokens($tokens, $this->elementData->getData($this->element)); } else { if ($args[0] instanceof Parser\Tokens) { $args[0] = iterator_to_array($args[0]); } } if (isset($this->functions[$name])) { return $this->functions[$name]->run($args[0], $this->element); } } catch (\Exception $e) { throw new RunException(Exception::TSS_FUNCTION, $name, $e); } return true; }
private function traverseObj($part, $obj, $valueParser, $element) { if (strpos($part, '(') !== false) { $subObjParser = new \Transphporm\Parser\Value($obj, $valueParser, false); return $subObjParser->parse($part, $element); } else { if (method_exists($obj, $part)) { return call_user_func([$obj, $part]); } else { return false; } } }