Completed
Push — master ( 636f13...7ce75f )
by Dmitry
02:00
created
src/Orders/Create/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      *      @param string $value
38 38
      *      @return string
39 39
      */
40
-    public function sessionId($value=null)
40
+    public function sessionId($value = null)
41 41
     {
42 42
         if ($value !== null)
43 43
         {
Please login to merge, or discard this patch.
src/Orders/Cancel/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      *      @param string $value
43 43
      *      @return string
44 44
      */
45
-    public function sessionId($value=null)
45
+    public function sessionId($value = null)
46 46
     {
47 47
         if ($value !== null)
48 48
         {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      *      @param string $value
59 59
      *      @return string
60 60
      */
61
-    public function id($value=null)
61
+    public function id($value = null)
62 62
     {
63 63
         if ($value !== null)
64 64
         {
Please login to merge, or discard this patch.
src/Orders/Show/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      *      @param string $value
38 38
      *      @return string
39 39
      */
40
-    public function id($value=null)
40
+    public function id($value = null)
41 41
     {
42 42
         if ($value !== null)
43 43
         {
Please login to merge, or discard this patch.
src/Sessions/Create/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      *      @param string $value
43 43
      *      @return string
44 44
      */
45
-    public function clientId($value=null)
45
+    public function clientId($value = null)
46 46
     {
47 47
         if ($value !== null)
48 48
         {
Please login to merge, or discard this patch.
src/Reports/Client/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      *      @param string $value
38 38
      *      @return string
39 39
      */
40
-    public function sessionId($value=null)
40
+    public function sessionId($value = null)
41 41
     {
42 42
         if ($value !== null)
43 43
         {
Please login to merge, or discard this patch.
src/Response.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,8 +139,7 @@
 block discarded – undo
139 139
         try
140 140
         {
141 141
             $decoded = (array) JWT::decode($token, $this->uapay_public_key(), array('RS512'));
142
-        }
143
-        catch (\Exception $e)
142
+        } catch (\Exception $e)
144 143
         {
145 144
             Log::instance()->error($e->getMessage().PHP_EOL.$e->getTraceAsString());
146 145
             throw new Exception\JSON('unable to decode JWT token', $e);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     /**
17 17
      *      @var array
18 18
      */
19
-    protected $jwt=array(
19
+    protected $jwt = array(
20 20
         'using'         => false,
21 21
         'UAPAY_pubkey'  => '',
22 22
         'our_privkey'   => '',
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      *      @param string $json_string JSON string
34 34
      *      @param array $jwt_options array of options
35 35
      */
36
-    public function __construct($json_string, $jwt_options=null)
36
+    public function __construct($json_string, $jwt_options = null)
37 37
     {
38 38
         if (isset($jwt_options) && is_array($jwt_options))
39 39
         {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         if ($this->jwt['using'] === true)
79 79
         {
80
-            if ( ! isset($this->json['data']['token']))
80
+            if (!isset($this->json['data']['token']))
81 81
             {
82 82
                 throw new Exception\JSON('data does not contain the token field!');
83 83
             }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     protected function get_status()
108 108
     {
109
-        if ( ! isset($this->json['status']))
109
+        if (!isset($this->json['status']))
110 110
         {
111 111
             throw new Exception\JSON('invalid json response!');
112 112
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     protected function check_if_data()
126 126
     {
127
-        if ( ! isset($this->json['data']) || !is_array($this->json['data']))
127
+        if (!isset($this->json['data']) || !is_array($this->json['data']))
128 128
         {
129 129
             throw new Exception\JSON('json does not contain the data field!');
130 130
         }
Please login to merge, or discard this patch.
src/Callback.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      *
38 38
      *      @param array $jwt_options array of options
39 39
      */
40
-    public function __construct($options=null)
40
+    public function __construct($options = null)
41 41
     {
42 42
         $jo = new JWTOptions($options);
43 43
         parent::__construct($this->get_http_raw_post_data(), $jo->get());
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function get_http_raw_post_data()
60 60
     {
61
-        Log::instance()->add('callback request from ' . $_SERVER['REMOTE_ADDR']);
61
+        Log::instance()->add('callback request from '.$_SERVER['REMOTE_ADDR']);
62 62
 
63 63
         $raw_request = file_get_contents('php://input');
64 64
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         if ($this->jwt['using'] === true)
85 85
         {
86
-            if ( ! isset($this->json['token']))
86
+            if (!isset($this->json['token']))
87 87
             {
88 88
                 throw new Exception\JSON('json does not contain the token field!');
89 89
             }
Please login to merge, or discard this patch.
src/Request.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     /**
17 17
      *      @var array
18 18
      */
19
-    protected $jwt=array(
19
+    protected $jwt = array(
20 20
         'using'         => false,
21 21
         'UAPAY_pubkey'  => '',
22 22
         'our_privkey'   => '',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function __construct($options)
37 37
     {
38 38
         // api_url
39
-        if ( ! isset($options['api_uri']))
39
+        if (!isset($options['api_uri']))
40 40
         {
41 41
             throw new Exception\Data('parameter api_uri is not specified');
42 42
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *      @param array $value
58 58
      *      @return array
59 59
      */
60
-    public function data($value=null)
60
+    public function data($value = null)
61 61
     {
62 62
         if ($value !== null)
63 63
         {
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
      *      @param mixed $value
74 74
      *      @return string
75 75
      */
76
-    protected function as_string($value=null)
76
+    protected function as_string($value = null)
77 77
     {
78
-        return (is_scalar($value))?((is_bool($value))?(($value)?'true':'false'):"$value"):null;
78
+        return (is_scalar($value)) ? ((is_bool($value)) ? (($value) ? 'true' : 'false') : "$value") : null;
79 79
     }
80 80
 
81 81
     /**
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      *      @param mixed $value
85 85
      *      @return integer
86 86
      */
87
-    protected function as_int($value=null)
87
+    protected function as_int($value = null)
88 88
     {
89
-        return (is_int($value))?$value:null;
89
+        return (is_int($value)) ? $value : null;
90 90
     }
91 91
 
92 92
     /**
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
      *      @param mixed $value
96 96
      *      @return array
97 97
      */
98
-    protected function as_array($value=null)
98
+    protected function as_array($value = null)
99 99
     {
100
-        return (is_array($value))?$value:null;
100
+        return (is_array($value)) ? $value : null;
101 101
     }
102 102
 
103 103
     /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -199,8 +199,7 @@  discard block
 block discarded – undo
199 199
         try
200 200
         {
201 201
             $token = JWT::encode($payload, $this->own_private_key(), 'RS512');
202
-        }
203
-        catch (\Exception $e)
202
+        } catch (\Exception $e)
204 203
         {
205 204
             Log::instance()->error($e->getMessage().PHP_EOL.$e->getTraceAsString());
206 205
             throw new Exception\JSON('unable to create JWT token', $e);
@@ -229,8 +228,7 @@  discard block
 block discarded – undo
229 228
             $body = $httpresponse->getBody()->getContents();
230 229
             Log::instance()->debug('got response:'.PHP_EOL.$body);
231 230
             return new $this->response_class($body, $this->jwt);
232
-        }
233
-        catch (\GuzzleHttp\Exception\RequestException $e)
231
+        } catch (\GuzzleHttp\Exception\RequestException $e)
234 232
         {
235 233
             $this->handle_request_exception($e);
236 234
         }
Please login to merge, or discard this patch.
src/Key.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      */
29 29
     protected function check_exists($fname)
30 30
     {
31
-        if ( ! file_exists($fname))
31
+        if (!file_exists($fname))
32 32
         {
33 33
             throw new Exception\Runtime('not exists');
34 34
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
             $this->check_exists($fname);
23 23
 
24 24
             $key = $this->load($fname);
25
-        }
26
-        catch (\Exception $e)
25
+        } catch (\Exception $e)
27 26
         {
28 27
             throw new Exception\Runtime('The file with the '.$type.' key was '.$e->getMessage().'!');
29 28
         }
Please login to merge, or discard this patch.