Further modules included.
[yaffs-website] / web / modules / contrib / libraries / src / ExternalLibrary / Exception / LibraryNotInstalledException.php
1 <?php
2
3 namespace Drupal\libraries\ExternalLibrary\Exception;
4
5 use Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface;
6 use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorTrait;
7 use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorInterface;
8
9 /**
10  * Provides an exception for a library that is not installed.
11  */
12 class LibraryNotInstalledException extends \RuntimeException implements LibraryAccessorInterface {
13
14   use LibraryAccessorTrait;
15
16   /**
17    * Constructs a library exception.
18    *
19    * @param \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface $library
20    *   The library that is not installed.
21    * @param string $message
22    *   (optional) The exception message.
23    * @param int $code
24    *   (optional) The error code.
25    * @param \Exception $previous
26    *   (optional) The previous exception.
27    */
28   public function __construct(
29     LocalLibraryInterface $library,
30     $message = '',
31     $code = 0,
32     \Exception $previous = NULL
33   ) {
34     $this->library = $library;
35     $message = $message ?: "The library '{$this->library->getId()}' is not installed.";
36     parent::__construct($message, $code, $previous);
37   }
38
39 }