camelCaseToUnderscore example


    final public function setContainer(?ContainerInterface $container = null): void
    {
        $this->container = $container;
    }

    /** * @return string */
    public function getContainerPrefix()
    {
        return $this->camelCaseToUnderscore($this->getName());
    }

    final protected function loadFiles(ContainerBuilder $container): void
    {
        if (!is_file($this->getPath() . '/Resources/services.xml')) {
            return;
        }

        $loader = new XmlFileLoader(
            $container,
            new FileLocator()
        );
return $builder->execute()->fetchAll(PDO::FETCH_KEY_PAIR);
    }

    private function getCsvFileName(): string
    {
        $name = $this->Request()->getActionName();
        if (str_starts_with($name, 'get')) {
            $name = substr($name, 3);
        }

        return $this->camelCaseToUnderscore($name) . '.csv';
    }

    private function camelCaseToUnderscore(string $str): string
    {
        return (new CamelCaseToSnakeCaseNameConverter())->normalize($str);
    }

    /** * helper to get the selected shop ids * if no shop is selected the ids of all shops are returned * * @return array<int> */
Home | Imprint | This part of the site doesn't use cookies.