protected function getJoinpointInvocationBody(ReflectionMethod $method): string
    {
        $isStatic = $method->isStatic();
        $class    = '\\' . __CLASS__;
        $scope    = $isStatic ? 'static::class' : '$this';
        $prefix   = $isStatic ? AspectContainer::STATIC_METHOD_PREFIX : AspectContainer::METHOD_PREFIX;

        $argumentList = new FunctionCallArgumentListGenerator($method);
        $argumentCode = $argumentList->generate();
        $argumentCode = $scope . ($argumentCode ? ", $argumentCode" : '');

        $return = 'return ';
        if ($method->hasReturnType()) {
            $returnType = (string) $method->getReturnType();
            if ($returnType === 'void') {
                // void return types should not return anything
                $return = '';
            }
        }

        $advicesArray = new ValueGenerator($this->advices[$prefix][$method->name], ValueGenerator::TYPE_ARRAY_SHORT);
        $advicesArray->setArrayDepth(1);
        $advicesCode = $advicesArray->generate();

        return <<<BODY
static \$__joinPoint;
if (\$__joinPoint === null) {
    \$__joinPoint = {$class}::getJoinPoint(__CLASS__, '{$prefix}', '{$method->name}', {$advicesCode});
}
{$return}\$__joinPoint->__invoke($argumentCode);
BODY;
    }
protected function getJoinpointInvocationBody(ReflectionMethod $method): string
    {
        $isStatic = $method->isStatic();
        $class    = '\\' . __CLASS__;
        $scope    = $isStatic ? 'static::class' : '$this';
        $prefix   = $isStatic ? AspectContainer::STATIC_METHOD_PREFIX : AspectContainer::METHOD_PREFIX;

        $argumentList = new FunctionCallArgumentListGenerator($method);
        $argumentCode = $argumentList->generate();
        $argumentCode = $scope . ($argumentCode ? ", $argumentCode" : '');

        $return = 'return ';
        if ($method->hasReturnType()) {
            $returnType = (string) $method->getReturnType();
            if ($returnType === 'void') {
                // void return types should not return anything
                $return = '';
            }
        }

        $advicesArray = new ValueGenerator($this->advices[$prefix][$method->name], ValueGenerator::TYPE_ARRAY_SHORT);
        $advicesArray->setArrayDepth(1);
        $advicesCode = $advicesArray->generate();

        return <<<BODY
static \$__joinPoint;
if (\$__joinPoint === null) {
    \$__joinPoint = {$class}::getJoinPoint(__CLASS__, '{$prefix}', '{$method->name}', {$advicesCode});
}
{$return}\$__joinPoint->__invoke($argumentCode);
BODY;
    }
protected function getJoinpointInvocationBody ( ReflectionMethod $ method ) : string { $ isStatic = $ method -> isStatic ( ) ; $ class = '\\' . __CLASS__ ; $ scope = $ isStatic ? 'static::class' : '$this' ; $ prefix = $ isStatic ? AspectContainer :: STATIC_METHOD_PREFIX : AspectContainer :: METHOD_PREFIX ; $ argumentList = new FunctionCallArgumentListGenerator ( $ method ) ; $ argumentCode = $ argumentList -> generate ( ) ; $ argumentCode = $ scope . ( $ argumentCode ? ", $argumentCode" : '' ) ; $ return = 'return ' ; if ( $ method -> hasReturnType ( ) ) { $ returnType = ( string ) $ method -> getReturnType ( ) ; if ( $ returnType === 'void' ) { // void return types should not return anything $ return = '' ; } } $ advicesArray = new ValueGenerator ( $ this -> advices [ $ prefix ] [ $ method -> name ] , ValueGenerator :: TYPE_ARRAY_SHORT ) ; $ advicesArray -> setArrayDepth ( 1 ) ; $ advicesCode = $ advicesArray -> generate ( ) ; return  <<<BODY
static \$__joinPoint;
if (\$__joinPoint === null) {
    \$__joinPoint = {$class}::getJoinPoint(__CLASS__, '{$prefix}', '{$method->name}', {$advicesCode});
}
{$return}\$__joinPoint->__invoke($argumentCode);
BODY ; }
Creates string definition for trait method body by method reflection
Creates string definition for trait method body by method reflection