dev/src/ReleaseBuilder/ReleaseBuilder.php
private function processCommit(OutputInterface $output, array $commit, array $components)
    {
        $output->writeln(sprintf(
            'Processing Commit: <info>%s</info>',
            $commit['message']
        ));
        $output->writeln(sprintf('View on GitHub: %s', $commit['htmlUrl']));
        $output->writeln('----------');
        $output->writeln('');

        $message = trim($this->ask('Enter a release summary for this commit. You can change this later.', $commit['message']));

        $commitRelease = [];
        foreach ($components as $key => $component) {
            $componentRelease = isset($commitRelease[$key])
                ? $commitRelease[$key]
                : ['level' => self::LEVEL_PATCH, 'message' => '', 'reasons' => []];

            $lowestAllowedLevel = $componentRelease['level'];
            $suggestedLevel = $lowestAllowedLevel;
            $allowedLevels = array_filter($this->levels, function ($name, $key) use ($lowestAllowedLevel) {
                return $key >= $lowestAllowedLevel;
            }, ARRAY_FILTER_USE_BOTH);

            $output->writeln(sprintf('Component <comment>%s</comment> modified by commit.', $key));

            list ($suggestedLevel, $reasons) =
                $this->determineSuggestedLevel($allowedLevels, $suggestedLevel, $component['files']);

            $output->writeln(sprintf(
                'We suggest a <info>%s</info> release because of the following reasons. Please do not use this as an ' .
                'absolute guide, as this tool is unable to determine the correct outcome in every scenario.',
                $this->levels[$suggestedLevel]
            ));
            $output->writeln('');

            foreach ($reasons as $reason) {
                $output->writeln('* '. $reason);
            }

            $output->writeln('');

            $componentRelease['level'] = $suggestedLevel;
            $componentRelease['message'] = $message .' (#'. $commit['reference'] .')';
            $componentRelease['reasons'] = array_merge($componentRelease['reasons'], $reasons);
            $componentRelease['ref'] = $commit['reference'];

            $commitRelease[$key] = $componentRelease;
        }

        return $commitRelease;
    }
private function processCommit(OutputInterface $output, array $commit, array $components)
    {
        $output->writeln(sprintf(
            'Processing Commit: <info>%s</info>',
            $commit['message']
        ));
        $output->writeln(sprintf('View on GitHub: %s', $commit['htmlUrl']));
        $output->writeln('----------');
        $output->writeln('');

        $message = trim($this->ask('Enter a release summary for this commit. You can change this later.', $commit['message']));

        $commitRelease = [];
        foreach ($components as $key => $component) {
            $componentRelease = isset($commitRelease[$key])
                ? $commitRelease[$key]
                : ['level' => self::LEVEL_PATCH, 'message' => '', 'reasons' => []];

            $lowestAllowedLevel = $componentRelease['level'];
            $suggestedLevel = $lowestAllowedLevel;
            $allowedLevels = array_filter($this->levels, function ($name, $key) use ($lowestAllowedLevel) {
                return $key >= $lowestAllowedLevel;
            }, ARRAY_FILTER_USE_BOTH);

            $output->writeln(sprintf('Component <comment>%s</comment> modified by commit.', $key));

            list ($suggestedLevel, $reasons) =
                $this->determineSuggestedLevel($allowedLevels, $suggestedLevel, $component['files']);

            $output->writeln(sprintf(
                'We suggest a <info>%s</info> release because of the following reasons. Please do not use this as an ' .
                'absolute guide, as this tool is unable to determine the correct outcome in every scenario.',
                $this->levels[$suggestedLevel]
            ));
            $output->writeln('');

            foreach ($reasons as $reason) {
                $output->writeln('* '. $reason);
            }

            $output->writeln('');

            $componentRelease['level'] = $suggestedLevel;
            $componentRelease['message'] = $message .' (#'. $commit['reference'] .')';
            $componentRelease['reasons'] = array_merge($componentRelease['reasons'], $reasons);
            $componentRelease['ref'] = $commit['reference'];

            $commitRelease[$key] = $componentRelease;
        }

        return $commitRelease;
    }
private function processCommit ( OutputInterface $ output , array $ commit , array $ components ) { $ output -> writeln ( sprintf ( 'Processing Commit: <info>%s</info>' , $ commit [ 'message' ] ) ) ; $ output -> writeln ( sprintf ( 'View on GitHub: %s' , $ commit [ 'htmlUrl' ] ) ) ; $ output -> writeln ( '----------' ) ; $ output -> writeln ( '' ) ; $ message = trim ( $ this -> ask ( 'Enter a release summary for this commit. You can change this later.' , $ commit [ 'message' ] ) ) ; $ commitRelease = [ ] ; foreach ( $ components as $ key => $ component ) { $ componentRelease = isset ( $ commitRelease [ $ key ] ) ? $ commitRelease [ $ key ] : [ 'level' => self :: LEVEL_PATCH , 'message' => '' , 'reasons' => [ ] ] ; $ lowestAllowedLevel = $ componentRelease [ 'level' ] ; $ suggestedLevel = $ lowestAllowedLevel ; $ allowedLevels = array_filter ( $ this -> levels , function ( $ name , $ key ) use ( $ lowestAllowedLevel ) { return $ key >= $ lowestAllowedLevel ; } , ARRAY_FILTER_USE_BOTH ) ; $ output -> writeln ( sprintf ( 'Component <comment>%s</comment> modified by commit.' , $ key ) ) ; list ( $ suggestedLevel , $ reasons ) = $ this -> determineSuggestedLevel ( $ allowedLevels , $ suggestedLevel , $ component [ 'files' ] ) ; $ output -> writeln ( sprintf ( 'We suggest a <info>%s</info> release because of the following reasons. Please do not use this as an ' . 'absolute guide, as this tool is unable to determine the correct outcome in every scenario.' , $ this -> levels [ $ suggestedLevel ] ) ) ; $ output -> writeln ( '' ) ; foreach ( $ reasons as $ reason ) { $ output -> writeln ( '* ' . $ reason ) ; } $ output -> writeln ( '' ) ; $ componentRelease [ 'level' ] = $ suggestedLevel ; $ componentRelease [ 'message' ] = $ message . ' (#' . $ commit [ 'reference' ] . ')' ; $ componentRelease [ 'reasons' ] = array_merge ( $ componentRelease [ 'reasons' ] , $ reasons ) ; $ componentRelease [ 'ref' ] = $ commit [ 'reference' ] ; $ commitRelease [ $ key ] = $ componentRelease ; } return $ commitRelease ; }
Top-level CLI to process a single commit and display information to the user.

@param OutputInterface $output
@param array $commit Data about the commit.
@param array $components Data about all components modified in the commit.
@return array
Top - level CLI to process a single commit and display information to the user .