@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | print_r($response); |
14 | 14 | |
15 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
15 | +} catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
16 | 16 | print $ex->getMessage(); |
17 | 17 | } |
18 | 18 |
@@ -21,18 +21,18 @@ |
||
21 | 21 | if ($response->getStatus()=='200'){ |
22 | 22 | $record = $response->getBody(); |
23 | 23 | print_r($response); |
24 | - }else{ |
|
24 | + } else{ |
|
25 | 25 | print_r($upload->getRequest()); |
26 | 26 | echo "Failed to Update Note with File<br>"; |
27 | 27 | echo "Response: ".$response->getStatus()."<br>"; |
28 | 28 | print_r($response->getBody()); |
29 | 29 | } |
30 | - }else{ |
|
30 | + } else{ |
|
31 | 31 | echo "Failed to create Note<br>"; |
32 | 32 | echo "Response: ".$response->getStatus()."<br>"; |
33 | 33 | print_r($response->getBody()); |
34 | 34 | } |
35 | 35 | |
36 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
36 | +} catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
37 | 37 | print $ex->getMessage(); |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -39,31 +39,31 @@ |
||
39 | 39 | $response = $deleteRecord->getResponse()->getBody(); |
40 | 40 | echo "Deleted Record <br>"; |
41 | 41 | print_r($response); |
42 | - }else{ |
|
42 | + } else{ |
|
43 | 43 | echo "Failed to Delete record<br>"; |
44 | 44 | echo "Response: ".$response->getStatus()."<br>"; |
45 | 45 | print_r($response->getBody()); |
46 | 46 | } |
47 | - }else{ |
|
47 | + } else{ |
|
48 | 48 | print_r($updateRecord->getRequest()); |
49 | 49 | echo "Failed to Update record<br>"; |
50 | 50 | echo "Response: ".$response->getStatus()."<br>"; |
51 | 51 | print_r($response->getBody()); |
52 | 52 | } |
53 | - }else{ |
|
53 | + } else{ |
|
54 | 54 | echo "Failed to retrieve record<br>"; |
55 | 55 | echo "Response: ".$response->getStatus()."<br>"; |
56 | 56 | print_r($response->getBody()); |
57 | 57 | } |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | echo "Response: ".$response->getStatus(); |
60 | 60 | print_r($response->getBody()); |
61 | 61 | } |
62 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
62 | +} catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
63 | 63 | echo "Auth Options:<pre>"; |
64 | 64 | print_r($SugarAPI->getAuthOptions()); |
65 | 65 | echo "</pre> Error Message: "; |
66 | 66 | print $ex->getMessage(); |
67 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
67 | +} catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
68 | 68 | echo $ex->__toString(); |
69 | 69 | } |
@@ -19,6 +19,6 @@ |
||
19 | 19 | print_r($getResponse->getBody()); |
20 | 20 | } |
21 | 21 | |
22 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
22 | +} catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
23 | 23 | print $ex->getMessage(); |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -14,12 +14,12 @@ |
||
14 | 14 | echo "File downloaded to ".$response->file(); |
15 | 15 | } |
16 | 16 | |
17 | - }else{ |
|
17 | + } else{ |
|
18 | 18 | echo "Failed to retrieve Note<br>"; |
19 | 19 | echo "Response: ".$response->getStatus()."<br>"; |
20 | 20 | print_r($response->getBody()); |
21 | 21 | } |
22 | 22 | |
23 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
23 | +} catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
24 | 24 | print $ex->getMessage(); |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * Overrides POST setBody, so that Body is not json encoded |
17 | 17 | * @inheritdoc |
18 | 18 | */ |
19 | - public function setBody(array $body) { |
|
19 | + public function setBody(array $body){ |
|
20 | 20 | $this->body = $body; |
21 | 21 | $this->setOption(CURLOPT_POSTFIELDS,$this->body); |
22 | 22 | return $this; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Request\Abstracts\AbstractRequest; |
6 | 6 | |
7 | -class POST extends AbstractRequest{ |
|
7 | +class POST extends AbstractRequest { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @inheritdoc |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * JSON Encode Body |
33 | 33 | * @inheritdoc |
34 | 34 | */ |
35 | - public function setBody($body) { |
|
35 | + public function setBody($body){ |
|
36 | 36 | return parent::setBody(json_encode($body)); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Request\Interfaces\RequestInterface; |
6 | 6 | |
7 | -abstract class AbstractRequest implements RequestInterface{ |
|
7 | +abstract class AbstractRequest implements RequestInterface { |
|
8 | 8 | |
9 | 9 | const STATUS_INIT = 'initialized'; |
10 | 10 | const STATUS_SENT = 'sent'; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * @inheritdoc |
91 | 91 | */ |
92 | - public function setURL($url) { |
|
92 | + public function setURL($url){ |
|
93 | 93 | $this->url = $url; |
94 | 94 | $this->setOption(CURLOPT_URL,$this->url); |
95 | 95 | return $this; |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @inheritdoc |
100 | 100 | */ |
101 | - public function getURL() { |
|
101 | + public function getURL(){ |
|
102 | 102 | return $this->url; |
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | 106 | * @inheritdoc |
107 | 107 | */ |
108 | - public function addHeader($name, $value) { |
|
108 | + public function addHeader($name, $value){ |
|
109 | 109 | $token = $name.": ".$value; |
110 | 110 | $this->headers[] = $token; |
111 | 111 | return $this; |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @inheritdoc |
116 | 116 | */ |
117 | - public function setHeaders(array $array = array()) { |
|
118 | - if (count($array)>0) { |
|
119 | - foreach ($array as $key => $value) { |
|
117 | + public function setHeaders(array $array = array()){ |
|
118 | + if (count($array)>0){ |
|
119 | + foreach ($array as $key => $value){ |
|
120 | 120 | $this->addHeader($key, $value); |
121 | 121 | } |
122 | 122 | } |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | /** |
128 | 128 | * @inheritdoc |
129 | 129 | */ |
130 | - public function getHeaders() { |
|
130 | + public function getHeaders(){ |
|
131 | 131 | return $this->headers; |
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | 135 | * @inheritdoc |
136 | 136 | */ |
137 | - public function setBody(array $body) { |
|
137 | + public function setBody(array $body){ |
|
138 | 138 | $this->body = $body; |
139 | 139 | $this->setOption(CURLOPT_POSTFIELDS, $this->body); |
140 | 140 | return $this; |
@@ -143,28 +143,28 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * @inheritdoc |
145 | 145 | */ |
146 | - public function getBody() { |
|
146 | + public function getBody(){ |
|
147 | 147 | return $this->body; |
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * @inheritdoc |
152 | 152 | */ |
153 | - public function getCurlObject() { |
|
153 | + public function getCurlObject(){ |
|
154 | 154 | return $this->CurlRequest; |
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | 158 | * @inheritdoc |
159 | 159 | */ |
160 | - public function setOption($option, $value) { |
|
160 | + public function setOption($option, $value){ |
|
161 | 161 | curl_setopt($this->CurlRequest, $option, $value); |
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | 165 | * @inheritdoc |
166 | 166 | */ |
167 | - public function send() { |
|
167 | + public function send(){ |
|
168 | 168 | $this->setHeaders(); |
169 | 169 | $this->CurlResponse = curl_exec($this->CurlRequest); |
170 | 170 | $this->status = self::STATUS_SENT; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | /** |
200 | 200 | * @inheritdoc |
201 | 201 | */ |
202 | - public function start() { |
|
202 | + public function start(){ |
|
203 | 203 | $this->CurlRequest = curl_init(); |
204 | 204 | $this->status = self::STATUS_INIT; |
205 | 205 | return $this; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * @inheritdoc |
220 | 220 | */ |
221 | - public function getCurlStatus() { |
|
221 | + public function getCurlStatus(){ |
|
222 | 222 | return $this->status; |
223 | 223 | } |
224 | 224 | } |
225 | 225 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Request\Abstracts\AbstractRequest; |
6 | 6 | |
7 | -class PUT extends AbstractRequest{ |
|
7 | +class PUT extends AbstractRequest { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @inheritdoc |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * JSON Encode Body |
33 | 33 | * @inheritdoc |
34 | 34 | */ |
35 | - public function setBody(array $body) { |
|
35 | + public function setBody(array $body){ |
|
36 | 36 | return parent::setBody(json_encode($body)); |
37 | 37 | } |
38 | 38 |