src/Weaver/ImplementWeaveGenerator.php
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);
    }
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);
    }
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 ) ; }
Decorate the method and call the instance.
@param MethodReflection $sourceMethod
@param MethodReflection $decoratorMethodReflection
Decorate the method and call the instance .