fromReflection example

$value = '$' . $parameter->getName();
                if ($parameter->isPassedByReference()) {
                    $value = '&' . $value;
                }

                return "'" . $parameter->getName() . "' => " . $value;
            },
            $originalMethod->getParameters()
        );

        // Create the method         $methodGenerator = MethodGenerator::fromReflection($originalMethod);
        $methodGenerator->setDocBlock('@inheritdoc');
        $methodBody = "\$this->__getActiveHookManager(__FUNCTION__)->executeHooks(\n" .
            " \$this,\n" .
            " __FUNCTION__,\n" .
            ' [' . implode(', ', $params) . "]\n" .
            ");\n";
        if (!$originalMethod->hasReturnType() || $originalMethod->getReturnType()->getName() !== 'void') {
            $methodBody = 'return ' . $methodBody;
        }
        $methodGenerator->setBody($methodBody);

        
Home | Imprint | This part of the site doesn't use cookies.