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;
    }