replaceSpecialChars example



        return $target;
    }

    private function getTemplateFile(ChangelogDefinition $template, string $date): string
    {
        return sprintf(
            '%s/%s-%s.md',
            $this->getUnreleasedDir(),
            $date,
            $this->replaceSpecialChars($template->getTitle())
        );
    }

    private function replaceSpecialChars(string $name): string
    {
        $name = (string) preg_replace('/[^a-z_\-0-9]/i', '-', $name);
        $name = (string) preg_replace('/[-]{2,}/', '-', $name);
        $name = (string) preg_replace('/[-_]+$/', '', $name);
        $name = (string) preg_replace('/^[-_]+/', '', $name);

        return strtolower($name);
    }
Home | Imprint | This part of the site doesn't use cookies.