@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @var array |
| 12 | 12 | */ |
| 13 | - protected $jwt=array( |
|
| 13 | + protected $jwt = array( |
|
| 14 | 14 | 'using' => false, |
| 15 | 15 | 'UAPAY_pubkey' => '', |
| 16 | 16 | 'our_privkey' => '', |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | if (isset($options['jwt'])) |
| 28 | 28 | { |
| 29 | 29 | // using |
| 30 | - if ( ! isset($options['jwt']['using'])) |
|
| 30 | + if (!isset($options['jwt']['using'])) |
|
| 31 | 31 | { |
| 32 | 32 | throw new Exception\Data('parameter jwt/using is not specified'); |
| 33 | 33 | } |
| 34 | - if ( ! is_bool($options['jwt']['using'])) |
|
| 34 | + if (!is_bool($options['jwt']['using'])) |
|
| 35 | 35 | { |
| 36 | 36 | throw new Exception\Data('parameter jwt/using is incorrect'); |
| 37 | 37 | } |
| 38 | 38 | // using |
| 39 | - if ( ! isset($options['jwt']['UAPAY_pubkey'])) |
|
| 39 | + if (!isset($options['jwt']['UAPAY_pubkey'])) |
|
| 40 | 40 | { |
| 41 | 41 | throw new Exception\Data('parameter jwt/UAPAY_pubkey is not specified'); |
| 42 | 42 | } |
| 43 | 43 | // using |
| 44 | - if ( ! isset($options['jwt']['our_privkey'])) |
|
| 44 | + if (!isset($options['jwt']['our_privkey'])) |
|
| 45 | 45 | { |
| 46 | 46 | throw new Exception\Data('parameter jwt/our_privkey is not specified'); |
| 47 | 47 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | protected function own_private_key() |
| 171 | 171 | { |
| 172 | 172 | // check private key file |
| 173 | - if ( ! file_exists($this->jwt['our_privkey'])) |
|
| 173 | + if (!file_exists($this->jwt['our_privkey'])) |
|
| 174 | 174 | { |
| 175 | 175 | throw new Exception\Runtime('The file with the private key was not find!'); |
| 176 | 176 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |