@@ -17,7 +17,7 @@ |
||
17 | 17 | 'platform' |
18 | 18 | ); |
19 | 19 | |
20 | - public function data(array $data){ |
|
20 | + public function data(array $data) { |
|
21 | 21 | $data['grant_type'] = 'password'; |
22 | 22 | return parent::data($data); |
23 | 23 | } |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | $record_id = 'a887c75b-b89a-852e-8e67-56f1ccdee355'; |
6 | 6 | |
7 | -try{ |
|
8 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('localhost/ent77',array('username' => 'admin','password'=>'admin123')); |
|
7 | +try { |
|
8 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('localhost/ent77', array('username' => 'admin', 'password'=>'admin123')); |
|
9 | 9 | $SugarAPI->login(); |
10 | - $EP = $SugarAPI->favorite('Accounts',$record_id); |
|
10 | + $EP = $SugarAPI->favorite('Accounts', $record_id); |
|
11 | 11 | $response = $EP->execute()->getResponse()->getBody(); |
12 | 12 | |
13 | 13 | print_r($response); |
14 | 14 | |
15 | -}catch(\SugarAPI\SDK\Exception\AuthenticationError $ex){ |
|
15 | +}catch (\SugarAPI\SDK\Exception\AuthenticationError $ex) { |
|
16 | 16 | print $ex->getMessage(); |
17 | 17 | } |
18 | 18 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | ))->execute()->getResponse()->getBody(); |
16 | 16 | echo "Updated Record: ".$record->id; |
17 | 17 | |
18 | -}catch(\SugarAPI\SDK\Exception\AuthenticationError $ex){ |
|
18 | +} catch(\SugarAPI\SDK\Exception\AuthenticationError $ex){ |
|
19 | 19 | print $ex->getMessage(); |
20 | 20 | } |
21 | 21 |
@@ -4,30 +4,30 @@ |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Response\Interfaces\ResponseInterface; |
6 | 6 | |
7 | -abstract class AbstractResponse implements ResponseInterface{ |
|
7 | +abstract class AbstractResponse implements ResponseInterface { |
|
8 | 8 | |
9 | 9 | protected $headers; |
10 | 10 | protected $body; |
11 | 11 | protected $status; |
12 | 12 | |
13 | - public function __construct($curlResponse,$curlRequest){ |
|
14 | - $header_size = curl_getinfo($curlRequest,CURLINFO_HEADER_SIZE); |
|
13 | + public function __construct($curlResponse, $curlRequest) { |
|
14 | + $header_size = curl_getinfo($curlRequest, CURLINFO_HEADER_SIZE); |
|
15 | 15 | $this->headers = substr($curlResponse, 0, $header_size); |
16 | 16 | $this->body = json_decode(substr($curlResponse, $header_size)); |
17 | - $this->status = curl_getinfo($curlRequest,CURLINFO_HTTP_CODE); |
|
17 | + $this->status = curl_getinfo($curlRequest, CURLINFO_HTTP_CODE); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @inheritdoc |
22 | 22 | */ |
23 | - public function json(){ |
|
23 | + public function json() { |
|
24 | 24 | return json_encode($this->body); |
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @inheritdoc |
29 | 29 | */ |
30 | - public function getStatus(){ |
|
30 | + public function getStatus() { |
|
31 | 31 | return $this->status; |
32 | 32 | } |
33 | 33 |