Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / media / src / OEmbed / ResourceException.php
1 <?php
2
3 namespace Drupal\media\OEmbed;
4
5 /**
6  * Exception thrown if an oEmbed resource cannot be fetched or parsed.
7  *
8  * @internal
9  *   This is an internal part of the oEmbed system and should only be used by
10  *   oEmbed-related code in Drupal core.
11  */
12 class ResourceException extends \Exception {
13
14   /**
15    * The URL of the resource.
16    *
17    * @var string
18    */
19   protected $url;
20
21   /**
22    * The resource data.
23    *
24    * @var array
25    */
26   protected $data = [];
27
28   /**
29    * ResourceException constructor.
30    *
31    * @param string $message
32    *   The exception message.
33    * @param string $url
34    *   The URL of the resource. Can be the actual endpoint URL or the canonical
35    *   URL.
36    * @param array $data
37    *   (optional) The raw resource data, if available.
38    * @param \Exception $previous
39    *   (optional) The previous exception, if any.
40    */
41   public function __construct($message, $url, array $data = [], \Exception $previous = NULL) {
42     $this->url = $url;
43     $this->data = $data;
44     parent::__construct($message, 0, $previous);
45   }
46
47   /**
48    * Gets the URL of the resource which caused the exception.
49    *
50    * @return string
51    *   The URL of the resource.
52    */
53   public function getUrl() {
54     return $this->url;
55   }
56
57   /**
58    * Gets the raw resource data, if available.
59    *
60    * @return array
61    *   The resource data.
62    */
63   public function getData() {
64     return $this->data;
65   }
66
67 }