/** * Process data from the parsed ini file. * * @param array $data * @return array */ protected function process(array $data) { $config = array(); foreach ($data as $section => $data) { //check if section has parent section or property if (preg_match('/[\\s\\w]{1}' . self::INHERIT_KEY . '[\\s\\w]{1}/', $section)) { $section = $this->inherit($section, $config); } else { //evaluate the section and if not false move forward $evaluator = new Evaluator($section); if ($evaluator->evaluate()) { $section = $evaluator->getAlias(); $config[$section] = array(); } else { continue; //conditional section that did not meet condition } } if (is_array($data)) { //this is a INI section, build the nested tree $this->buildNestedSection($data, $config[$section]); } else { //single property, no need to do anything $config[$section] = $this->parseValue($data); } } return $config; }
/** * Processes a notification. No response is necessary. * * @param string $method * String value representing a method to invoke on the server. * * @param array $arguments * Array of arguments that will be passed to the method. */ private function processNotification($method, $arguments) { try { $this->evaluator->evaluate($method, $arguments); } catch (Exception $exception) { } }
/** * Filter datas * * @return void */ protected function applyFilter() { if (!$this->initialized) { $evaluator = new Evaluator(); foreach ($this->datas as $key => $data) { foreach ($this->clauses as $clause) { if (!$evaluator->evaluate($clause, $data)) { unset($this->datas[$key]); } } } $this->datas = array_values($this->datas); $this->initialized = true; } }
/** * @return bool */ public function isTrue() { return $this->evaluator->evaluate($this->parsedRule ?: $this->parser->parse($this->rule)); }
public function run($input) { $tokens = $this->tokeniser->parse($input); $ast = $this->parser->parse($tokens); return $this->evaluator->evaluate($ast); }