ChangelogDefinition example

/** * @internal */
#[Package('core')] class ChangelogParser
{
    public function parse(string $content): ChangelogDefinition
    {
        $content = trim($content);

        return (new ChangelogDefinition())
            ->setTitle($this->parseMetadata($content, 'title') ?: '')
            ->setIssue($this->parseMetadata($content, 'issue') ?: '')
            ->setFlag($this->parseMetadata($content, 'flag'))
            ->setAuthor($this->parseMetadata($content, 'author'))
            ->setAuthorEmail($this->parseMetadata($content, 'author_email'))
            ->setAuthorGitHub($this->parseMetadata($content, 'author_github'))
            ->setCore($this->parseSection($content, ChangelogSection::core->value))
            ->setAdministration($this->parseSection($content, ChangelogSection::administration->value))
            ->setStorefront($this->parseSection($content, ChangelogSection::storefront->value))
            ->setApi($this->parseSection($content, ChangelogSection::api->value))
            ->setUpgradeInformation($this->parseSection($content, ChangelogSection::upgrade->value))
            
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $date)) {
                    throw new \RuntimeException('The date has to follow the format: YYYY-MM-DD');
                }

                return $date;
            });
        $flag = $input->getOption('flag') ?? $IOHelper->ask('Feature Flag ID');
        $author = $input->getOption('author') ?? $IOHelper->ask('The author of code changes', $default['author']);
        $authorEmail = $input->getOption('author-email') ?? $IOHelper->ask('The author email of code changes', $default['authorEmail']);
        $authorGithub = $input->getOption('author-github') ?? $IOHelper->ask('The author GitHub account', $default['authorGithub']);

        $template = (new ChangelogDefinition())
            ->setTitle($title)
            ->setIssue($issue)
            ->setFlag($flag)
            ->setAuthor($author)
            ->setAuthorEmail($authorEmail)
            ->setAuthorGitHub($authorGithub);

        $IOHelper->section('Generating: ');
        $target = $this->generator->generate($template$date$input->getOption('dry-run'));

        $IOHelper->newLine();
        
Home | Imprint | This part of the site doesn't use cookies.