Completed
Push — master ( 15515b...fd48c6 )
by Mike
02:14
created
src/Response/JSON.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     /**
18 18
      * @inheritdoc
19 19
      */
20
-    public function getBody() {
20
+    public function getBody(){
21 21
         return json_decode($this->body);
22 22
     }
23 23
 
Please login to merge, or discard this patch.
src/Response/File.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
      */
19 19
     protected $destinationPath;
20 20
 
21
-    public function __construct($curlResponse, $curlRequest,$destination = null) {
21
+    public function __construct($curlResponse, $curlRequest, $destination = null){
22 22
         parent::__construct($curlResponse, $curlRequest);
23 23
         $this->extractFileName();
24
-        if (!empty($destination)) {
24
+        if (!empty($destination)){
25 25
             $this->setupDestination($destination);
26 26
             $this->writeFile();
27 27
         }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if (empty($destination)){
36 36
             $destination = sys_get_temp_dir().'/SugarAPI';
37 37
             if (!file_exists($destination)){
38
-                mkdir($destination,0777);
38
+                mkdir($destination, 0777);
39 39
             }
40 40
         }
41 41
         $this->destinationPath = $destination;
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
      * Extract the filename from the Headers, and store it in filename property
46 46
      */
47 47
     protected function extractFileName(){
48
-        foreach (explode("\r\n",$this->headers) as $header)
48
+        foreach (explode("\r\n", $this->headers) as $header)
49 49
         {
50
-            if (strpos($header,'filename')!==FALSE){
51
-                $this->fileName = substr($header,(strpos($header,"\"")+1),-1);
50
+            if (strpos($header, 'filename')!==FALSE){
51
+                $this->fileName = substr($header, (strpos($header, "\"")+1), -1);
52 52
             }
53 53
         }
54 54
     }
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
      * Write the downloaded file
66 66
      */
67 67
     protected function writeFile(){
68
-        $fileHandle = fopen($this->file(),'w+');
69
-        fwrite($fileHandle,$this->body);
68
+        $fileHandle = fopen($this->file(), 'w+');
69
+        fwrite($fileHandle, $this->body);
70 70
         fclose($fileHandle);
71 71
     }
72 72
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @return string
76 76
      */
77 77
     public function file(){
78
-        return rtrim($this->destinationPath,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$this->fileName;
78
+        return rtrim($this->destinationPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$this->fileName;
79 79
     }
80 80
 
81 81
 }
82 82
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exception/EntryPointException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 class EntryPointException extends SDKException {
6 6
 
7
-    public function __construct($message) {
7
+    public function __construct($message){
8 8
         parent::__construct($message);
9 9
     }
10 10
 
Please login to merge, or discard this patch.
src/Exception/SDKException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace SugarAPI\SDK\Exception;
4 4
 
5
-class SDKException extends \Exception{
5
+class SDKException extends \Exception {
6 6
 
7
-    public function __construct($message = 'Unknown SugarAPI SDK Exception Occurred.') {
7
+    public function __construct($message = 'Unknown SugarAPI SDK Exception Occurred.'){
8 8
         parent::__construct($message);
9 9
     }
10 10
 
Please login to merge, or discard this patch.
src/Exception/AuthenticationException.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 namespace SugarAPI\SDK\Exception;
4 4
 
5
-class AuthenticationException extends SDKException{
5
+class AuthenticationException extends SDKException {
6 6
 
7 7
     protected $message = 'Authentication Exception occurred when attempting to Login to SugarCRM instance. Message: %s';
8 8
 
9
-    public function __construct($message) {
10
-        $message = sprintf($this->message,$message);
9
+    public function __construct($message){
10
+        $message = sprintf($this->message, $message);
11 11
         parent::__construct($message);
12 12
     }
13 13
 
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/AbstractEntryPoint.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
      */
86 86
     protected $accessToken;
87 87
 
88
-    public function __construct($url,$options = array()){
88
+    public function __construct($url, $options = array()){
89 89
         $this->url = $url;
90 90
         $this->Module = $this->_MODULE;
91 91
 
92
-        if (!empty($options)) {
93
-            if (empty($this->Module)) {
94
-                if (strpos($this->_URL, '$module') !== FALSE) {
92
+        if (!empty($options)){
93
+            if (empty($this->Module)){
94
+                if (strpos($this->_URL, '$module')!==FALSE){
95 95
                     $this->module($options[0]);
96 96
                     array_shift($options);
97 97
                 }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @inheritdoc
131 131
      */
132 132
     public function execute(){
133
-        if ($this->verifyURL() && $this->validateData()) {
133
+        if ($this->verifyURL() && $this->validateData()){
134 134
             $this->configureURL();
135 135
             $this->Request->setURL($this->url);
136 136
             $this->Request->send();
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
     /**
145 145
      * @inheritdoc
146 146
      */
147
-    public function authRequired() {
147
+    public function authRequired(){
148 148
         return $this->_AUTH_REQUIRED;
149 149
     }
150 150
 
151 151
     /**
152 152
      * @inheritdoc
153 153
      */
154
-    public function configureAuth($accessToken) {
154
+    public function configureAuth($accessToken){
155 155
         if ($this->authRequired()){
156 156
             $this->accessToken = $accessToken;
157 157
             $this->Request->addHeader('OAuth-Token', $accessToken);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     /**
163 163
      * @inheritdoc
164 164
      */
165
-    public function getModule() {
165
+    public function getModule(){
166 166
         return $this->Module;
167 167
     }
168 168
 
@@ -201,30 +201,30 @@  discard block
 block discarded – undo
201 201
      */
202 202
     protected function configureURL(){
203 203
         $url = $this->_URL;
204
-        if (strpos($this->_URL,"$")!==FALSE) {
205
-            if (count($this->Options) > 0 || !empty($this->Module)) {
204
+        if (strpos($this->_URL, "$")!==FALSE){
205
+            if (count($this->Options)>0 || !empty($this->Module)){
206 206
                 $urlParts = explode("/", $this->_URL);
207 207
                 $o = 0;
208
-                foreach ($urlParts as $key => $part) {
209
-                    if (strpos($part, '$module') !== FALSE) {
210
-                        if (isset($this->Module)) {
208
+                foreach ($urlParts as $key => $part){
209
+                    if (strpos($part, '$module')!==FALSE){
210
+                        if (isset($this->Module)){
211 211
                             $urlParts[$key] = $this->Module;
212 212
                             continue;
213
-                        } else {
214
-                            if (isset($this->Options[$o])) {
213
+                        }else{
214
+                            if (isset($this->Options[$o])){
215 215
                                 $this->Module = $this->Options[$o];
216 216
                                 array_shift($this->Options);
217 217
                             }
218 218
                         }
219 219
                     }
220
-                    if (strpos($part, "$") !== FALSE) {
221
-                        if (isset($this->Options[$o])) {
220
+                    if (strpos($part, "$")!==FALSE){
221
+                        if (isset($this->Options[$o])){
222 222
                             $urlParts[$key] = $this->Options[$o];
223 223
                             $o++;
224 224
                         }
225 225
                     }
226 226
                 }
227
-                $url = implode($urlParts,"/");
227
+                $url = implode($urlParts, "/");
228 228
             }
229 229
         }
230 230
         $this->url = $this->url.$url;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      * Setup the Response Object Property, not called until after Request Execution
242 242
      */
243 243
     protected function setupResponse(){
244
-        $this->Response = new JSONResponse($this->Request->getResponse(),$this->Request->getCurlObject());
244
+        $this->Response = new JSONResponse($this->Request->getResponse(), $this->Request->getCurlObject());
245 245
     }
246 246
 
247 247
     /**
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
      * @throws EntryPointException
251 251
      */
252 252
     protected function verifyURL(){
253
-        $urlVarCount = substr_count($this->_URL,"$");
253
+        $urlVarCount = substr_count($this->_URL, "$");
254 254
         $optionCount = 0;
255 255
         if (!empty($this->Module)){
256 256
             $optionCount++;
257 257
         }
258 258
         $optionCount += count($this->Options);
259 259
         if ($urlVarCount!==$optionCount){
260
-            if (empty($this->Module) && strpos($this->_URL,'$module')){
260
+            if (empty($this->Module) && strpos($this->_URL, '$module')){
261 261
                 throw new EntryPointException('Module is required for EntryPoint '.get_called_class());
262 262
             }else{
263 263
                 throw new EntryPointException('EntryPoint URL ('.$this->_URL.') requires more parameters than passed.');
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
      * @throws EntryPointException
274 274
      */
275 275
     protected function validateData(){
276
-        if (empty($this->_REQUIRED_DATA)||count($this->_REQUIRED_DATA)==0){
276
+        if (empty($this->_REQUIRED_DATA) || count($this->_REQUIRED_DATA)==0){
277 277
             return true;
278 278
         }else{
279 279
             $errors = array();
280
-            foreach($this->_REQUIRED_DATA as $property){
280
+            foreach ($this->_REQUIRED_DATA as $property){
281 281
                 if (isset($this->Data[$property]) || $this->Data[$property]!==null){
282 282
                     continue;
283 283
                 }else{
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 }
286 286
             }
287 287
             if (count($errors)>0){
288
-                throw new EntryPointException('EntryPoint requires specific properties in Request data. Missing the following '.implode($errors,","));
288
+                throw new EntryPointException('EntryPoint requires specific properties in Request data. Missing the following '.implode($errors, ","));
289 289
             }else{
290 290
                 return true;
291 291
             }
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/GET/FileEntryPoint.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @inheritdoc
19 19
      */
20
-    protected function setupRequest() {
20
+    protected function setupRequest(){
21 21
         $this->Request = new GETFile();
22 22
     }
23 23
 
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
      * @inheritdoc
26 26
      * File Response Object has option File Destination parameter, which is passed using DownloadDir property
27 27
      */
28
-    protected function setupResponse() {
29
-        $this->Response = new FileResponse($this->Request->getResponse(),$this->Request->getCurlObject(),$this->downloadDir);
28
+    protected function setupResponse(){
29
+        $this->Response = new FileResponse($this->Request->getResponse(), $this->Request->getCurlObject(), $this->downloadDir);
30 30
     }
31 31
 
32 32
     /**
Please login to merge, or discard this patch.
src/EntryPoint/Abstracts/POST/FileEntryPoint.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     /**
11 11
      * @inheritdoc
12 12
      */
13
-    protected function setupRequest() {
13
+    protected function setupRequest(){
14 14
         $this->Request = new POSTFile();
15 15
     }
16 16
 
Please login to merge, or discard this patch.
src/EntryPoint/POST/RecordFileField.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@
 block discarded – undo
20 20
     /**
21 21
      * @inheritdoc
22 22
      */
23
-    public function data(array $data) {
24
-        foreach($data as $key => $value){
23
+    public function data(array $data){
24
+        foreach ($data as $key => $value){
25 25
             if (strtolower($key)!=='oauth_token' || strtolower($key)!=='delete_if_fails' || strtolower($key)!=='format'){
26
-                if (strpos($value,'@')===FALSE){
26
+                if (strpos($value, '@')===FALSE){
27 27
                     $data[$key] = '@'.$value;
28 28
                 }
29 29
             }
Please login to merge, or discard this patch.