public function getContent() { if (empty($this->parsedContent)) { $this->parsedContent = $this->parser->parse($this->content); } return $this->parsedContent; }
/** * @inheritdoc */ public function getAnnotations(\Reflector $reflector) { $this->parser->setReflector($reflector); $annotations = $this->parser->parse(); $annotation = new Annotation($annotations); return $annotation; }
/** * @inheritdoc */ public function parse($definition) { if (is_array($definition)) { return array_map(array($this, 'parse'), $definition); } return $this->parser->parse($definition); }
/** * Parse a given file for defintions of classes, traits and interfaces * * @param SourceFile $source file to process * * @return ParseResult */ public function parse(SourceFile $source) { if ($this->cache->hasResult($source)) { return $this->cache->getResult($source); } $result = $this->parser->parse($source); $this->cache->addResult($source, $result); return $result; }
/** * @return mixed */ public function start() { // Input echo 'Formel: '; $formula = trim(fgets(STDIN)); // Processing $formulaObj = $this->parser->parse($formula); $result = $this->calculator->calculate($formulaObj); // Output echo 'Ergebnis: '; echo $result; echo "\n"; }
function createOperand($value, $operator = null) { $operand = array(); switch ($operator) { case '+': $operand['operator'] = 'add'; break; case '-': $operand['operator'] = 'subtract'; break; case '*': $operand['operator'] = 'multiply'; break; case '/': $operand['operator'] = 'divide'; break; } $value = trim($value); if ($value != '') { if ($value[0] == '(' && substr($value, -1, 1) == ')') { $value = substr($value, 1, -1); $value = trim($value); } } if ($value == '') { throw new ParserException($value); } $operand['value'] = $this->operandParser->parse($value); return $operand; }
/** * Get option value based on its definition * * @param \Yeriomin\Getopt\OptionDefinition $definition * @return mixed * @throws GetoptException */ private function getOptionValue(OptionDefinition $definition) { $nameShort = $definition->getShort(); $nameLong = $definition->getLong(); $valueShort = $this->parser->getOptionShort($nameShort); $valueLong = $this->parser->getOptionLong($nameLong); if ($nameShort !== null && $nameLong !== null && $valueShort !== null && $valueLong !== null && $valueShort !== $valueLong) { throw new GetoptException('Both -' . $nameShort . ' and --' . $nameLong . ' given, with non-matching values. Make up your mind.'); } return $valueShort !== null ? $valueShort : $valueLong; }
function parse($expression) { $expression = trim($expression); if (!preg_match('/^(\\w)+\\(/', $expression)) { throw new ParserException($expression); } if (substr($expression, -1, 1) != ')') { throw new ParserException($expression); } $open = strpos($expression, '('); $results = array('type' => 'function', 'name' => substr($expression, 0, $open)); $arguments = trim(substr($expression, $open + 1, -1)); if ($arguments != '') { $parsedArguments = array(); foreach ($this->explodeArguments($arguments) as $argument) { $parsedArguments[] = $this->argumentParser->parse($argument); } $results['arguments'] = $parsedArguments; } return $results; }
/** * Adds a new parser to be used * * @param ParserInterface $parser */ public function add(ParserInterface $parser) { foreach ($parser->supports() as $support) { $this->parsers[$support] = $parser; } }
public function setNextHook(ParserInterface $nextHook) { $this->nextHook = $nextHook; $nextHook->initHook($this); return $nextHook; }
/** * @return \Payu\Response\ResponseAbstract */ public function parse() { return $this->parser->parse($this->rawResponse); }
/** * @param string $resource * @param array $requirements * * @return string */ private function getResourceCollectionUrl($resource, array $parameters, array $requirements = []) { $resource = $this->parser->parse($resource, $requirements); return $this->appendQueryString($this->baseUrl . '/' . $resource, $parameters); }
/** * Builds the requested page content and returns the html in a string. * * @param string $uri * * @return string */ public function buildPageContent($uri) { $content = $this->loadFileContent($uri); return $this->parser->render($content); }
/** * Parse the inbound request. * * @return ParserInterface */ public function parse() { return $this->parser->parse(); }