@@ -44,8 +44,11 @@ |
||
| 44 | 44 | $this->_client = new \GuzzleHttp\Client($token->getParameters(true)); |
| 45 | 45 | } else { |
| 46 | 46 | // TODO: Remove this in future releases |
| 47 | - if (!empty($token)) $this->token = $token; |
|
| 48 | - else $this->token = UON_API_TOKEN; |
|
| 47 | + if (!empty($token)) { |
|
| 48 | + $this->token = $token; |
|
| 49 | + } else { |
|
| 50 | + $this->token = UON_API_TOKEN; |
|
| 51 | + } |
|
| 49 | 52 | |
| 50 | 53 | // Store the client object |
| 51 | 54 | $this->_client = new \GuzzleHttp\Client(); |
@@ -57,8 +57,9 @@ discard block |
||
| 57 | 57 | $token = $this->config->get('token'); |
| 58 | 58 | |
| 59 | 59 | // Check if token is not available |
| 60 | - if (!isset($token)) |
|
| 61 | - throw new APIException("Token is not set"); |
|
| 60 | + if (!isset($token)) { |
|
| 61 | + throw new APIException("Token is not set"); |
|
| 62 | + } |
|
| 62 | 63 | |
| 63 | 64 | } catch (APIException $e) { |
| 64 | 65 | return false; |
@@ -72,8 +73,9 @@ discard block |
||
| 72 | 73 | $object = new $class($this->config); |
| 73 | 74 | |
| 74 | 75 | // If object is not created |
| 75 | - if (!is_object($object)) |
|
| 76 | - throw new APIException("Class $class could not to be created"); |
|
| 76 | + if (!is_object($object)) { |
|
| 77 | + throw new APIException("Class $class could not to be created"); |
|
| 78 | + } |
|
| 77 | 79 | |
| 78 | 80 | } catch (APIException $e) { |
| 79 | 81 | return false; |
@@ -57,7 +57,9 @@ |
||
| 57 | 57 | public function getDate($date_from, $date_to, $source_id = null) |
| 58 | 58 | { |
| 59 | 59 | $endpoint = '/lead/' . $date_from . '/' . $date_to; |
| 60 | - if (!empty($source_id)) $endpoint .= '/' . $source_id; |
|
| 60 | + if (!empty($source_id)) { |
|
| 61 | + $endpoint .= '/' . $source_id; |
|
| 62 | + } |
|
| 61 | 63 | return $this->doRequest('get', $endpoint); |
| 62 | 64 | } |
| 63 | 65 | |
@@ -124,7 +124,9 @@ |
||
| 124 | 124 | public function getDate($date_from, $date_to, $source_id = null) |
| 125 | 125 | { |
| 126 | 126 | $endpoint = '/request/' . $date_from . '/' . $date_to; |
| 127 | - if (!empty($source_id)) $endpoint .= '/' . $source_id; |
|
| 127 | + if (!empty($source_id)) { |
|
| 128 | + $endpoint .= '/' . $source_id; |
|
| 129 | + } |
|
| 128 | 130 | return $this->doRequest('get', $endpoint); |
| 129 | 131 | } |
| 130 | 132 | |
@@ -79,7 +79,9 @@ |
||
| 79 | 79 | $array = $this->parameters; |
| 80 | 80 | |
| 81 | 81 | // Remove "token" from array |
| 82 | - if ($ignore_token) unset($array['token']); |
|
| 82 | + if ($ignore_token) { |
|
| 83 | + unset($array['token']); |
|
| 84 | + } |
|
| 83 | 85 | |
| 84 | 86 | return $array; |
| 85 | 87 | } |
@@ -1,3 +1,4 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined("UON_API_TOKEN")) |
|
| 2 | +if (!defined("UON_API_TOKEN")) { |
|
| 3 | 3 | define("UON_API_TOKEN", "[YOUR_API_TOKEN]"); |
| 4 | +} |
|
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | $date = $uon->requests->getDate('2018-03-01', '2018-03-30'); |
| 20 | 20 | |
| 21 | 21 | // Get all requests from dates range, for some source id |
| 22 | -$dateSource = $uon->requests->getDate('2017-06-01', '2017-06-10','1'); |
|
| 22 | +$dateSource = $uon->requests->getDate('2017-06-01', '2017-06-10', '1'); |
|
| 23 | 23 | |
| 24 | 24 | // Data array of new user (or details for update) |
| 25 | 25 | $request = [ |
| 26 | - 'r_u_id' => '13', // Manager ID |
|
| 26 | + 'r_u_id' => '13', // Manager ID |
|
| 27 | 27 | 'u_name' => 'text user' // User's full name |
| 28 | 28 | ]; |
| 29 | 29 | |