| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 | <?php/** * @file * A Drush plugin to compare composer.json and composer.lock. */use Fgm\ComposerCheck\DrushReporter;use Fgm\ComposerCheck\LoaderFactory;use Fgm\ComposerCheck\MergeBox;use Fgm\ComposerCheck\YamlReporter;/** * Implements hook_drush_command(). */function composer_check_drush_command() {  $cmds['composer-check'] = [    'aliases' => ['cck'],    'description' => 'Lists the packages requested in composer.json and the matching locked version.',    'arguments' => [      'composer.lock' => 'The path to the lock file. Defaults to the one in drupal root.',    ],    'options' => [      'all' => [        'description' => 'List all locked packages, even those not requested',        'required' => FALSE,      ],      'yaml' => 'Produce YAML output instead of a table',    ],  ];  return $cmds;}/** * Command callback for composer-check. * * @param null|string $path *   Optional. The path to a directory holding a composer.[json|lock] file pair. */function drush_composer_check($path = DRUPAL_ROOT) {  $all = (bool) drush_get_option('all', FALSE);  $useYaml = (bool) drush_get_option('yaml', FALSE);  $factory = new LoaderFactory($path, $all);  $requirementsLoader = $factory->createLoader('requirements');  $lockLoader = $factory->createLoader('lock');  $merger = new MergeBox($requirementsLoader, $lockLoader, $all);  $reporter = $useYaml ? new YamlReporter() : new DrushReporter();  $reporter->report($merger);}
 |