public function addMethod($name, $overrideOnDefined = false)
    {
        if ($this->methods->offsetExists($name) === true) {
            if ($overrideOnDefined === false) {
                throw Exception\ClassFile::methodAlreadyDefined($this->className, $name);
            }

            $this->methods->offsetUnset($name);
        }

        if (PHPUtils::isReservedAny($name) === true) {
            throw Exception\ClassFile::invalidMethodName($this->className, $name);
        }

        $method = new Element\Method($this, $name);
        $this->methods->offsetSet($name, $method);

        return $method;
    }
public function addMethod($name, $overrideOnDefined = false)
    {
        if ($this->methods->offsetExists($name) === true) {
            if ($overrideOnDefined === false) {
                throw Exception\ClassFile::methodAlreadyDefined($this->className, $name);
            }

            $this->methods->offsetUnset($name);
        }

        if (PHPUtils::isReservedAny($name) === true) {
            throw Exception\ClassFile::invalidMethodName($this->className, $name);
        }

        $method = new Element\Method($this, $name);
        $this->methods->offsetSet($name, $method);

        return $method;
    }
public function addMethod ( $ name , $ overrideOnDefined = false ) { if ( $ this -> methods -> offsetExists ( $ name ) === true ) { if ( $ overrideOnDefined === false ) { throw Exception \ ClassFile :: methodAlreadyDefined ( $ this -> className , $ name ) ; } $ this -> methods -> offsetUnset ( $ name ) ; } if ( PHPUtils :: isReservedAny ( $ name ) === true ) { throw Exception \ ClassFile :: invalidMethodName ( $ this -> className , $ name ) ; } $ method = new Element \ Method ( $ this , $ name ) ; $ this -> methods -> offsetSet ( $ name , $ method ) ; return $ method ; }
Create a new class method

@param string $name
@param bool   $overrideOnDefined

@return Element\Method
@throws Exception\ClassFile      When the method is already defined and $overrideOnDefined = false
Create a new class method