PluginProbe
Brevo – Email, SMS, Web Push, Chat, and more. / 3.3.1
Brevo – Email, SMS, Web Push, Chat, and more. v3.3.1
2.9.13 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 All 140 releases
mailin / wonderpush-php-lib / lib / Errors / Base.php
Base.php
39 lines 958 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WonderPush\Errors;
4
5 if (count(get_included_files()) === 1) { http_response_code(403); exit(); } // Prevent direct access
6
7 /**
8 * Base class for WonderPush errors.
9 *
10 * The WonderPush API returns string error codes.
11 * This class exposes them as string, in addition to expose their parsed version with {@link getCode()}.
12 */
13 abstract class Base extends \Exception {
14
15 /**
16 * The default error message to use when none has been provided at construct time.
17 */
18 const DEFAULT_MESSAGE = '';
19
20 protected $codeStr;
21
22 public function __construct($message = '', $codeStr = '0', $previous = null) {
23 if ($message === '') {
24 $message = static::DEFAULT_MESSAGE;
25 }
26 parent::__construct($message, (int)$codeStr, $previous);
27 $this->codeStr = (string)$codeStr;
28 }
29
30 /**
31 * The code as is has been returned by the API, as a string.
32 * @return string
33 */
34 public function getCodeStr() {
35 return $this->codeStr;
36 }
37
38 }
39