Completed
Push — master ( 8c6753...241042 )
by Daniele
02:26
created
src/Dataslang/DataslangApi.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -6,104 +6,104 @@
 block discarded – undo
6 6
 
7 7
 class DataslangApi {
8 8
 	
9
-	const BASE_URI = 'http://api.dataslang.com';
9
+    const BASE_URI = 'http://api.dataslang.com';
10 10
 	
11
-	private $client = null;
12
-	private $settings = array();
13
-	private $timeout = 7;
11
+    private $client = null;
12
+    private $settings = array();
13
+    private $timeout = 7;
14 14
 
15
-	public function validate($xml, $xsd){
16
-		$result = null;
15
+    public function validate($xml, $xsd){
16
+        $result = null;
17 17
 
18
-		try {
18
+        try {
19 19
 			
20
-			$client = $this->getClient();
21
-			$response = $client->request('POST', '/xml/validate', [
22
-				'form_params' => [
23
-					'xml' => urlencode($xml),
24
-					'xsd' => urlencode($xsd),
25
-					'response-type' => urlencode('txt')
26
-				]
27
-			]);
20
+            $client = $this->getClient();
21
+            $response = $client->request('POST', '/xml/validate', [
22
+                'form_params' => [
23
+                    'xml' => urlencode($xml),
24
+                    'xsd' => urlencode($xsd),
25
+                    'response-type' => urlencode('txt')
26
+                ]
27
+            ]);
28 28
 			
29
-			$result = $response->getBody();
29
+            $result = $response->getBody();
30 30
 			
31
-		} catch (\Exception $e) {
32
-			$result = $e->getMessage();
33
-		}
31
+        } catch (\Exception $e) {
32
+            $result = $e->getMessage();
33
+        }
34 34
 		
35
-		return $result;
36
-  	}
35
+        return $result;
36
+        }
37 37
   	
38
-  	public function transformToXml($xml, $xsl, $dest_path){
39
-  		$result = null;
38
+        public function transformToXml($xml, $xsl, $dest_path){
39
+            $result = null;
40 40
   		
41
-  		try {
41
+            try {
42 42
   				
43
-  			$client = $this->getClient();
44
-  			$response = $client->request('POST', '/xml/transform/xml', [
45
-  				'form_params' => [
46
-  					'xml' => urlencode($xml),
47
-  					'xsl' => urlencode($xsl),
48
-  					'dest_path' => urlencode($dest_path),
49
-  					'response-type' => urlencode('txt')
50
-  				]
51
-  			]);
43
+                $client = $this->getClient();
44
+                $response = $client->request('POST', '/xml/transform/xml', [
45
+                    'form_params' => [
46
+                        'xml' => urlencode($xml),
47
+                        'xsl' => urlencode($xsl),
48
+                        'dest_path' => urlencode($dest_path),
49
+                        'response-type' => urlencode('txt')
50
+                    ]
51
+                ]);
52 52
   				
53
-  			$result = $response->getBody();
53
+                $result = $response->getBody();
54 54
   				
55
-  		} catch (\Exception $e) {
56
-  			$result = $e->getMessage();
57
-  		}
55
+            } catch (\Exception $e) {
56
+                $result = $e->getMessage();
57
+            }
58 58
   		
59
-  		return $result;
60
-  	}
59
+            return $result;
60
+        }
61 61
   	
62
-  	public function transformToHtml($xml, $xsl, $dest_path){
63
-  		$result = null;
62
+        public function transformToHtml($xml, $xsl, $dest_path){
63
+            $result = null;
64 64
   		
65
-  		try {
65
+            try {
66 66
   		
67
-  			$client = $this->getClient();
68
-  			$response = $client->request('POST', '/xml/transform/html', [
69
-				'form_params' => [
70
-					'xml' => urlencode($xml),
71
-					'xsl' => urlencode($xsl),
72
-					'dest_path' => urlencode($dest_path),
73
-					'response-type' => urlencode('txt')
74
-				]
75
-  			]);
67
+                $client = $this->getClient();
68
+                $response = $client->request('POST', '/xml/transform/html', [
69
+                'form_params' => [
70
+                    'xml' => urlencode($xml),
71
+                    'xsl' => urlencode($xsl),
72
+                    'dest_path' => urlencode($dest_path),
73
+                    'response-type' => urlencode('txt')
74
+                ]
75
+                ]);
76 76
   		
77
-  			$result = $response->getBody();
77
+                $result = $response->getBody();
78 78
   		
79
-  		} catch (\Exception $e) {
80
-  			$result = $e->getMessage();
81
-  		}
79
+            } catch (\Exception $e) {
80
+                $result = $e->getMessage();
81
+            }
82 82
   		
83
-  		return $result;
84
-  	}
83
+            return $result;
84
+        }
85 85
   
86
-	public function setTimeout($timeout){
87
-		$this->timeout = $timeout;
88
-	}
86
+    public function setTimeout($timeout){
87
+        $this->timeout = $timeout;
88
+    }
89 89
 	
90
-	public function getTimeout(){
91
-		return $this->timeout;
92
-	}
90
+    public function getTimeout(){
91
+        return $this->timeout;
92
+    }
93 93
 	
94
-	public function getBaseUri(){
95
-		return self::BASE_URI;
96
-	}
94
+    public function getBaseUri(){
95
+        return self::BASE_URI;
96
+    }
97 97
 	
98
-	private function getClient(){
99
-		if ($this->client === null){
100
-			$settings = array();
101
-			$settings['base_uri'] = $this->getBaseUri();
102
-			$settings['timeout'] = $this->getTimeout();
98
+    private function getClient(){
99
+        if ($this->client === null){
100
+            $settings = array();
101
+            $settings['base_uri'] = $this->getBaseUri();
102
+            $settings['timeout'] = $this->getTimeout();
103 103
 		
104
-			$this->client = new Client($settings);
105
-		}
104
+            $this->client = new Client($settings);
105
+        }
106 106
 		
107
-		return $this->client;
108
-	}
107
+        return $this->client;
108
+    }
109 109
 }
Please login to merge, or discard this patch.