@@ -4,63 +4,63 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DataslangApi { |
| 6 | 6 | |
| 7 | - const BASE_URI = 'http://api.dataslang.com'; |
|
| 7 | + const BASE_URI = 'http://api.dataslang.com'; |
|
| 8 | 8 | |
| 9 | - private $client = null; |
|
| 10 | - private $settings = array(); |
|
| 11 | - private $timeout = 2.0; |
|
| 9 | + private $client = null; |
|
| 10 | + private $settings = array(); |
|
| 11 | + private $timeout = 2.0; |
|
| 12 | 12 | |
| 13 | - public function __construct(){ |
|
| 14 | - $this->initSettings(); |
|
| 15 | - $this->client = new Client($this->settings); |
|
| 16 | - } |
|
| 13 | + public function __construct(){ |
|
| 14 | + $this->initSettings(); |
|
| 15 | + $this->client = new Client($this->settings); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function validate($xml, $xsd){ |
|
| 19 | - $result = null; |
|
| 18 | + public function validate($xml, $xsd){ |
|
| 19 | + $result = null; |
|
| 20 | 20 | |
| 21 | - try { |
|
| 21 | + try { |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | - // $response = $this->client->request('POST', '/validate', [ |
|
| 25 | - // 'form_params' => [ |
|
| 26 | - // 'field_name' => 'abc', |
|
| 27 | - // 'other_field' => '123', |
|
| 28 | - // 'nested_field' => [ |
|
| 29 | - // 'nested' => 'hello' |
|
| 30 | - // ] |
|
| 31 | - // ] |
|
| 32 | - // ]); |
|
| 24 | + // $response = $this->client->request('POST', '/validate', [ |
|
| 25 | + // 'form_params' => [ |
|
| 26 | + // 'field_name' => 'abc', |
|
| 27 | + // 'other_field' => '123', |
|
| 28 | + // 'nested_field' => [ |
|
| 29 | + // 'nested' => 'hello' |
|
| 30 | + // ] |
|
| 31 | + // ] |
|
| 32 | + // ]); |
|
| 33 | 33 | |
| 34 | - $response = $this->client->request('POST', '/validate', [ |
|
| 35 | - 'form_params' => [ |
|
| 36 | - 'parametro' => 'prova' |
|
| 37 | - ] |
|
| 38 | - ]); |
|
| 34 | + $response = $this->client->request('POST', '/validate', [ |
|
| 35 | + 'form_params' => [ |
|
| 36 | + 'parametro' => 'prova' |
|
| 37 | + ] |
|
| 38 | + ]); |
|
| 39 | 39 | |
| 40 | - $result = $res->getBody(); |
|
| 40 | + $result = $res->getBody(); |
|
| 41 | 41 | |
| 42 | - } catch (\Exception $e) { |
|
| 42 | + } catch (\Exception $e) { |
|
| 43 | 43 | |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return $result; |
|
| 47 | - } |
|
| 46 | + return $result; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - private function initSettings(){ |
|
| 50 | - $this->settings['base_uri'] = $this->getBaseUri(); |
|
| 51 | - $this->settings['timeout'] = $this->getTimeout(); |
|
| 52 | - } |
|
| 49 | + private function initSettings(){ |
|
| 50 | + $this->settings['base_uri'] = $this->getBaseUri(); |
|
| 51 | + $this->settings['timeout'] = $this->getTimeout(); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function setTimeout($timeout){ |
|
| 55 | - $this->timeout = $timeout; |
|
| 56 | - } |
|
| 54 | + public function setTimeout($timeout){ |
|
| 55 | + $this->timeout = $timeout; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function getTimeout(){ |
|
| 59 | - return $this->timeout; |
|
| 60 | - } |
|
| 58 | + public function getTimeout(){ |
|
| 59 | + return $this->timeout; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function getBaseUri(){ |
|
| 63 | - return self::BASE_URI; |
|
| 64 | - } |
|
| 62 | + public function getBaseUri(){ |
|
| 63 | + return self::BASE_URI; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | } |