Exemple #1
0
 /**
  * @param ViewElement $viewElement
  */
 public function evaluate(ViewElementTag $viewElement)
 {
     if ($this->function === null) {
         //Instantiate the Function handler:
         /** @var FunctionFactory[] $factories */
         $factories = $viewElement->getView()->getFunctionFactories();
         if (null != $factories && is_array($factories)) {
             foreach ($factories as $factory) {
                 if (null !== ($this->function = $factory->lookup($this->name))) {
                     break;
                 }
             }
         }
         if ($this->function == null) {
             $logger = LoggerFactory::getLogger(__CLASS__);
             $message = 'Undeclared function: ' . $this->name;
             $logger->error($message);
             throw new FunctionNotFoundException($this->name);
         }
     }
     $arguments = array();
     if ($this->operands) {
         foreach ($this->operands as $operandToken) {
             $arguments[] = $operandToken->evaluate($viewElement);
         }
     }
     return $this->function->evaluate($viewElement, $this->arity, $arguments);
 }
Exemple #2
0
 /**
  * Representação textual da coluna.
  *
  * @return string
  * */
 public function render()
 {
     if ($this->_entity instanceof Entity) {
         $column = $this->_name;
         $columns = $this->_entity->columns();
         if (FALSE == isset($columns->{$column}->database)) {
             return FALSE;
         }
         $this->_name = $columns->{$column}->database;
     }
     if ($this->_functions) {
         return $this->_functions->render();
     }
     return parent::render();
 }