/** * @inheritdoc */ public function getAnnotations(\Reflector $reflector) { $this->parser->setReflector($reflector); $annotations = $this->parser->parse(); $annotation = new Annotation($annotations); return $annotation; }
public function getContent() { if (empty($this->parsedContent)) { $this->parsedContent = $this->parser->parse($this->content); } return $this->parsedContent; }
/** * @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"; }
/** * Parse the console arguments using the provided parser * and check them for validity * * @throws GetoptException */ public function parse() { $this->parser->parse($this->rawArguments); $this->parsed = true; $this->arguments = $this->parser->getArguments(); $optionsShort = $this->parser->getOptionsShort(); $optionsLong = $this->parser->getOptionsLong(); $missongRequired = array(); foreach ($this->optionDefinitions as $definition) { $value = $this->getOptionValue($definition); $short = $definition->getShort(); $long = $definition->getLong(); $optionsShort[$short] = $value; $optionsLong[$long] = $value; if ($definition->getRequired() && $value === null) { $parts = array(); $parts[] = $short !== null ? '-' . $short : null; $parts[] = $long !== null ? '--' . $long : null; $missongRequired[] = implode('|', $parts); } } if (!empty($missongRequired)) { throw new GetoptException('Missing required options: ' . implode(', ', $missongRequired)); } $this->optionsShort = $optionsShort; $this->optionsLong = $optionsLong; }
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; }
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; }
/** * @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); }
/** * Parse the inbound request. * * @return ParserInterface */ public function parse() { return $this->parser->parse(); }