@@ -90,7 +90,7 @@ |
||
90 | 90 | /** |
91 | 91 | * Always make sure to destroy Curl Resource |
92 | 92 | */ |
93 | - public function __destruct() { |
|
93 | + public function __destruct(){ |
|
94 | 94 | if ($this->status!==self::STATUS_CLOSED){ |
95 | 95 | curl_close($this->CurlRequest); |
96 | 96 | } |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | public function __construct($baseUrl,array $options = array()){ |
120 | 120 | $this->baseUrl = $baseUrl; |
121 | 121 | |
122 | - if (!empty($options)) { |
|
122 | + if (!empty($options)){ |
|
123 | 123 | $this->setOptions($options); |
124 | - }elseif(!$this->requiresOptions()){ |
|
124 | + } elseif(!$this->requiresOptions()){ |
|
125 | 125 | $this->configureURL(); |
126 | 126 | } |
127 | 127 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * @inheritdoc |
149 | 149 | */ |
150 | - public function setAuth($accessToken) { |
|
150 | + public function setAuth($accessToken){ |
|
151 | 151 | $this->accessToken = $accessToken; |
152 | 152 | return $this; |
153 | 153 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @inheritdoc |
157 | 157 | */ |
158 | - public function setUrl($url) { |
|
158 | + public function setUrl($url){ |
|
159 | 159 | $this->Url = $url; |
160 | 160 | return $this; |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * @inheritdoc |
165 | 165 | */ |
166 | - public function setRequest(RequestInterface $Request) { |
|
166 | + public function setRequest(RequestInterface $Request){ |
|
167 | 167 | $this->Request = $Request; |
168 | 168 | return $this; |
169 | 169 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * @inheritdoc |
173 | 173 | */ |
174 | - public function setResponse(ResponseInterface $Response) { |
|
174 | + public function setResponse(ResponseInterface $Response){ |
|
175 | 175 | $this->Response = $Response; |
176 | 176 | return $this; |
177 | 177 | } |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | public function execute($data = NULL){ |
222 | 222 | $data = ($data === NULL?$this->Data:$data); |
223 | 223 | $this->configureData($data); |
224 | - if ($this->verifyOptions() && is_object($this->Request)) { |
|
224 | + if ($this->verifyOptions() && is_object($this->Request)){ |
|
225 | 225 | $this->configureRequest(); |
226 | 226 | $this->Request->send(); |
227 | - }else{ |
|
227 | + } else{ |
|
228 | 228 | throw new InvalidRequestException(get_called_class(),"Request property not configured"); |
229 | 229 | } |
230 | 230 | return $this; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * @inheritdoc |
235 | 235 | */ |
236 | - public function authRequired() { |
|
236 | + public function authRequired(){ |
|
237 | 237 | return $this->_AUTH_REQUIRED; |
238 | 238 | } |
239 | 239 | |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | * @throws RequiredDataException |
244 | 244 | */ |
245 | 245 | protected function configureRequest(){ |
246 | - if ($this->verifyUrl()) { |
|
246 | + if ($this->verifyUrl()){ |
|
247 | 247 | $this->Request->setURL($this->Url); |
248 | 248 | } |
249 | - if ($this->verifyData() && !empty($this->Data)) { |
|
249 | + if ($this->verifyData() && !empty($this->Data)){ |
|
250 | 250 | $this->Request->setBody($this->Data); |
251 | 251 | } |
252 | 252 | $this->configureAuth(); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * Configures the authentication header on the Request object |
257 | 257 | */ |
258 | 258 | protected function configureAuth(){ |
259 | - if ($this->authRequired()) { |
|
259 | + if ($this->authRequired()){ |
|
260 | 260 | $this->Request->addHeader('OAuth-Token', $this->accessToken); |
261 | 261 | } |
262 | 262 | } |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | */ |
294 | 294 | protected function configureURL(){ |
295 | 295 | $url = $this->_URL; |
296 | - if ($this->requiresOptions()) { |
|
296 | + if ($this->requiresOptions()){ |
|
297 | 297 | $urlParts = explode("/", $this->_URL); |
298 | 298 | $o = 0; |
299 | - foreach ($urlParts as $key => $part) { |
|
300 | - if (strpos($part, "$") !== FALSE) { |
|
301 | - if (isset($this->Options[$o])) { |
|
299 | + foreach ($urlParts as $key => $part){ |
|
300 | + if (strpos($part, "$") !== FALSE){ |
|
301 | + if (isset($this->Options[$o])){ |
|
302 | 302 | $urlParts[$key] = $this->Options[$o]; |
303 | 303 | $o++; |
304 | 304 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @throws RequiredDataException |
345 | 345 | */ |
346 | 346 | protected function verifyData(){ |
347 | - if (isset($this->_DATA_TYPE)||!empty($this->_DATA_TYPE)) { |
|
347 | + if (isset($this->_DATA_TYPE)||!empty($this->_DATA_TYPE)){ |
|
348 | 348 | $this->verifyDataType(); |
349 | 349 | } |
350 | 350 | if (!empty($this->_REQUIRED_DATA)){ |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @throws RequiredDataException |
360 | 360 | */ |
361 | 361 | protected function verifyDataType(){ |
362 | - if (gettype($this->Data) !== $this->_DATA_TYPE) { |
|
362 | + if (gettype($this->Data) !== $this->_DATA_TYPE){ |
|
363 | 363 | throw new RequiredDataException(get_called_class(),"Valid DataType is {$this->_DATA_TYPE}"); |
364 | 364 | } |
365 | 365 | return true; |
@@ -12,21 +12,17 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class HelpersTest extends \PHPUnit_Framework_TestCase { |
14 | 14 | |
15 | - public static function setUpBeforeClass() |
|
16 | - { |
|
15 | + public static function setUpBeforeClass(){ |
|
17 | 16 | } |
18 | 17 | |
19 | - public static function tearDownAfterClass() |
|
20 | - { |
|
18 | + public static function tearDownAfterClass(){ |
|
21 | 19 | } |
22 | 20 | |
23 | - public function setUp() |
|
24 | - { |
|
21 | + public function setUp(){ |
|
25 | 22 | parent::setUp(); |
26 | 23 | } |
27 | 24 | |
28 | - public function tearDown() |
|
29 | - { |
|
25 | + public function tearDown(){ |
|
30 | 26 | parent::tearDown(); |
31 | 27 | } |
32 | 28 | |
@@ -35,8 +31,7 @@ discard block |
||
35 | 31 | * @covers ::configureAPIURL |
36 | 32 | * @group default |
37 | 33 | */ |
38 | - public function testConfigureAPIUrl() |
|
39 | - { |
|
34 | + public function testConfigureAPIUrl(){ |
|
40 | 35 | $this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('localhost')); |
41 | 36 | $this->assertEquals('https://localhost/rest/v10/',Helpers::configureAPIURL('https://localhost')); |
42 | 37 | $this->assertEquals('http://localhost/rest/v10/',Helpers::configureAPIURL('localhost/rest/v10')); |
@@ -53,8 +48,7 @@ discard block |
||
53 | 48 | * @covers ::getSDKVersion |
54 | 49 | * @group default |
55 | 50 | */ |
56 | - public function testGetSDKVersion() |
|
57 | - { |
|
51 | + public function testGetSDKVersion(){ |
|
58 | 52 | $this->assertEquals('1.0',Helpers::getSDKVersion()); |
59 | 53 | } |
60 | 54 |
@@ -13,12 +13,10 @@ discard block |
||
13 | 13 | class SugarAPITest extends \PHPUnit_Framework_TestCase { |
14 | 14 | |
15 | 15 | |
16 | - public static function setUpBeforeClass() |
|
17 | - { |
|
16 | + public static function setUpBeforeClass(){ |
|
18 | 17 | } |
19 | 18 | |
20 | - public static function tearDownAfterClass() |
|
21 | - { |
|
19 | + public static function tearDownAfterClass(){ |
|
22 | 20 | } |
23 | 21 | |
24 | 22 | protected $SugarAPI; |
@@ -31,14 +29,12 @@ discard block |
||
31 | 29 | ); |
32 | 30 | |
33 | 31 | |
34 | - public function setUp() |
|
35 | - { |
|
32 | + public function setUp(){ |
|
36 | 33 | $this->SugarAPI = new SugarAPI(); |
37 | 34 | parent::setUp(); |
38 | 35 | } |
39 | 36 | |
40 | - public function tearDown() |
|
41 | - { |
|
37 | + public function tearDown(){ |
|
42 | 38 | unset($this->SugarAPI); |
43 | 39 | parent::tearDown(); |
44 | 40 | } |
@@ -48,8 +44,7 @@ discard block |
||
48 | 44 | * @covers ::setCredentials |
49 | 45 | * @group sugarapi |
50 | 46 | */ |
51 | - public function testSetCredentials() |
|
52 | - { |
|
47 | + public function testSetCredentials(){ |
|
53 | 48 | $this->SugarAPI->setCredentials(array('username' => 'admin')); |
54 | 49 | $this->assertEquals(array( |
55 | 50 | 'username' => 'admin', |
@@ -18,12 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class AbstractEntryPointTest extends \PHPUnit_Framework_TestCase { |
20 | 20 | |
21 | - public static function setUpBeforeClass() |
|
22 | - { |
|
21 | + public static function setUpBeforeClass(){ |
|
23 | 22 | } |
24 | 23 | |
25 | - public static function tearDownAfterClass() |
|
26 | - { |
|
24 | + public static function tearDownAfterClass(){ |
|
27 | 25 | } |
28 | 26 | |
29 | 27 | protected $Stub; |
@@ -33,13 +31,11 @@ discard block |
||
33 | 31 | 'foo' => 'bar' |
34 | 32 | ); |
35 | 33 | |
36 | - public function setUp() |
|
37 | - { |
|
34 | + public function setUp(){ |
|
38 | 35 | parent::setUp(); |
39 | 36 | } |
40 | 37 | |
41 | - public function tearDown() |
|
42 | - { |
|
38 | + public function tearDown(){ |
|
43 | 39 | parent::tearDown(); |
44 | 40 | } |
45 | 41 |