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