/** * setMethod() * * @param array|Zend_CodeGenerator_Php_Method $method * @return Zend_CodeGenerator_Php_Class */ public function setMethod($method) { if (is_array($method)) { $method = new Zend_CodeGenerator_Php_Method($method); $methodName = $method->getName(); } elseif ($method instanceof Zend_CodeGenerator_Php_Method) { $methodName = $method->getName(); } else { require_once 'Zend/CodeGenerator/Php/Exception.php'; throw new Zend_CodeGenerator_Php_Exception('setMethod() expects either an array of method options or an instance of Zend_CodeGenerator_Php_Method'); } if (isset($this->_methods[$methodName])) { require_once 'Zend/CodeGenerator/Php/Exception.php'; throw new Zend_CodeGenerator_Php_Exception('A method by name ' . $methodName . ' already exists in this class.'); } $this->_methods[$methodName] = $method; return $this; }