示例#1
0
 /**
  * fromReflection()
  *
  * @param Zend_Reflection_Parameter $reflectionParameter
  * @return Zend_CodeGenerator_Php_Parameter
  */
 public static function fromReflection(Zend_Reflection_Parameter $reflectionParameter)
 {
     $param = new Zend_CodeGenerator_Php_Parameter();
     $param->setName($reflectionParameter->getName());
     if ($reflectionParameter->isArray()) {
         $param->setType('array');
     } else {
         $typeClass = $reflectionParameter->getClass();
         if ($typeClass !== null) {
             $param->setType($typeClass->getName());
         }
     }
     $param->setPosition($reflectionParameter->getPosition());
     if ($reflectionParameter->isOptional()) {
         $param->setDefaultValue($reflectionParameter->getDefaultValue());
     }
     $param->setPassedByReference($reflectionParameter->isPassedByReference());
     return $param;
 }
示例#2
0
 /**
  * Create a CodeGenerator parameter
  *
  * @param	string				$name
  * @param	null|string			$type
  * @param	null|bool			$reference
  *
  * @return	Zend_CodeGenerator_Php_Parameter
  */
 public static function createParam($name, $type = null, $reference = null)
 {
     $param = new Zend_CodeGenerator_Php_Parameter();
     $param->setName($name);
     if (!empty($type)) {
         $param->setType($type);
     }
     if ($reference === true) {
         $param->setPassedByReference(true);
     }
     return $param;
 }