PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 5.0.1
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v5.0.1
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
← All changes | freemius/includes/sdk/Exceptions/Exception.php +78 -78 2.5.0 → 5.0.1 View file →
@@ -1,78 +1,78 @@
1 -<?php
2 - if ( ! defined( 'ABSPATH' ) ) {
3 - exit;
4 - }
5 -
6 - if ( ! class_exists( 'Freemius_Exception' ) ) {
7 - /**
8 - * Thrown when an API call returns an exception.
9 - *
10 - */
11 - class Freemius_Exception extends Exception {
12 - protected $_result;
13 - protected $_type;
14 - protected $_code;
15 -
16 - /**
17 - * Make a new API Exception with the given result.
18 - *
19 - * @param array $result The result from the API server.
20 - */
21 - public function __construct( $result ) {
22 - $this->_result = $result;
23 -
24 - $code = 0;
25 - $message = 'Unknown error, please check GetResult().';
26 - $type = '';
27 -
28 - if ( isset( $result['error'] ) && is_array( $result['error'] ) ) {
29 - if ( isset( $result['error']['code'] ) ) {
30 - $code = $result['error']['code'];
31 - }
32 - if ( isset( $result['error']['message'] ) ) {
33 - $message = $result['error']['message'];
34 - }
35 - if ( isset( $result['error']['type'] ) ) {
36 - $type = $result['error']['type'];
37 - }
38 - }
39 -
40 - $this->_type = $type;
41 - $this->_code = $code;
42 -
43 - parent::__construct( $message, is_numeric( $code ) ? $code : 0 );
44 - }
45 -
46 - /**
47 - * Return the associated result object returned by the API server.
48 - *
49 - * @return array The result from the API server
50 - */
51 - public function getResult() {
52 - return $this->_result;
53 - }
54 -
55 - public function getStringCode() {
56 - return $this->_code;
57 - }
58 -
59 - public function getType() {
60 - return $this->_type;
61 - }
62 -
63 - /**
64 - * To make debugging easier.
65 - *
66 - * @return string The string representation of the error
67 - */
68 - public function __toString() {
69 - $str = $this->getType() . ': ';
70 -
71 - if ( $this->code != 0 ) {
72 - $str .= $this->getStringCode() . ': ';
73 - }
74 -
75 - return $str . $this->getMessage();
76 - }
77 - }
78 - }
1 +<?php
2 + if ( ! defined( 'ABSPATH' ) ) {
3 + exit;
4 + }
5 +
6 + if ( ! class_exists( 'Freemius_Exception' ) ) {
7 + /**
8 + * Thrown when an API call returns an exception.
9 + *
10 + */
11 + class Freemius_Exception extends Exception {
12 + protected $_result;
13 + protected $_type;
14 + protected $_code;
15 +
16 + /**
17 + * Make a new API Exception with the given result.
18 + *
19 + * @param array $result The result from the API server.
20 + */
21 + public function __construct( $result ) {
22 + $this->_result = $result;
23 +
24 + $code = 0;
25 + $message = 'Unknown error, please check GetResult().';
26 + $type = '';
27 +
28 + if ( isset( $result['error'] ) && is_array( $result['error'] ) ) {
29 + if ( isset( $result['error']['code'] ) ) {
30 + $code = $result['error']['code'];
31 + }
32 + if ( isset( $result['error']['message'] ) ) {
33 + $message = $result['error']['message'];
34 + }
35 + if ( isset( $result['error']['type'] ) ) {
36 + $type = $result['error']['type'];
37 + }
38 + }
39 +
40 + $this->_type = $type;
41 + $this->_code = $code;
42 +
43 + parent::__construct( $message, is_numeric( $code ) ? $code : 0 );
44 + }
45 +
46 + /**
47 + * Return the associated result object returned by the API server.
48 + *
49 + * @return array The result from the API server
50 + */
51 + public function getResult() {
52 + return $this->_result;
53 + }
54 +
55 + public function getStringCode() {
56 + return $this->_code;
57 + }
58 +
59 + public function getType() {
60 + return $this->_type;
61 + }
62 +
63 + /**
64 + * To make debugging easier.
65 + *
66 + * @return string The string representation of the error
67 + */
68 + public function __toString() {
69 + $str = $this->getType() . ': ';
70 +
71 + if ( $this->code != 0 ) {
72 + $str .= $this->getStringCode() . ': ';
73 + }
74 +
75 + return $str . $this->getMessage();
76 + }
77 + }
78 + }