Mercurial > hg > isophonics-drupal-site
annotate core/modules/media/src/OEmbed/ResourceException.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@17 | 1 <?php |
Chris@17 | 2 |
Chris@17 | 3 namespace Drupal\media\OEmbed; |
Chris@17 | 4 |
Chris@17 | 5 /** |
Chris@17 | 6 * Exception thrown if an oEmbed resource cannot be fetched or parsed. |
Chris@17 | 7 * |
Chris@17 | 8 * @internal |
Chris@17 | 9 * This is an internal part of the oEmbed system and should only be used by |
Chris@17 | 10 * oEmbed-related code in Drupal core. |
Chris@17 | 11 */ |
Chris@17 | 12 class ResourceException extends \Exception { |
Chris@17 | 13 |
Chris@17 | 14 /** |
Chris@17 | 15 * The URL of the resource. |
Chris@17 | 16 * |
Chris@17 | 17 * @var string |
Chris@17 | 18 */ |
Chris@17 | 19 protected $url; |
Chris@17 | 20 |
Chris@17 | 21 /** |
Chris@17 | 22 * The resource data. |
Chris@17 | 23 * |
Chris@17 | 24 * @var array |
Chris@17 | 25 */ |
Chris@17 | 26 protected $data = []; |
Chris@17 | 27 |
Chris@17 | 28 /** |
Chris@17 | 29 * ResourceException constructor. |
Chris@17 | 30 * |
Chris@17 | 31 * @param string $message |
Chris@17 | 32 * The exception message. |
Chris@17 | 33 * @param string $url |
Chris@17 | 34 * The URL of the resource. Can be the actual endpoint URL or the canonical |
Chris@17 | 35 * URL. |
Chris@17 | 36 * @param array $data |
Chris@17 | 37 * (optional) The raw resource data, if available. |
Chris@17 | 38 * @param \Exception $previous |
Chris@17 | 39 * (optional) The previous exception, if any. |
Chris@17 | 40 */ |
Chris@17 | 41 public function __construct($message, $url, array $data = [], \Exception $previous = NULL) { |
Chris@17 | 42 $this->url = $url; |
Chris@17 | 43 $this->data = $data; |
Chris@17 | 44 parent::__construct($message, 0, $previous); |
Chris@17 | 45 } |
Chris@17 | 46 |
Chris@17 | 47 /** |
Chris@17 | 48 * Gets the URL of the resource which caused the exception. |
Chris@17 | 49 * |
Chris@17 | 50 * @return string |
Chris@17 | 51 * The URL of the resource. |
Chris@17 | 52 */ |
Chris@17 | 53 public function getUrl() { |
Chris@17 | 54 return $this->url; |
Chris@17 | 55 } |
Chris@17 | 56 |
Chris@17 | 57 /** |
Chris@17 | 58 * Gets the raw resource data, if available. |
Chris@17 | 59 * |
Chris@17 | 60 * @return array |
Chris@17 | 61 * The resource data. |
Chris@17 | 62 */ |
Chris@17 | 63 public function getData() { |
Chris@17 | 64 return $this->data; |
Chris@17 | 65 } |
Chris@17 | 66 |
Chris@17 | 67 } |