dev/src/ReleaseBuilder/ReleaseBuilder.php
private function determineSuggestedLevel(array $levelChoices, $suggestedLevel, array $files)
    {
        $reasons = [];

        if ($levelChoices !== $this->levels) {
            $suggestedLevel = array_keys($levelChoices)[0];
            $reasons[] = 'Another change specified a higher minimum release level.';
        }

        if (isset($levelChoices[self::LEVEL_MINOR]) && (bool) array_filter($files, function ($file) {
            $parts = explode('/', $file);
            return isset($parts[1]) && $parts[1] === 'src' && count($parts) > 2;
        })) {
            $suggestedLevel = self::LEVEL_MINOR;
            $reasons[] = 'There are changes in the component `src` folder.';
        }

        if (isset($levelChoices[self::LEVEL_MINOR]) && in_array('composer.json', $files)) {
            $suggestedLevel = self::LEVEL_MINOR;
            $reasons[] = 'The component `composer.json` file was modified.';
        }

        if ($suggestedLevel === self::LEVEL_PATCH) {
            $reasons[] = 'None of the indicators show the commit includes a client-facing code change.';
        }

        return [$suggestedLevel, $reasons];
    }
private function determineSuggestedLevel(array $levelChoices, $suggestedLevel, array $files)
    {
        $reasons = [];

        if ($levelChoices !== $this->levels) {
            $suggestedLevel = array_keys($levelChoices)[0];
            $reasons[] = 'Another change specified a higher minimum release level.';
        }

        if (isset($levelChoices[self::LEVEL_MINOR]) && (bool) array_filter($files, function ($file) {
            $parts = explode('/', $file);
            return isset($parts[1]) && $parts[1] === 'src' && count($parts) > 2;
        })) {
            $suggestedLevel = self::LEVEL_MINOR;
            $reasons[] = 'There are changes in the component `src` folder.';
        }

        if (isset($levelChoices[self::LEVEL_MINOR]) && in_array('composer.json', $files)) {
            $suggestedLevel = self::LEVEL_MINOR;
            $reasons[] = 'The component `composer.json` file was modified.';
        }

        if ($suggestedLevel === self::LEVEL_PATCH) {
            $reasons[] = 'None of the indicators show the commit includes a client-facing code change.';
        }

        return [$suggestedLevel, $reasons];
    }
private function determineSuggestedLevel ( array $ levelChoices , $ suggestedLevel , array $ files ) { $ reasons = [ ] ; if ( $ levelChoices !== $ this -> levels ) { $ suggestedLevel = array_keys ( $ levelChoices ) [ 0 ] ; $ reasons [ ] = 'Another change specified a higher minimum release level.' ; } if ( isset ( $ levelChoices [ self :: LEVEL_MINOR ] ) && ( bool ) array_filter ( $ files , function ( $ file ) { $ parts = explode ( '/' , $ file ) ; return isset ( $ parts [ 1 ] ) && $ parts [ 1 ] === 'src' && count ( $ parts ) > 2 ; } ) ) { $ suggestedLevel = self :: LEVEL_MINOR ; $ reasons [ ] = 'There are changes in the component `src` folder.' ; } if ( isset ( $ levelChoices [ self :: LEVEL_MINOR ] ) && in_array ( 'composer.json' , $ files ) ) { $ suggestedLevel = self :: LEVEL_MINOR ; $ reasons [ ] = 'The component `composer.json` file was modified.' ; } if ( $ suggestedLevel === self :: LEVEL_PATCH ) { $ reasons [ ] = 'None of the indicators show the commit includes a client-facing code change.' ; } return [ $ suggestedLevel , $ reasons ] ; }
Logic to determine the best release level for a component.

@param array $levelChoices Allowed levels for the component.
@param string $suggestedLevel The current suggested level for the release.
@param array $files A list of files in the component folder modified in
the commit.
@return array [$suggestedLevel, $reasons]
Logic to determine the best release level for a component .