Skip to content
Snippets Groups Projects
BaseHandlerInterface.php 2.66 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 {

jurgenhaas's avatar
jurgenhaas committed
   * Provides the cofig Id.
   *
jurgenhaas's avatar
jurgenhaas committed
   *   The config Id.
   */
  public function configId(): string;

jurgenhaas's avatar
jurgenhaas committed
   * Sets the composer event.
   *
   * @param \Composer\Script\Event $event
jurgenhaas's avatar
jurgenhaas committed
   *   The composer event.
jurgenhaas's avatar
jurgenhaas committed
   *
jurgenhaas's avatar
jurgenhaas committed
   * @return self
   *   This hanlder.
jurgenhaas's avatar
jurgenhaas committed
  public function setEvent(Event $event): BaseHandlerInterface;
jurgenhaas's avatar
jurgenhaas committed
   * Sets the input handler.
   *
   * @param \Symfony\Component\Console\Input\InputInterface $input
jurgenhaas's avatar
jurgenhaas committed
   *   The input handler.
jurgenhaas's avatar
jurgenhaas committed
   *
   * @return self
   *    This hanlder.
jurgenhaas's avatar
jurgenhaas committed
  public function setInput(InputInterface $input): BaseHandlerInterface;
  /**
   * Look up the Drupal core package object.
   *
jurgenhaas's avatar
jurgenhaas committed
   * @return \Composer\Package\PackageInterface|null
   *   The Drupal core package.
   */
jurgenhaas's avatar
jurgenhaas committed
  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|null
   *   The package.
   */
  public function getPackage(string $name): ?PackageInterface;
jurgenhaas's avatar
jurgenhaas committed
   * Determines if this is running in development mode.
   *
   * @return bool
jurgenhaas's avatar
jurgenhaas committed
   *   TRUE, if executing in development mode, FALSE otherwise.
  public function isDevMode(): bool;
jurgenhaas's avatar
jurgenhaas committed
   * Determines if this is running in local development mode.
   *
   * @return bool
jurgenhaas's avatar
jurgenhaas committed
   *   TRUE, if executing in local development mode, FALSE otherwise.
  public function isLocalDevMode(): bool;
  /**
   * Determine if the current process runs in a CI/CD context.
   *
   * @return bool
jurgenhaas's avatar
jurgenhaas committed
   *   TRUE, if executing in CI/CD context, FALSE otherwise.
  public function isCiContext(): bool;

  /**
   * Wrapper for git command in the root directory.
   *
   * @param string $command
   *   Git command name, arguments and/or options.
   * @param string|null $path
   *   Optional path into which to chdir before executing command.
jurgenhaas's avatar
jurgenhaas committed
  public function git(string $command, string $path = NULL): void;
  /**
   * Add the given pattern to gitignore if necessary.
   *
   * @param string $pattern
   *   The pattern which should be ignored.
   */
jurgenhaas's avatar
jurgenhaas committed
  public function gitIgnore(string $pattern): void;
  /**
   * Add the given pattern to git lfs if necessary.
   *
   * @param string $pattern
   *   The pattern which should be added.
   */
jurgenhaas's avatar
jurgenhaas committed
  public function gitLfs(string $pattern): void;