getFunctionName example

ScriptTraces::addDeprecationNotice($hook->getDeprecationNotice());
            }

            $template = $twig->load($script->getName());

            if (!$hook instanceof FunctionHook) {
                $template->render(['hook' => $hook]);

                return;
            }

            $blockName = $hook->getFunctionName();
            if ($template->hasBlock($blockName)) {
                $template->renderBlock($blockName['hook' => $hook]);

                return;
            }

            if (!$hook instanceof OptionalFunctionHook) {
                throw new \RuntimeException(sprintf(
                    'Required function "%s" missing in script "%s", please make sure you add the required block in your script.',
                    $hook->getFunctionName(),
                    $script->getName()
                ));
'output' => $output->all(),
            'deprecations' => $deprecations,
        ];
    }

    private function getHookName(Hook $hook): string
    {
        if (!$hook instanceof FunctionHook) {
            return $hook->getName();
        }

        return $hook->getName() . '::' . $hook->getFunctionName();
    }
}
Home | Imprint | This part of the site doesn't use cookies.