@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
| 12 | - protected $_apiUrl = "https://api.magestead.com/v1/usage"; |
|
| 12 | + protected $_apiUrl="https://api.magestead.com/v1/usage"; |
|
| 13 | 13 | // protected $_apiUrl = "http://magestead-api.app/v1/usage"; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * @var array |
| 17 | 17 | */ |
| 18 | - protected $_params = []; |
|
| 18 | + protected $_params=[]; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * UsageApi constructor. |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct($data) |
| 25 | 25 | { |
| 26 | - $this->_params['os_type'] = urlencode($data['os']); |
|
| 27 | - $this->_params['server_type'] = urlencode($data['server']); |
|
| 28 | - $this->_params['php_version'] = urlencode($data['phpver']); |
|
| 29 | - $this->_params['application_version'] = urlencode($data['app']); |
|
| 30 | - $this->_params['vm_memory_limit'] = urlencode($data['memory_limit']); |
|
| 31 | - $this->_params['vm_cpu_count'] = urlencode($data['cpus']); |
|
| 32 | - $this->_params['ip_address'] = urlencode($data['ip_address']); |
|
| 33 | - $this->_params['box'] = urlencode($data['box']); |
|
| 34 | - $this->_params['locale'] = urlencode($data['locale']); |
|
| 35 | - $this->_params['default_currency'] = urlencode($data['default_currency']); |
|
| 26 | + $this->_params['os_type']=urlencode($data['os']); |
|
| 27 | + $this->_params['server_type']=urlencode($data['server']); |
|
| 28 | + $this->_params['php_version']=urlencode($data['phpver']); |
|
| 29 | + $this->_params['application_version']=urlencode($data['app']); |
|
| 30 | + $this->_params['vm_memory_limit']=urlencode($data['memory_limit']); |
|
| 31 | + $this->_params['vm_cpu_count']=urlencode($data['cpus']); |
|
| 32 | + $this->_params['ip_address']=urlencode($data['ip_address']); |
|
| 33 | + $this->_params['box']=urlencode($data['box']); |
|
| 34 | + $this->_params['locale']=urlencode($data['locale']); |
|
| 35 | + $this->_params['default_currency']=urlencode($data['default_currency']); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -40,16 +40,16 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function send() |
| 42 | 42 | { |
| 43 | - $fields_string = $this->getFieldsString(); |
|
| 43 | + $fields_string=$this->getFieldsString(); |
|
| 44 | 44 | |
| 45 | - $ch = curl_init(); |
|
| 45 | + $ch=curl_init(); |
|
| 46 | 46 | |
| 47 | - curl_setopt($ch,CURLOPT_URL, $this->_apiUrl); |
|
| 48 | - curl_setopt($ch,CURLOPT_POST, count($this->_params)); |
|
| 49 | - curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); |
|
| 47 | + curl_setopt($ch, CURLOPT_URL, $this->_apiUrl); |
|
| 48 | + curl_setopt($ch, CURLOPT_POST, count($this->_params)); |
|
| 49 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); |
|
| 50 | 50 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 51 | 51 | |
| 52 | - $result = curl_exec($ch); |
|
| 52 | + $result=curl_exec($ch); |
|
| 53 | 53 | |
| 54 | 54 | curl_close($ch); |
| 55 | 55 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected function getFieldsString() |
| 62 | 62 | { |
| 63 | - $fields_string = ''; |
|
| 63 | + $fields_string=''; |
|
| 64 | 64 | foreach ($this->_params as $key => $value) { |
| 65 | - $fields_string .= $key . '=' . $value . '&'; |
|
| 65 | + $fields_string.=$key.'='.$value.'&'; |
|
| 66 | 66 | } |
| 67 | 67 | rtrim($fields_string, '&'); |
| 68 | 68 | return $fields_string; |