setName('audit') ->setDescription('Checks for security vulnerability advisories for installed packages') ->setDefinition([ new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables auditing of require-dev packages.'), new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_TABLE, Auditor::FORMATS), new InputOption('locked', null, InputOption::VALUE_NONE, 'Audit based on the lock file instead of the installed packages.'), ]) ->setHelp( "The audit command checks for security vulnerability advisories for installed packages.\n\nIf you do not want to include dev dependencies in the audit you can omit them with --no-dev\n\nRead more at https://getcomposer.org/doc/03-cli.md#audit" ) ; } protected function execute(InputInterface $input, OutputInterface $output) { $composer = $this->requireComposer(); $packages = $this->getPackages($composer, $input); if (count($packages) === 0) { $this->getIO()->writeError('No packages - skipping audit.'); return 0; } $auditor = new Auditor(); $repoSet = new RepositorySet(); foreach ($composer->getRepositoryManager()->getRepositories() as $repo) { $repoSet->addRepository($repo); } return min(255, $auditor->audit($this->getIO(), $repoSet, $packages, $this->getAuditFormat($input, 'format'), false)); } /** * @return PackageInterface[] */ private function getPackages(Composer $composer, InputInterface $input): array { if ($input->getOption('locked')) { if (!$composer->getLocker()->isLocked()) { throw new \UnexpectedValueException('Valid composer.json and composer.lock files are required to run this command with --locked'); } $locker = $composer->getLocker(); return $locker->getLockedRepository(!$input->getOption('no-dev'))->getPackages(); } $rootPkg = $composer->getPackage(); $installedRepo = new InstalledRepository([$composer->getRepositoryManager()->getLocalRepository()]); if ($input->getOption('no-dev')) { return RepositoryUtils::filterRequiredPackages($installedRepo->getPackages(), $rootPkg); } return $installedRepo->getPackages(); } } __halt_compiler();----SIGNATURE:----xxkMLSxcCFRhASSRbbEmec91hx4QfstjvvslNKPRS5FWkl+gyKQavNERqkGRWDfNzE7IutoSmYW1u6GxcbAzeYMHxxoT+qP3euhyUmB3bVVBHwKsf3jxlC8uEYw0mlh5h7jxChuFWsDG81ISZvJ8TFI+KRoOH+Yg0P2Lp/7kt9yBiMK5LIEWgHJ4sqW/UMLaWFS9BIzUYcY29e0oVaYoHhNpy94GKo4wqJN7/nr2sSWQ3Mk+GwQlQOJTR715FZ+mm0HO0Y2kB/c18sunre7ei24uZtapNtAuR9iWa/335Ot0FcO2HQzZNr1od7DIVlBoNyxKl0f0MtZmte1jPzyyG5mVYJuX9UWf5so3qO07JacGwC4pEzjSD8cn+Yc+tL4vYLe9fUsidBDSoyQ//oexE3IwoVw3ktRuLQcOAOSPABGQsr1f2T5QqLzgTnC8/2SGn9jfJKEEmTmjX26WxKVJYGvGOvKTJ0ne6ARO3y3lhqjlkZYkn0c23XGWtINZMyqONfb6soQ7Q7YbOWpDVJUtWHGESpU8r9MZFal+Xu9n06K8fFhJUoy37etcdLIG+uLMKskrABbhpzanzIjx0QFGOnPqb5M/B0EkO87/Q5RSqt4VwiWn1Us0HET0FvqLSmNa/5w/7ZfFj9NfdYBDcViZVjMIlasozEdLjAlHpg3rJgU=----ATTACHMENT:----MjUyMDAzMTU1ODM2Mjg1NSAzNDkyNzAyMzgxNTE3OTg3IDEzNzAzODEzNjAxMDI4Ng==