Esempio n. 1
0
 /**
  * @param $object        object
  * @param $property_name string
  * @return string
  */
 protected function parseProperty($object, $property_name)
 {
     $class_name = get_class($object);
     if (property_exists($class_name, $property_name)) {
         $getter = (new Reflection_Property($class_name, $property_name))->getAnnotation('user_getter')->value;
         if ($getter) {
             $callable = new Contextual_Callable($getter, $object);
             return $callable->call();
         }
     }
     return $this->htmlEntities(@$object->{$property_name});
 }
 /**
  * @param $value object
  * @return mixed
  */
 public function value($value = null)
 {
     if ($value !== null) {
         if ($this->final_value) {
             $this->object = $value;
         } else {
             $this->setValue($this->object, $value);
         }
     }
     if ($this->user && !$this->final_value) {
         $user_getter = $this->getAnnotation('user_getter')->value;
         if ($user_getter) {
             $callable = new Contextual_Callable($user_getter, $this->object);
             return $callable->call();
         }
     }
     return $this->final_value ? $this->object : $this->getValue($this->object);
 }