0 follower

Final Class Yiisoft\YiiDevTool\App\Command\Release\MissingCommand

InheritanceYiisoft\YiiDevTool\App\Command\Release\MissingCommand » Symfony\Component\Console\Command\Command

Method Details

Hide inherited methods

execute() protected method

protected mixed execute ( \Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output )
$input \Symfony\Component\Console\Input\InputInterface
$output \Symfony\Component\Console\Output\OutputInterface

                protected function execute(InputInterface $input, OutputInterface $output)
{
    $this->initPackageList();
    $packagesMissingRelease = [];
    $installedPackages = $this
        ->getPackageList()
        ->getInstalledAndEnabledPackages();
    // Get packages missing release.
    foreach ($installedPackages as $installedPackage) {
        $changelogFile = $installedPackage->getPath() . '/CHANGELOG.md';
        if ($this->hasRelease($installedPackage) && file_exists($changelogFile)) {
            $changelog = new Changelog($changelogFile);
            [$versionTitle, $changes] = $changelog->getReleaseLog();
            if (empty($changes) || $changes[0] === '- no changes in this release.') {
                continue;
            }
            $tags = $installedPackage->getGitWorkingCopy()->tags()->all();
            rsort($tags, SORT_NATURAL);
            preg_match('/(\d+\.\d+\.\d+) under development/', $versionTitle[1], $matches);
            $packagesMissingRelease[$installedPackage->getName()] = [
                'missing' => $matches[1],
                'last' => reset($tags),
            ];
        }
    }
    $successStyle = new TableCellStyle(['fg' => 'green']);
    $packagesToRelease = [];
    foreach ($packagesMissingRelease as $packageName => $releases) {
        $packagesToRelease[] = [
            new TableCell($packageName, ['style' => $successStyle]),
            $releases['last'],
            $releases['missing'],
        ];
    }
    $tableIO = new Table($output);
    $tableIO->setHeaders(['Package', 'Last release', 'Missing release']);
    if (count($packagesToRelease) > 0) {
        $tableIO->addRows($packagesToRelease);
    }
    $tableIO->render();
    return Command::SUCCESS;
}

            
getAppRootDir() protected method

Use this method to get a root directory of the tool.

Commands and components can be moved as a result of refactoring, so you should not rely on their location in the file system.

protected string getAppRootDir ( )
return string

Path to the root directory of the tool WITH a TRAILING SLASH.

                protected function getAppRootDir(): string
{
    return rtrim(
        $this
                ->getApplication()
                ->getRootDir(),
        DIRECTORY_SEPARATOR
    ) . DIRECTORY_SEPARATOR;
}

            
getIO() protected method

protected Yiisoft\YiiDevTool\App\Component\Console\OutputManager getIO ( )

                protected function getIO(): OutputManager
{
    if ($this->io === null) {
        throw new RuntimeException('IO is not initialized.');
    }
    return $this->io;
}

            
initialize() protected method

protected mixed initialize ( \Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output )
$input \Symfony\Component\Console\Input\InputInterface
$output \Symfony\Component\Console\Output\OutputInterface

                protected function initialize(InputInterface $input, OutputInterface $output)
{
    $this->io = new OutputManager(new YiiDevToolStyle($input, $output));
}