@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function setBaseURL($apiBaseURL) |
27 | 27 | { |
28 | - $this->_apiBaseURL = rtrim($apiBaseURL, '/') . '/'; |
|
28 | + $this->_apiBaseURL = rtrim($apiBaseURL, '/').'/'; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | protected function callAPI($resource, $method = "GET", $data = array(), $headers = array()) |
79 | 79 | { |
80 | 80 | $ch = curl_init(); |
81 | - curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL . ltrim($resource, '/')); |
|
81 | + curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL.ltrim($resource, '/')); |
|
82 | 82 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
83 | 83 | |
84 | 84 | // Explicitly empty null values, because http_build_query will throw away |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $headerArray = array(); |
109 | 109 | foreach ($headers as $key => $value) { |
110 | - $headerArray[] = $key . ': ' . $value; |
|
110 | + $headerArray[] = $key.': '.$value; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @param boolean $temporary temporary failure? |
36 | 36 | * @param Exception $parent parent exception |
37 | 37 | */ |
38 | - public function __construct($message, $temporary=false, Exception $parent=null) |
|
38 | + public function __construct($message, $temporary = false, Exception $parent = null) |
|
39 | 39 | { |
40 | 40 | parent::__construct($message, $parent); |
41 | 41 | $this->_temporary = $temporary; |
@@ -29,8 +29,8 @@ |
||
29 | 29 | * @param string $message exception message |
30 | 30 | * @param Exception $parent parent exception |
31 | 31 | */ |
32 | - public function __construct($message, $parent=null) |
|
33 | - { |
|
34 | - parent::__construct($message, 0, $parent); |
|
35 | - } |
|
32 | + public function __construct($message, $parent=null) |
|
33 | + { |
|
34 | + parent::__construct($message, 0, $parent); |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param string $message exception message |
30 | 30 | * @param Exception $parent parent exception |
31 | 31 | */ |
32 | - public function __construct($message, $parent=null) |
|
32 | + public function __construct($message, $parent = null) |
|
33 | 33 | { |
34 | 34 | parent::__construct($message, 0, $parent); |
35 | 35 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @param boolean $temporary temporary failure? |
36 | 36 | * @param Exception $parent parent exception |
37 | 37 | */ |
38 | - public function __construct($message, $temporary=false, Exception $parent=null) |
|
38 | + public function __construct($message, $temporary = false, Exception $parent = null) |
|
39 | 39 | { |
40 | 40 | parent::__construct($message, $parent); |
41 | 41 | $this->_temporary = $temporary; |
@@ -97,9 +97,9 @@ |
||
97 | 97 | |
98 | 98 | // Wait and retry once in case of a 502 Bad Gateway error |
99 | 99 | if ($statusCode === 502 && !($retry)) { |
100 | - sleep(2); |
|
101 | - $this->_sendFirebase($deviceToken, $alert, $challenge, $apiKey, true); |
|
102 | - return; |
|
100 | + sleep(2); |
|
101 | + $this->_sendFirebase($deviceToken, $alert, $challenge, $apiKey, true); |
|
102 | + return; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | if ($statusCode !== 200) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @throws Tiqr_Message_Exception_SendFailure |
59 | 59 | */ |
60 | - private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry=false) |
|
60 | + private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry = false) |
|
61 | 61 | { |
62 | 62 | $msg = array( |
63 | 63 | 'challenge' => $challenge, |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ); |
72 | 72 | |
73 | 73 | $headers = array( |
74 | - 'Authorization: key=' . $apiKey, |
|
74 | + 'Authorization: key='.$apiKey, |
|
75 | 75 | 'Content-Type: application/json', |
76 | 76 | ); |
77 | 77 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $result = curl_exec($ch); |
85 | 85 | $errors = curl_error($ch); |
86 | 86 | $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
87 | - $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP); |
|
87 | + $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP); |
|
88 | 88 | curl_close($ch); |
89 | 89 | |
90 | 90 | if ($result === false) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | if (!empty($errors)) { |
95 | - throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true); |
|
95 | + throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // Wait and retry once in case of a 502 Bad Gateway error |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $response = json_decode($result, true); |
111 | 111 | foreach ($response['results'] as $k => $v) { |
112 | 112 | if (isset($v['error'])) { |
113 | - throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: " . $v['error'], true); |
|
113 | + throw new Tiqr_Message_Exception_SendFailure("Error in FCM response: ".$v['error'], true); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
@@ -41,15 +41,15 @@ |
||
41 | 41 | { |
42 | 42 | $url = $this->_options["url"]."?appId=".$this->_options["appid"]; |
43 | 43 | |
44 | - $url.= "¬ificationToken=".$notificationToken; |
|
44 | + $url .= "¬ificationToken=".$notificationToken; |
|
45 | 45 | |
46 | 46 | $output = file_get_contents($url); |
47 | - if (stripos($output, "not found")!==false) { |
|
47 | + if (stripos($output, "not found") !== false) { |
|
48 | 48 | $this->logger->error('Token Exchange failed and responded with: not found', ['full output' => $output]); |
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | |
52 | - if (stripos($output, "error")!==false) { |
|
52 | + if (stripos($output, "error") !== false) { |
|
53 | 53 | $this->logger->error('Token Exchange failed and responded with: error', ['full output' => $output]); |
54 | 54 | return false; |
55 | 55 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | public function encrypt($data); |
42 | 42 | |
43 | 43 | /** |
44 | - * Decrypts the given data. |
|
44 | + * Decrypts the given data. |
|
45 | 45 | * |
46 | 46 | * @param String $data Data to decrypt. |
47 | 47 | * |
@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Decrypts the given data. |
|
60 | + * Decrypts the given data. |
|
61 | 61 | * |
62 | 62 | * @param String $data Data to decrypt. |
63 | 63 | * |
@@ -57,7 +57,7 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | - * Decrypts the given data. |
|
60 | + * Decrypts the given data. |
|
61 | 61 | * |
62 | 62 | * @param String $data Data to decrypt. |
63 | 63 | * |