<?php

declare(strict_types = 1);

namespace Fgm\Drupal\Composer;

use Composer\Plugin\Capability\CommandProvider;

/**
 * Command capability for Composer plugins: provides the list of commmands.
 *
 * @package Fgm\Drupal\Composer
 */
class BuilderCommandProvider implements CommandProvider {

  /**
   * The currently running Composer instance.
   *
   * @var \Composer\Composer
   */
  protected $composer;

  /**
   * The Composer I/O.
   *
   * @var \Composer\IO\IOInterface
   */
  protected $io;

  /**
   * An instance of the plugin instantiated not-as-a-command.
   *
   * @var self
   */
  protected $plugin;

  /**
   * BuilderCommandProvider constructor.
   *
   * @param array|null $args
   *   Guaranteed to contain composer/io/plugin as per CommandProvider.
   */
  public function __construct(array $args = NULL) {
    $this->composer = $args['composer'];
    $this->io = $args['io'];
    $this->plugin = $args['plugin'];
  }

  /**
   * {@inheritdoc}
   */
  public function getCommands() {
    return [
      new BuildServicesCommand(),
      new BuildSettingsCommand(),
      new HugoConfigCommand(),
      new MergeParamsCommand(),
      new PhpMemcacheAdminConfigCommand(),
    ];
  }

}