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:----fWbjFbQxgaInxQ5OtBg+2ZzA3RRBDgQyvvH6Cd6t1KXSFIaB30XmGQfr6LsnLWsv4XR9ak1ZwffOwcoAbyJ/l0MDVJK5n4E3IGtsUPsguUXS/F3NGa5Aaqiqd0j3Ym/CVFppjNmXgwXwLwFjm7ONol6Av3OLVcfI1HHzpTIU3C3gKAjIUn+5RHRC0qJMXbeBw1TyLUczv7WymAhiF+avuGnTG5ievUwQ+3RvvCDAZdwZxQGkZjQNu6wquCsACgUfu+KSiYcn8146tyvLge1tfmBKw1rix9YQlA62e2kmaw22WjxSLVxUazeKF4EaT5qjF7idIoQXju5qyjH43lDy3bZJl99xy240kUGir0z1o4Tj5Y8EC1YnwvyQxeXEcXjiTpUZrs0s2zWTaztF4bHP8kEQdPZ3gX39DkMZh3JfJU9rg0hAk0EO3vXJDL4Q1pYNb+cVA+OIS9KwiFIM732Qd3+VmAlVStXNbXcQffyauaILy56QT9VOJn/o1p8t27RoLTVwOzBawNhl5N7L5MyS5cpoaRydTCrIFh7URcYyKutk/xmez+FQT5HZdcxf4BR4pBvwF05n8vEjiRrZsnNYUKryjX8SAv2wkLbF/OKsveYvLRGAmCLDdSOIry2Zr026OPOAQUdc854GjWIzauzhNG64SihPUPTlnZXU5aycJNg=----ATTACHMENT:----Nzg3ODUyMTE0OTAzNDU4MCA4NzI3MTYxNDY4ODg1ODcgNTg3ODc1MTc2OTIzMjQ2NQ==