@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | private $settings = array(); |
13 | 13 | private $timeout = 2.0; |
14 | 14 | |
15 | - public function __construct(){ |
|
15 | + public function __construct() { |
|
16 | 16 | $this->initSettings(); |
17 | 17 | $this->client = new Client($this->settings); |
18 | 18 | } |
19 | 19 | |
20 | - public function validate($xml, $xsd){ |
|
20 | + public function validate($xml, $xsd) { |
|
21 | 21 | $result = null; |
22 | 22 | |
23 | 23 | try { |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | return $result; |
49 | 49 | } |
50 | 50 | |
51 | - private function initSettings(){ |
|
52 | - $this->settings['base_uri'] = $this->getBaseUri(); |
|
53 | - $this->settings['timeout'] = $this->getTimeout(); |
|
51 | + private function initSettings() { |
|
52 | + $this->settings[ 'base_uri' ] = $this->getBaseUri(); |
|
53 | + $this->settings[ 'timeout' ] = $this->getTimeout(); |
|
54 | 54 | } |
55 | 55 | |
56 | - public function setTimeout($timeout){ |
|
56 | + public function setTimeout($timeout) { |
|
57 | 57 | $this->timeout = $timeout; |
58 | 58 | } |
59 | 59 | |
60 | - public function getTimeout(){ |
|
60 | + public function getTimeout() { |
|
61 | 61 | return $this->timeout; |
62 | 62 | } |
63 | 63 | |
64 | - public function getBaseUri(){ |
|
64 | + public function getBaseUri() { |
|
65 | 65 | return self::BASE_URI; |
66 | 66 | } |
67 | 67 |
@@ -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 | } |