Directly add the methods from the decorating class. They are not modified.
The 'special' functions __construct, __prototype and __extend are not copied
as they are instead used to generate decorated methods.

@return null|MethodReflection
543916
function addDecoratorMethods() {
        $methods = $this->decoratorReflection->getMethods();

        foreach ($methods as $method) {
            $name = $method->getName();

            if ($name === '__construct' || $name === '__prototype' || $name == '__extend') {
                continue;
            }

            $methodGenerator = MethodGenerator::fromReflection($method);
            $this->generator->addMethodFromGenerator($methodGenerator);
        }
    }
19497
public function addMethod(Method $method)
    {
        if (isset($this->methods[$method->getName()])) {
            throw new RuntimeException(sprintf(
                'The method "%s" exists already.',
                $method->getName()
            ));
        }

        $this->methods[$method->getName()] = $method;

        $method->setClass($this);

        return $this;
    }
362739
public function get_callback_reflection() {
		if ( is_array( $this->callback ) ) {
			return new \ReflectionMethod( $this->callback[0], $this->callback[1] );
		} else {
			return new \ReflectionFunction( $this->callback );
		}
	}
253885
function addDecoratedMethod(MethodReflection $sourceMethod, MethodReflection $decoratorMethodReflection ) {
        $weavedMethod = MethodGenerator::fromReflection($sourceMethod);
        $newBody = $decoratorMethodReflection->getBody();

        $newBody = trimBody($newBody);

        $parameters = $sourceMethod->getParameters();

        $paramArray = [];
        $searchArray = [];

        $count = 0;
        foreach ($parameters as $parameter) {
            $searchArray[] = '$param'.$count;
            $paramArray[] = '$'.$parameter->getName();
        }

        $paramList = implode(', ', $paramArray);

        $newBody = str_replace(
            '$this->__prototype()',
            '$this->weavedInstance->'.$sourceMethod->getName()."($paramList)",
            $newBody
        );

        $newBody = str_replace($searchArray, $paramArray, $newBody);
        $weavedMethod->setBody($newBody);
        $this->generator->addMethodFromGenerator($weavedMethod);
    }
1196731
protected function setupMethods() {
		//PARAMETERS
		$parameterPrimary = new ParameterGenerator();
		$parameterPrimary->setName($this->getNames()->primary);
		
		$paramTagPrimary = new ParamTag();
		$paramTagPrimary->setTypes([$this->getNames()->properties[$this->getNames()->primary]['type']]);
		$paramTagPrimary->setVariableName($this->getNames()->primary);

		$parameterEntity = new ParameterGenerator();
		$parameterEntity->setName($this->getNames()->entityVariable);
		$parameterEntity->setType($this->getNames()->namespace_entity . '\\' . $this->getNames()->entityName);
		
		$parameterEvent = new ParameterGenerator();
		$parameterEvent->setName('events');
		$parameterEvent->setType('Zend\EventManager\EventManagerInterface');
		
		$parameterPaginator = new ParameterGenerator('paginated');
		$parameterPaginator->setDefaultValue(false);

		//===============================================

		//METHODS
		// METHOD:enableEvents
		$method = $this->buildMethod('enableEvents');
		$body = <<<MBODY
\$this->eventsEnabled = true;
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator('Enable Events');
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:disableEvents
		$method = $this->buildMethod('disableEvents');
		$body = <<<MBODY
\$this->eventsEnabled = false;
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator('Disable Events');
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:setEventManager
		$method = $this->buildMethod('setEventManager');
		$method->setParameter($parameterEvent);
		$body = <<<MBODY
\$events->setIdentifiers([
    __CLASS__,
    array_pop(explode('\\\\', __CLASS__))
]);
\$this->events = \$events;
return \$this;
MBODY;
		$method->setBody($body);
		$paramTag = new ParamTag();
		$paramTag->setTypes('\Zend\EventManager\EventManagerInterface');
		$paramTag->setVariableName('events');
		$tag = new ReturnTag();
		$tag->setTypes("{$this->getNames()->modelName}");
		$docBlock = new DocBlockGenerator();
		$docBlock->setShortDescription('Set the event manager instance used by this context');
		$docBlock->setTag($paramTag);
		$docBlock->setTag($tag);
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:getEventManager
		$method = $this->buildMethod('getEventManager');
		$body = <<<MBODY
if (null === \$this->events) {
    \$this->setEventManager(new EventManager(new SharedEventManager()));
}
return \$this->events;
MBODY;
		$method->setBody($body);
		$tag = new ReturnTag();
		$tag->setTypes('\Zend\EventManager\EventManagerInterface');
		$docBlock = new DocBlockGenerator();
		$docBlock->setShortDescription(<<<MBODY
Retrieve the event manager

Lazy-loads an EventManager instance if none registered.
MBODY
);
		$docBlock->setTag($tag);
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);
		
		//===============================================
		
		// METHOD:getPrimaryKeyField
		$method = $this->buildMethod('getPrimaryKeyField');
		$body = <<<MBODY
return \$this->primaryKeyField;
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator();
		$docBlock->setShortDescription(<<<MBODY
Get PrimaryKey Field
MBODY
				);
		$docBlock->setTag(new ReturnTag(['string']));
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:trigger
		$method = $this->buildMethod('trigger', MethodGenerator::FLAG_PRIVATE);
		$method->setParameter(new ParameterGenerator('task'));
		$method->setParameter(new ParameterGenerator('state'));
		$method->setParameter(new ParameterGenerator('data', null, []));
		$body = <<<MBODY
if (\$this->eventsEnabled) {
	\$table = \$this->table;
    \$info = compact('table', 'task', 'state', 'data');

    if (\$state == 'post') {
        \$this->getEventManager()->trigger('commit', \$this, \$info);
    }
    \$this->getEventManager()->trigger(\$task.'.'.\$state, \$this, \$info);
}
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator('Trigger an event');
		$docBlock->setTag(new ParamTag('task', 'string'));
		$docBlock->setTag(new ParamTag('state', 'string'));
		$docBlock->setTag(new ParamTag('data', 'array|object'));
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:__construct
		$method = $this->buildMethod('__construct');
		$body = <<<MBODY
\$this->table = '{$this->getNames()->tableName}';
\$this->featureSet = new Feature\FeatureSet();
\$this->featureSet->addFeature(new Feature\GlobalAdapterFeature());
\$this->featureSet->addFeature(new Feature\MetadataFeature());

\$this->resultSetPrototype = new HydratingResultSet(new Reflection(), new {$this->getNames()->entityName}());

\$this->initialize();
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator('Create DataTable Object');
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:getEntity
		$method = $this->buildMethod('getEntity');
		$body = <<<MBODY
return new \\{$this->getNames()->namespace_entity}\\{$this->getNames()->entityName}();
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator();
		$docBlock->setShortDescription(<<<MBODY
Get Empty Entity
MBODY
		);
		$docBlock->setTag(new ReturnTag(['\\'.$this->getNames()->namespace_entity."\\{$this->getNames()->entityName}"]));
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:getColumnDefaults
		$method = $this->buildMethod('getColumnDefaults');
		$body = <<<MBODY
return \$this->columnDefaults;
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator();
		$docBlock->setShortDescription(<<<MBODY
Get Column Default
MBODY
		);
		$docBlock->setTag(new ReturnTag(['Array']));
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:fetchAll
		$method = $this->buildMethod('fetchAll');
		$method->setParameter($parameterPaginator);
		$body = <<<MBODY
if (\$paginated) {
	// create a new pagination adapter object
	\$paginatorAdapter = new DbSelect(
		// our configured select object
		\$this->sql->select(),
		// the adapter to run it against
		\$this->getAdapter(),
		// the result set to hydrate
		\$this->resultSetPrototype
	);
	\$paginator = new Paginator(\$paginatorAdapter);
	return \$paginator;
}
\$resultSet = \$this->select();
return \$resultSet;
MBODY;
		$method->setBody($body);
		$tag = new ReturnTag();
		$tag->setTypes("\\Zend\\Db\\ResultSet\\HydratingResultSet");
		$docBlock = new DocBlockGenerator('Fetch all entities');
		$docBlock->setTag(new ParamTag('paginated', ['boolean'], 'True: use paginator'));
		$docBlock->setTag($tag);
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:selectUsing
		$method = $this->buildMethod('selectUsing');
		$method->setParameter(new ParameterGenerator('order', null, false));
		$method->setParameter(new ParameterGenerator('where', null, false));
		$method->setParameter(new ParameterGenerator('limit', null, false));
		$body = <<<MBODY
\$select = new Select(\$this->table);
if (\$order) \$select->order(\$order);
if (\$where) \$select->where(\$where);
if (\$limit) \$select->limit(\$limit);

return \$this->selectWith(\$select);
MBODY;
		$method->setBody($body);
		$tag = new ReturnTag();
		$tag->setTypes("\\Zend\\Db\\ResultSet\\HydratingResultSet");
		$docBlock = new DocBlockGenerator('Select Using Where/Order');
		$docBlock->setTag(new ParamTag('order', ['string', 'array'], 'Sort Order'));
		$docBlock->setTag(new ParamTag('where', ['string', 'array', '\Closure', 'Where'], 'Where'));
		$docBlock->setTag(new ParamTag('limit', ['int'], 'Limit'));
		$docBlock->setTag($tag);
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:get
		$method = $this->buildMethod("get{$this->getNames()->entityName}");
		$method->setParameter($parameterPrimary);
		$body = <<<MBODY
\$rowset = \$this->select([\$this->getPrimaryKeyField() => \${$this->getNames()->primary}]);
\$row = \$rowset->current();
return \$row;
MBODY;
		$method->setBody($body);
		$tag = new ReturnTag();
		$tag->setTypes("\\{$this->getNames()->namespace_entity}\\{$this->getNames()->entityName}");
		$docBlock = new DocBlockGenerator('Get by primaryId');
		$docBlock->setTag($paramTagPrimary);
		$docBlock->setTag($tag);
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:save
		$method = $this->buildMethod("save{$this->getNames()->entityName}");
		$method->setParameter($parameterEntity);

		$body = <<<MBODY
\$data = \${$this->getNames()->entityVariable}->getArrayCopy(true);
\${$this->getNames()->primary} = \${$this->getNames()->entityVariable}->{$this->getNames()->primary};
\$row = \$this->get{$this->getNames()->entityName}(\${$this->getNames()->primary});
if (\$row) {
	\$data = array_diff_assoc(\$data, \$row->getArrayCopy());
	if (count(\$data) > 0) {
		\$this->trigger('update', 'pre', \${$this->getNames()->primary});
		\$this->update(\$data, [\$this->getPrimaryKeyField() => \${$this->getNames()->primary}]);
		\$this->trigger('update', 'post', \${$this->getNames()->primary});
	}
} else {
	if ((\$this->isSequence && !\${$this->getNames()->primary}) || (!\$this->isSequence && \${$this->getNames()->primary})) {
		\$data['{$this->getNames()->primary}'] = \${$this->getNames()->primary};
		\$this->trigger('insert', 'pre', \$data);
		\$this->insert(array_filter(\$data));
		if (\$this->isSequence) {
			\${$this->getNames()->entityVariable}->{$this->getNames()->primary} = \$this->lastInsertValue;
		}
		\$this->trigger('insert', 'post', \${$this->getNames()->entityVariable}->{$this->getNames()->primary});
	} else {
		throw new \Exception('{$this->getNames()->entityName} {$this->getNames()->primary} error with insert/update');
	}
}
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator('Save entity to database');
		$docBlock->setTag(new ParamTag($this->getNames()->entityVariable, $this->getNames()->entityName));
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);

		//===============================================

		// METHOD:delete
		$method = $this->buildMethod("delete{$this->getNames()->entityName}");
		$method->setParameter($parameterPrimary);
		$body = <<<MBODY
\$this->trigger('delete', 'pre', \${$this->getNames()->primary});
\$this->delete([\$this->getPrimaryKeyField() => \${$this->getNames()->primary}]);
\$this->trigger('delete', 'post', \${$this->getNames()->primary});
MBODY;
		$method->setBody($body);
		$docBlock = new DocBlockGenerator('Delete entity');
		$docBlock->setTag(new ParamTag($this->getNames()->primary));
		$method->setDocBlock($docBlock);
		$this->_class->addMethodFromGenerator($method);
	}
1095156
function add(name, methods) {

  // Create a container class that extends Document for our methods.
  class ConcreteDocument extends Document {
    constructor(document, root) {
      super(name, document, root);
    }
  }

  // Assign the methods to the new classes prototype.
  assignIn(ConcreteDocument.prototype, methods);

  // Add a factory method for the new type.
  Document.factory[name] = (document, root) => new ConcreteDocument(document, root);
}
926720
public static function methods()
    {
        if (!is_array(self::$methods)) {
            self::$methods = [];
            $interfaces = class_implements('Toplan\\PhpSms\\ParasiticAgent');
            foreach ($interfaces as $interface) {
                self::$methods = array_merge(self::$methods, get_class_methods($interface));
            }
        }

        return self::$methods;
    }
977822
function addPlainMethod(MethodReflection $sourceMethod) {

        $parameters = $sourceMethod->getParameters();
        $paramArray = [];
        foreach ($parameters as $parameter) {
            $paramArray[] = '$'.$parameter->getName();
        }

        $paramList = implode(', ', $paramArray);

        $weavedMethod = MethodGenerator::fromReflection($sourceMethod);

        $body = sprintf(
            " return \$this->%s->%s(%s);",
            $this->implementWeaveInfo->getInstancePropertyName(),
            $sourceMethod->getName(),
            $paramList
        );
        
        $weavedMethod->setBody($body);
        $this->generator->addMethodFromGenerator($weavedMethod);
    }
933777
public function getMethods()
    {
        if (!$this->__methods) {
            $methods = array();

            $reflection = new ReflectionClass($this);
            foreach ($reflection->getMethods() as $method) {
                $methods[] = $method->name;
            }

            $this->__methods = array_merge($methods, array_keys($this->_mixed_methods));
        }

        return $this->__methods;
    }
611282
protected function addMagicMethods()
    {
        foreach ($this->magicMethods as $magic => $real) {
            list($className, $name) = explode('::', $real);
            if (!class_exists($className) && !interface_exists($className)) {
                continue;
            }
            $method = new \ReflectionMethod($className, $name);
            $class = new \ReflectionClass($className);

            if (!in_array($magic, $this->usedMethods)) {
                if ($class !== $this->root) {
                    $this->methods[] = new Method($method, $this->alias, $class, $magic, $this->interfaces);
                }
                $this->usedMethods[] = $magic;
            }
        }
    }
1122995
private function functionA() {
		if (!isset($this->{__METHOD__})) {
			$this->{__METHOD__} = df_n_set(
				$this->method() ?: (
					$this->functionName() && !$this->isClosure()
					? new RF($this->functionName())
					: null
				)
			);
		}
		return df_n_get($this->{__METHOD__});
	}
1139046
public function AddMethod(\Peg\Lib\Definitions\Element\FunctionElement $method)
    {
        $method->parent_class =& $this;
        $this->methods[$method->name] = $method;
        
        return $this;
    }
791925
public function createAbstractMethodStubs() {
    if ($this->isAbstract() || $this->isInterface()) return $this;
    
    foreach ($this->getAllMethods(self::FULL_HIERARCHY & ~self::WITH_OWN) as $method) {
      //if ($this->needsImplementation($method)) {
      $this->createMethodStub($method);
      //} // performance: this will be already checked in createMethodStub 
    }
    
    return $this;
  }
725297
protected function resolveMethods()
    {
        $methods = $this->reflectionClass->getMethods();
        if ($this->isFacade()) {
            $methods = array_merge($methods, $this->getFacadeReflectionClass()->getMethods());
        }
        foreach ($methods as $method) {
            $this->methods[] = new MethodSymbol($this, $method);
        }
    }
285990
def decorate_method(wrapped):
    
    def wrapper(self):
        lines = Lines()
        if hasattr(self.model, wrapped.__name__):
            print('            . %s' % wrapped.__name__)
            lines.add(1, method_header(wrapped.__name__, nogil=True))
            for line in wrapped(self):
                lines.add(2, line)
        return lines
    functools.update_wrapper(wrapper, wrapped)
    wrapper.__doc__ = 'Lines of model method %s.' % wrapped.__name__
    return property(wrapper)
650912
private function generateMethods(): void
    {
        $this->printer->writeln('Generating methods.');
        $this->generator->setChildNamespace('Method');

        /** @var Method $method */
        foreach ($this->wsdl->getMethods() as $name => $method) {
            $this->printer->writeln(" |\-Generating method $name");
            $code = $method->visit($this->generator);
            $className = $this->findClassName($code);
            $filename = $this->destination . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';

            $this->writer->writeFile($filename, $code);
            $this->printer->writeln("  |- Wrote $className to $filename");
        }
    }
919313
public function getMethods()
    {
        if (count($this->methods) > 0) {
            return $this->methods;
        }

        $this->addMagicMethods();
        $this->detectMethods();
        return $this->methods;
    }