private function comparePath(AuthorExtractor $current, AuthorExtractor $should, ProgressBar $progressBar, $path)
    {
        $validates        = true;
        $mentionedAuthors = $current->extractAuthorsFor($path);
        $multipleAuthors  = $current->extractMultipleAuthorsFor($path);
        $wantedAuthors    = array_merge($should->extractAuthorsFor($path), $this->config->getCopyLeftAuthors($path));

        // If current input is not valid, return.
        if ($mentionedAuthors === null) {
            if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                $this->output->writeln(
                    \sprintf('Skipped check of <info>%s</info> as it is not present.', $path)
                );
            }

            if ($this->useProgressBar) {
                $progressBar->advance(1);
                $progressBar->setMessage('Author validation is in progress...');
            }
            return true;
        }

        $superfluousMentions = $this->determineSuperfluous($mentionedAuthors, $wantedAuthors, $path);
        $missingMentions     = \array_diff_key($wantedAuthors, $mentionedAuthors);

        if (\count($superfluousMentions)) {
            $this->output->writeln(
                \sprintf(
                    PHP_EOL .
                    PHP_EOL .
                    'The file <info>%s</info> is mentioning superfluous author(s):' .
                    PHP_EOL .
                    '<comment>%s</comment>' .
                    PHP_EOL,
                    $path,
                    \implode(PHP_EOL, $superfluousMentions)
                )
            );
            $validates = false;
        }

        if (\count($missingMentions)) {
            $this->output->writeln(
                \sprintf(
                    PHP_EOL .
                    PHP_EOL .
                    'The file <info>%s</info> is not mentioning its author(s):' .
                    PHP_EOL .
                    '<comment>%s</comment>' .
                    PHP_EOL,
                    $path,
                    \implode(PHP_EOL, $missingMentions)
                )
            );
            $validates = false;
        }

        if (\count($multipleAuthors)) {
            $this->output->writeln(
                \sprintf(
                    PHP_EOL .
                    PHP_EOL .
                    'The file <info>%s</info> multiple author(s):' .
                    PHP_EOL .
                    '<comment>%s</comment>'.
                    PHP_EOL,
                    $path,
                    \implode(PHP_EOL, $multipleAuthors)
                )
            );

            $validates = false;
        }

        if (!$validates) {
            $this->patchExtractor($path, $current, $wantedAuthors);
        }

        if ($this->useProgressBar) {
            $progressBar->advance(1);
            $progressBar->setMessage('Author validation is in progress...');
        }

        return $validates;
    }
private function comparePath(AuthorExtractor $current, AuthorExtractor $should, ProgressBar $progressBar, $path)
    {
        $validates        = true;
        $mentionedAuthors = $current->extractAuthorsFor($path);
        $multipleAuthors  = $current->extractMultipleAuthorsFor($path);
        $wantedAuthors    = array_merge($should->extractAuthorsFor($path), $this->config->getCopyLeftAuthors($path));

        // If current input is not valid, return.
        if ($mentionedAuthors === null) {
            if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
                $this->output->writeln(
                    \sprintf('Skipped check of <info>%s</info> as it is not present.', $path)
                );
            }

            if ($this->useProgressBar) {
                $progressBar->advance(1);
                $progressBar->setMessage('Author validation is in progress...');
            }
            return true;
        }

        $superfluousMentions = $this->determineSuperfluous($mentionedAuthors, $wantedAuthors, $path);
        $missingMentions     = \array_diff_key($wantedAuthors, $mentionedAuthors);

        if (\count($superfluousMentions)) {
            $this->output->writeln(
                \sprintf(
                    PHP_EOL .
                    PHP_EOL .
                    'The file <info>%s</info> is mentioning superfluous author(s):' .
                    PHP_EOL .
                    '<comment>%s</comment>' .
                    PHP_EOL,
                    $path,
                    \implode(PHP_EOL, $superfluousMentions)
                )
            );
            $validates = false;
        }

        if (\count($missingMentions)) {
            $this->output->writeln(
                \sprintf(
                    PHP_EOL .
                    PHP_EOL .
                    'The file <info>%s</info> is not mentioning its author(s):' .
                    PHP_EOL .
                    '<comment>%s</comment>' .
                    PHP_EOL,
                    $path,
                    \implode(PHP_EOL, $missingMentions)
                )
            );
            $validates = false;
        }

        if (\count($multipleAuthors)) {
            $this->output->writeln(
                \sprintf(
                    PHP_EOL .
                    PHP_EOL .
                    'The file <info>%s</info> multiple author(s):' .
                    PHP_EOL .
                    '<comment>%s</comment>'.
                    PHP_EOL,
                    $path,
                    \implode(PHP_EOL, $multipleAuthors)
                )
            );

            $validates = false;
        }

        if (!$validates) {
            $this->patchExtractor($path, $current, $wantedAuthors);
        }

        if ($this->useProgressBar) {
            $progressBar->advance(1);
            $progressBar->setMessage('Author validation is in progress...');
        }

        return $validates;
    }
private function comparePath ( AuthorExtractor $ current , AuthorExtractor $ should , ProgressBar $ progressBar , $ path ) { $ validates = true ; $ mentionedAuthors = $ current -> extractAuthorsFor ( $ path ) ; $ multipleAuthors = $ current -> extractMultipleAuthorsFor ( $ path ) ; $ wantedAuthors = array_merge ( $ should -> extractAuthorsFor ( $ path ) , $ this -> config -> getCopyLeftAuthors ( $ path ) ) ; // If current input is not valid, return. if ( $ mentionedAuthors === null ) { if ( $ this -> output -> getVerbosity ( ) >= OutputInterface :: VERBOSITY_VERBOSE ) { $ this -> output -> writeln ( \ sprintf ( 'Skipped check of <info>%s</info> as it is not present.' , $ path ) ) ; } if ( $ this -> useProgressBar ) { $ progressBar -> advance ( 1 ) ; $ progressBar -> setMessage ( 'Author validation is in progress...' ) ; } return true ; } $ superfluousMentions = $ this -> determineSuperfluous ( $ mentionedAuthors , $ wantedAuthors , $ path ) ; $ missingMentions = \ array_diff_key ( $ wantedAuthors , $ mentionedAuthors ) ; if ( \ count ( $ superfluousMentions ) ) { $ this -> output -> writeln ( \ sprintf ( PHP_EOL . PHP_EOL . 'The file <info>%s</info> is mentioning superfluous author(s):' . PHP_EOL . '<comment>%s</comment>' . PHP_EOL , $ path , \ implode ( PHP_EOL , $ superfluousMentions ) ) ) ; $ validates = false ; } if ( \ count ( $ missingMentions ) ) { $ this -> output -> writeln ( \ sprintf ( PHP_EOL . PHP_EOL . 'The file <info>%s</info> is not mentioning its author(s):' . PHP_EOL . '<comment>%s</comment>' . PHP_EOL , $ path , \ implode ( PHP_EOL , $ missingMentions ) ) ) ; $ validates = false ; } if ( \ count ( $ multipleAuthors ) ) { $ this -> output -> writeln ( \ sprintf ( PHP_EOL . PHP_EOL . 'The file <info>%s</info> multiple author(s):' . PHP_EOL . '<comment>%s</comment>' . PHP_EOL , $ path , \ implode ( PHP_EOL , $ multipleAuthors ) ) ) ; $ validates = false ; } if ( ! $ validates ) { $ this -> patchExtractor ( $ path , $ current , $ wantedAuthors ) ; } if ( $ this -> useProgressBar ) { $ progressBar -> advance ( 1 ) ; $ progressBar -> setMessage ( 'Author validation is in progress...' ) ; } return $ validates ; }
Run comparison for a given path.

@param AuthorExtractor $current     The author list containing the current state.
@param AuthorExtractor $should      The author list containing the desired state.
@param ProgressBar     $progressBar The progress bar.
@param string          $path        The path to compare.

@return bool
Run comparison for a given path .