You are here

class InvalidLibraryDependencyException in Libraries API 8.3

Provides an exception for an invalid library exception.

Hierarchy

Expanded class hierarchy of InvalidLibraryDependencyException

File

src/ExternalLibrary/Exception/InvalidLibraryDependencyException.php, line 13

Namespace

Drupal\libraries\ExternalLibrary\Exception
View source
class InvalidLibraryDependencyException extends \UnexpectedValueException implements LibraryAccessorInterface {
  use LibraryAccessorTrait, DependencyAccessorTrait {
    LibraryAccessorTrait::getLibrary insteadof DependencyAccessorTrait;
    DependencyAccessorTrait::getLibrary as libraryAccessor;
  }

  /**
   * Constructs a library exception.
   *
   * @param \Drupal\libraries\ExternalLibrary\LibraryInterface $library
   *   The library with the invalid dependency.
   * @param \Drupal\libraries\ExternalLibrary\LibraryInterface $dependency
   *   The dependency.
   * @param string $message
   *   (optional) The exception message.
   * @param int $code
   *   (optional) The error code.
   * @param \Exception $previous
   *   (optional) The previous exception.
   */
  public function __construct(LibraryInterface $library, LibraryInterface $dependency, $message = '', $code = 0, \Exception $previous = NULL) {
    $this->library = $library;
    $this->dependency = $dependency;
    $message = $message ?: "The library '{$this->library->getId()}' cannot depend on the library '{$this->dependency->getId()}'.";
    parent::__construct($message, $code, $previous);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InvalidLibraryDependencyException::__construct public function Constructs a library exception.
LibraryAccessorInterface::getLibrary public function Returns the library.
LibraryAccessorTrait::$library protected property The library.
LibraryAccessorTrait::getLibrary public function Returns the library. Aliased as: libraryAccessor