Ejemplo n.º 1
0
 public function setMethod($method)
 {
     if (is_array($method)) {
         $method = new ZendL_Tool_CodeGenerator_Php_Method($method);
         $methodName = $method->getName();
     } elseif ($method instanceof ZendL_Tool_CodeGenerator_Php_Method) {
         $methodName = $method->getName();
     } else {
         require_once 'ZendL/Tool/CodeGenerator/Php/Exception.php';
         throw new ZendL_Tool_CodeGenerator_Php_Exception('setMethod() expects either an array of method options or an instance of ZendL_Tool_CodeGenerator_Php_Method');
     }
     if (isset($this->_methods[$methodName])) {
         require_once 'ZendL/Tool/CodeGenerator/Php/Exception.php';
         throw new ZendL_Tool_CodeGenerator_Php_Exception('A method by name ' . $methodName . ' already exists in this class.');
     }
     $this->_methods->append($method);
     return $this;
 }
Ejemplo n.º 2
0
 public function testParameterAccessors()
 {
     $codeGen = new ZendL_Tool_CodeGenerator_Php_Method();
     $codeGen->setParameters(array('one'));
 }