@@ -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,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; |
@@ -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 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | * @param LoggerInterface $logger |
46 | 46 | * @throws Exception An exception if an unknown storage is requested. |
47 | 47 | */ |
48 | - public static function getStorage($type="dummy", $options=array(), LoggerInterface $logger) |
|
48 | + public static function getStorage($type = "dummy", $options = array(), LoggerInterface $logger) |
|
49 | 49 | { |
50 | 50 | switch ($type) { |
51 | 51 | case "dummy": |
@@ -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 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * a state storage instance of a certain type. |
61 | 61 | * @param array $options An array of options for the state storage |
62 | 62 | */ |
63 | - public function __construct($options=array(), LoggerInterface $logger) |
|
63 | + public function __construct($options = array(), LoggerInterface $logger) |
|
64 | 64 | { |
65 | 65 | $this->logger = $logger; |
66 | 66 | $this->_options = $options; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function autoload($className) { |
26 | - if($className === NULL) { |
|
26 | + if ($className === NULL) { |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | $substr5 = substr($className, 0, 5); |
33 | 33 | |
34 | 34 | if ($substr5 === 'Tiqr_' || $substr5 === 'OATH_') { |
35 | - $file = $self->tiqrPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
35 | + $file = $self->tiqrPath.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; |
|
36 | 36 | } elseif ($className === 'QRcode') { |
37 | - $file = $self->qrcodePath . DIRECTORY_SEPARATOR . 'qrlib.php'; |
|
37 | + $file = $self->qrcodePath.DIRECTORY_SEPARATOR.'qrlib.php'; |
|
38 | 38 | } elseif ($substr5 === 'Zend_') { |
39 | - $file = $self->zendPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; |
|
39 | + $file = $self->zendPath.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; |
|
40 | 40 | } elseif ($className === 'ReadWriteException') { |
41 | - $file = $self->tiqrPath . DIRECTORY_SEPARATOR . 'Tiqr/Exception/ReadWriteException.php'; |
|
41 | + $file = $self->tiqrPath.DIRECTORY_SEPARATOR.'Tiqr/Exception/ReadWriteException.php'; |
|
42 | 42 | } else { |
43 | 43 | return; |
44 | 44 | } |
@@ -59,34 +59,34 @@ discard block |
||
59 | 59 | if (is_dir($tiqr_path)) { |
60 | 60 | $this->tiqrPath = $tiqr_path; |
61 | 61 | } else { |
62 | - throw new Exception('Directory not found: ' . var_export($tiqr_dir, TRUE)); |
|
62 | + throw new Exception('Directory not found: '.var_export($tiqr_dir, TRUE)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if (isset($options["phpqrcode.path"])) { |
66 | 66 | $qrcode_dir = $options["phpqrcode.path"]; |
67 | 67 | $qrcode_path = realpath($qrcode_dir); |
68 | 68 | } else { |
69 | - $qrcode_dir = dirname(dirname(dirname(__FILE__))) . '/phpqrcode'; |
|
69 | + $qrcode_dir = dirname(dirname(dirname(__FILE__))).'/phpqrcode'; |
|
70 | 70 | $qrcode_path = $qrcode_dir; |
71 | 71 | } |
72 | 72 | |
73 | 73 | if (is_dir($qrcode_path)) { |
74 | 74 | $this->qrcodePath = $qrcode_path; |
75 | 75 | } else { |
76 | - throw new Exception('Directory not found: ' . var_export($qrcode_dir, TRUE)); |
|
76 | + throw new Exception('Directory not found: '.var_export($qrcode_dir, TRUE)); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if (isset($options["zend.path"])) { |
80 | 80 | $zend_dir = $options["zend.path"]; |
81 | 81 | $zend_path = realpath($zend_dir); |
82 | 82 | } else { |
83 | - $zend_dir = dirname(dirname(dirname(__FILE__))) . "/zend"; |
|
83 | + $zend_dir = dirname(dirname(dirname(__FILE__)))."/zend"; |
|
84 | 84 | $zend_path = $zend_dir; |
85 | 85 | } |
86 | 86 | if (is_dir($zend_path)) { |
87 | 87 | $this->zendPath = $zend_path; |
88 | 88 | } else { |
89 | - throw new Exception('Directory not found: ' . var_export($zend_dir, TRUE)); |
|
89 | + throw new Exception('Directory not found: '.var_export($zend_dir, TRUE)); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |