Skip to content
Snippets Groups Projects
BaseHandlerInterface.php 1.89 KiB
Newer Older
<?php

namespace LakeDrops\Component\Composer;

use Composer\Package\PackageInterface;
use Composer\Script\Event;
use Symfony\Component\Console\Input\InputInterface;

/**
 * Interface for BaseHandler.
 *
 * @package LakeDrops\Component\Composer
 */
interface BaseHandlerInterface {

  /**
   * @return string
   */
  public function configId(): string;

  /**
   * @param \Composer\Script\Event $event
   */
  public function setEvent(Event $event);

  /**
   * @param \Symfony\Component\Console\Input\InputInterface $input
   */
  public function setInput(InputInterface $input);

  /**
   * Look up the Drupal core package object.
   *
   * @return \Composer\Package\PackageInterface
   *   The Drupal core package.
   */
  public function getDrupalCorePackage(): PackageInterface;

  /**
   * Retrieve a package from the current composer process.
   *
   * @param string $name
   *   Name of the package to get from the current composer installation.
   *
   * @return \Composer\Package\PackageInterface
   *   The package.
   */
  public function getPackage(string $name): PackageInterface;
  /**
   * @return bool
   */
  public function isDevMode(): bool;
  /**
   * @return bool
   */
  public function isLocalDevMode(): bool;
  /**
   * Determine if the current process runs in a CI/CD context.
   *
   * @return bool
   */
  public function isCiContext(): bool;

  /**
   * Wrapper for git command in the root directory.
   *
   * @param string $command
   *   Git command name, arguments and/or options.
   */
  public function git(string $command);
  /**
   * Add the given pattern to gitignore if necessary.
   *
   * @param string $pattern
   *   The pattern which should be ignored.
   */
  public function gitIgnore(string $pattern);
  /**
   * Add the given pattern to git lfs if necessary.
   *
   * @param string $pattern
   *   The pattern which should be added.
   */
  public function gitLFS(string $pattern);