OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
php
/
Composer
/
Command
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
π
..
-
07/20/2024 06:32:22 AM
rwxr-xr-x
π
AboutCommand.php
1.1 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ArchiveCommand.php
6.42 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
BaseCommand.php
4.51 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
BaseDependencyCommand.php
9.7 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
CheckPlatformReqsCommand.php
4.9 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ClearCacheCommand.php
1.99 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ConfigCommand.php
26.21 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
CreateProjectCommand.php
17.35 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
DependsCommand.php
1.29 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
DiagnoseCommand.php
25.52 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
DumpAutoloadCommand.php
3.21 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ExecCommand.php
2.74 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
GlobalCommand.php
2.86 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
HomeCommand.php
5.29 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
InitCommand.php
28.09 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
InstallCommand.php
6.17 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
LicensesCommand.php
5.32 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
OutdatedCommand.php
3.44 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ProhibitsCommand.php
1.31 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
RemoveCommand.php
6.81 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
RequireCommand.php
10.15 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
RunScriptCommand.php
4.82 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ScriptAliasCommand.php
1.88 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
SearchCommand.php
2.86 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
SelfUpdateCommand.php
16.48 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ShowCommand.php
37.82 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
StatusCommand.php
7.89 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
SuggestsCommand.php
5.1 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
UpdateCommand.php
10.82 KB
01/31/2018 03:28:18 PM
rw-r--r--
π
ValidateCommand.php
6.73 KB
01/31/2018 03:28:18 PM
rw-r--r--
Editing: ValidateCommand.php
Close
<?php /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Command; use Composer\Factory; use Composer\Package\Loader\ValidatingArrayLoader; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; use Composer\Util\ConfigValidator; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** * ValidateCommand * * @author Robert SchΓΆnthal <seroscho@googlemail.com> * @author Jordi Boggiano <j.boggiano@seld.be> */ class ValidateCommand extends BaseCommand { /** * configure */ protected function configure() { $this ->setName('validate') ->setDescription('Validates a composer.json and composer.lock.') ->setDefinition(array( new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'), new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'), new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'), new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'), new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'), new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'), )) ->setHelp(<<<EOT The validate command validates a given composer.json and composer.lock Exit codes in case of errors are: 1 validation warning(s), only when --strict is given 2 validation error(s) 3 file unreadable or missing EOT ); } /** * @param InputInterface $input * @param OutputInterface $output * * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { $file = $input->getArgument('file') ?: Factory::getComposerFile(); $io = $this->getIO(); if (!file_exists($file)) { $io->writeError('<error>' . $file . ' not found.</error>'); return 3; } if (!is_readable($file)) { $io->writeError('<error>' . $file . ' is not readable.</error>'); return 3; } $validator = new ConfigValidator($io); $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL; $checkPublish = !$input->getOption('no-check-publish'); $checkLock = !$input->getOption('no-check-lock'); $isStrict = $input->getOption('strict'); list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll); $lockErrors = array(); $composer = Factory::create($io, $file); $locker = $composer->getLocker(); if ($locker->isLocked() && !$locker->isFresh()) { $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.'; } $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true); $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0); if ($input->getOption('with-dependencies')) { $localRepo = $composer->getRepositoryManager()->getLocalRepository(); foreach ($localRepo->getPackages() as $package) { $path = $composer->getInstallationManager()->getInstallPath($package); $file = $path . '/composer.json'; if (is_dir($path) && file_exists($file)) { list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll); $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors); $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0); $exitCode = max($depCode, $exitCode); } } } $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output); $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent); $exitCode = max($eventCode, $exitCode); return $exitCode; } private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false) { if (!$errors && !$publishErrors && !$warnings) { $io->write('<info>' . $name . ' is valid</info>'); } elseif (!$errors && !$publishErrors) { $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>'); if ($printSchemaUrl) { $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>'); } } elseif (!$errors) { $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>'); $io->writeError('<info>strict errors that make it unable to be published as a package:</info>'); if ($printSchemaUrl) { $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>'); } } else { $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>'); } // If checking publish errors, display them as errors, otherwise just show them as warnings if ($checkPublish) { $errors = array_merge($errors, $publishErrors); } else { $warnings = array_merge($warnings, $publishErrors); } // If checking lock errors, display them as errors, otherwise just show them as warnings if ($checkLock) { $errors = array_merge($errors, $lockErrors); } else { $warnings = array_merge($warnings, $lockErrors); } $messages = array( 'error' => $errors, 'warning' => $warnings, ); foreach ($messages as $style => $msgs) { foreach ($msgs as $msg) { $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>'); } } } }