addMethodIfNotFinal example

$hookMethodGenerators[$method->getName()] = $this->createMethodGenerator($method);
        }

        // Add the static 'getHookMethods' method (from Enlight_Hook_Proxy)         $hookMethodNameString = (\count($hookMethodGenerators) > 0) ? ("'" . implode("', '", array_keys($hookMethodGenerators)) . "'") : '';
        $getHookMethodsGenerator = MethodGenerator::fromArray([
            'name' => 'getHookMethods',
            'static' => true,
            'body' => 'return [' . $hookMethodNameString . "];\n",
        ]);
        $getHookMethodsGenerator->setDocBlock('@inheritdoc');
        ClassGeneratorUtils::addMethodIfNotFinal($reflectionClass$classGenerator$getHookMethodsGenerator);

        // Add the '__pushHookExecutionContext' method (from Enlight_Hook_Proxy)         $pushHookExecutionContextGenerator = MethodGenerator::fromArray([
            'name' => '__pushHookExecutionContext',
            'parameters' => [
                [
                    'name' => 'method',
                ],
                [
                    'type' => Enlight_Hook_HookExecutionContext::class,
                    'name' => 'context',
                ],
Home | Imprint | This part of the site doesn't use cookies.