Beispiel #1
0
 /**
  *  returns a dependency map if the method is a valid dependency inject method
  *  
  *  @since  9-7-11   
  *  @param  ReflectionMethod  $method  the reflection of the method/function
  *  @param  object|null $instance the object instance, or null if it hasn't been created yet             
  *  @return array
  */
 protected function getParamDependencyMap(\ReflectionProperty $rparam, $instance = null)
 {
     $val = empty($instance) ? $rparam->getValue() : $rparam->getValue($instance);
     $docblock = $rparam->getDocComment();
     // canary
     if ($val !== null) {
         return array();
     }
     //if
     if (empty($docblock)) {
         return array();
     }
     //if
     $ret_map = array();
     $param_name = $rparam->getName();
     $class_name = '';
     $annotation = new ParamAnnotation($rparam);
     $class_name = $annotation->getClassName();
     if (!empty($class_name)) {
         // fix namespace...
         if ($class_name[0] !== '\\') {
             $rclass = $rparam->getDeclaringClass();
             $class_name = sprintf('%s\\%s', $rclass->getNamespaceName(), $class_name);
         }
         //if
         $ret_map['name'] = $param_name;
         $ret_map['optional'] = false;
         $ret_map['method'] = false;
         $ret_map['static'] = $rparam->isStatic();
         $ret_map['class_name'] = $class_name;
     }
     //if
     return $ret_map;
 }
Beispiel #2
0
 /**
  *  @param  \ReflectionProperty $reflection a property of $form
  *  @param  \Montage\Form\Form  $form the form of the property      
  */
 public function __construct(\ReflectionProperty $reflection, Form $form)
 {
     parent::__construct($reflection);
     $this->form = $form;
 }