PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.1.20
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.1.20
4.1.20 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 All 174 releases
searchpro / BerqWP / vendor-prefixed / vendor / guzzlehttp / promises / src / RejectionException.php

RejectionException.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 4.1.20, at BerqWP/vendor-prefixed/vendor/guzzlehttp/promises/src/RejectionException.php

42 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace BerqWP_Deps\GuzzleHttp\Promise;
5
6 /**
7 * A special exception that is thrown when waiting on a rejected promise.
8 *
9 * The reason value is available via the getReason() method.
10 */
11 class RejectionException extends \RuntimeException
12 {
13 /** @var mixed Rejection reason. */
14 private $reason;
15 /**
16 * @param mixed $reason Rejection reason.
17 * @param string|null $description Optional description.
18 */
19 public function __construct($reason, ?string $description = null)
20 {
21 $this->reason = $reason;
22 $message = 'The promise was rejected';
23 if ($description) {
24 $message .= ' with reason: ' . $description;
25 } elseif (is_string($reason) || is_object($reason) && method_exists($reason, '__toString')) {
26 $message .= ' with reason: ' . $this->reason;
27 } elseif ($reason instanceof \JsonSerializable) {
28 $message .= ' with reason: ' . json_encode($this->reason, \JSON_PRETTY_PRINT);
29 }
30 parent::__construct($message);
31 }
32 /**
33 * Returns the rejection reason.
34 *
35 * @return mixed
36 */
37 public function getReason()
38 {
39 return $this->reason;
40 }
41 }
42