@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | public function addItem(array $array) |
61 | 61 | { |
62 | - if (! isset($this->attributes['BankEntryLines']) || $this->attributes['BankEntryLines'] == null) { |
|
62 | + if ( ! isset($this->attributes['BankEntryLines']) || $this->attributes['BankEntryLines'] == null) { |
|
63 | 63 | $this->attributes['BankEntryLines'] = []; |
64 | 64 | } |
65 | 65 | $this->attributes['BankEntryLines'][] = $array; |
@@ -123,10 +123,10 @@ |
||
123 | 123 | */ |
124 | 124 | public function addItem(array $array) |
125 | 125 | { |
126 | - if (! isset($this->attributes['QuotationLines']) || $this->attributes['QuotationLines'] == null) { |
|
126 | + if ( ! isset($this->attributes['QuotationLines']) || $this->attributes['QuotationLines'] == null) { |
|
127 | 127 | $this->attributes['QuotationLines'] = []; |
128 | 128 | } |
129 | - if (! isset($array['LineNumber'])) { |
|
129 | + if ( ! isset($array['LineNumber'])) { |
|
130 | 130 | $array['LineNumber'] = count($this->attributes['QuotationLines']) + 1; |
131 | 131 | } |
132 | 132 | $this->attributes['QuotationLines'][] = $array; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | // If we have one result which is not an assoc array, make it the first element of an array for the |
36 | 36 | // collectionFromResult function so we always return a collection from filter |
37 | 37 | if ((bool) count(array_filter(array_keys($result), 'is_string'))) { |
38 | - $result = [ $result ]; |
|
38 | + $result = [$result]; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $class = $this->class; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return string (guid) |
60 | 60 | */ |
61 | - public function findId($code, $key='Code') |
|
61 | + public function findId($code, $key = 'Code') |
|
62 | 62 | { |
63 | 63 | if ($this->isFillable($key)) { |
64 | 64 | $format = ($this->url() == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s'; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $result = $this->connection()->get($this->url(), $request, $headers); |
110 | 110 | |
111 | - if (!empty($divisionId)) { |
|
111 | + if ( ! empty($divisionId)) { |
|
112 | 112 | $this->connection()->setDivision($originalDivision); // Restore division |
113 | 113 | } |
114 | 114 |
@@ -64,8 +64,7 @@ |
||
64 | 64 | $format = ($this->url() == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s'; |
65 | 65 | if (preg_match('/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/', $code)) { |
66 | 66 | $format = "guid'$format'"; |
67 | - } |
|
68 | - elseif (is_string($code)) { |
|
67 | + } elseif (is_string($code)) { |
|
69 | 68 | $format = "'$format'"; |
70 | 69 | } |
71 | 70 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | * @return mixed |
78 | 78 | */ |
79 | 79 | public function getPurchaseInvoiceLines($statement = '') { |
80 | - if(array_key_exists('__deferred', $this->attributes['PurchaseInvoiceLines'])) { |
|
80 | + if (array_key_exists('__deferred', $this->attributes['PurchaseInvoiceLines'])) { |
|
81 | 81 | $this->attributes['PurchaseInvoiceLines'] = (new PurchaseInvoiceLine($this->connection()))->filter("InvoiceID eq guid'{$this->ID}'", "", "", $statement); |
82 | 82 | } |
83 | 83 | return $this->attributes['PurchaseInvoiceLines']; |
@@ -23,15 +23,15 @@ |
||
23 | 23 | use Query\Findable; |
24 | 24 | |
25 | 25 | protected $fillable = [ |
26 | - 'ID', |
|
27 | - 'Created', |
|
28 | - 'Description', |
|
29 | - 'DocumentIsCreatable', |
|
30 | - 'DocumentIsDeletable', |
|
31 | - 'DocumentIsUpdatable', |
|
32 | - 'DocumentIsViewable', |
|
33 | - 'Modified', |
|
34 | - 'TypeCategory' |
|
26 | + 'ID', |
|
27 | + 'Created', |
|
28 | + 'Description', |
|
29 | + 'DocumentIsCreatable', |
|
30 | + 'DocumentIsDeletable', |
|
31 | + 'DocumentIsUpdatable', |
|
32 | + 'DocumentIsViewable', |
|
33 | + 'Modified', |
|
34 | + 'TypeCategory' |
|
35 | 35 | ]; |
36 | 36 | |
37 | 37 | protected $url = 'documents/DocumentTypes'; |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @property int $Main Indicates the main unit per division. Will be used when creating new item |
17 | 17 | * @property string $TimeUnit If Type = 'T' (time) then this fields indicates the type of time frame. yy = Year, mm = Month, wk = Week, dd = Day, hh = Hour, mi = Minute, ss = Second |
18 | 18 | * @property string $Type Type 'Time' is especially important for contracts. |
19 | - |
|
20 | 19 | */ |
21 | 20 | class Units extends Model |
22 | 21 | { |
@@ -30,7 +30,7 @@ |
||
30 | 30 | ]; |
31 | 31 | |
32 | 32 | $res = $client->get($this->getDownloadUrl(), [ |
33 | - 'headers' => $headers |
|
33 | + 'headers' => $headers |
|
34 | 34 | ]); |
35 | 35 | |
36 | 36 | return $res->getBody(); |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | public function handleNewTokens($response_timestamp, $refresh_token, $access_token) |
50 | 50 | { |
51 | 51 | $this->resetAcquiringLockTries(); |
52 | - if($this->acquireLock($this->token_lock_name) === false) { |
|
52 | + if ($this->acquireLock($this->token_lock_name) === false) { |
|
53 | 53 | throw new \Exception('Could not acquire lock..'); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $refreshed = false; |
57 | - if($this->isNewRefreshToken($response_timestamp, $refresh_token)) { |
|
57 | + if ($this->isNewRefreshToken($response_timestamp, $refresh_token)) { |
|
58 | 58 | $this->saveNewTokens($response_timestamp, $refresh_token, $access_token); |
59 | 59 | $this->saveTokenToHistory($response_timestamp, $refresh_token, $access_token); |
60 | 60 | $this->saveLastToken($refresh_token); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getLatestRefreshToken($fallback_token) |
77 | 77 | { |
78 | - if($this->acquireLock($this->token_lock_name) === false) { |
|
78 | + if ($this->acquireLock($this->token_lock_name) === false) { |
|
79 | 79 | throw new \Exception('Could not acquire lock..'); |
80 | 80 | } |
81 | 81 | |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | { |
95 | 95 | $tokens = Cache::get($this->token_history_name, []); |
96 | 96 | |
97 | - foreach($tokens as $token) { |
|
98 | - if($token['refresh_token'] === $refresh_token) { |
|
97 | + foreach ($tokens as $token) { |
|
98 | + if ($token['refresh_token'] === $refresh_token) { |
|
99 | 99 | return false; |
100 | 100 | } |
101 | - if($token['time'] > $response_timestamp) { |
|
101 | + if ($token['time'] > $response_timestamp) { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function handleMinuteLimit($limit) |
166 | 166 | { |
167 | 167 | $this->resetAcquiringLockTries(); |
168 | - if($this->acquireLock($this->limit_lock_name) === false) { |
|
168 | + if ($this->acquireLock($this->limit_lock_name) === false) { |
|
169 | 169 | throw new \Exception('Could not acquire lock..'); |
170 | 170 | } |
171 | 171 | |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function acquireLock($key) |
198 | 198 | { |
199 | - if($this->acquiring_lock_tries >= 20) { |
|
199 | + if ($this->acquiring_lock_tries >= 20) { |
|
200 | 200 | return false; |
201 | 201 | } |
202 | 202 | |
203 | 203 | $this->acquiring_lock_tries++; |
204 | 204 | |
205 | - if(Cache::has($key)) { |
|
205 | + if (Cache::has($key)) { |
|
206 | 206 | $this->sleepForLock(); |
207 | 207 | return $this->acquireLock($key); |
208 | 208 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | $this->sleepForLock(); |
214 | 214 | |
215 | - if(Cache::get($key) === $random_value) { |
|
215 | + if (Cache::get($key) === $random_value) { |
|
216 | 216 | return true; |
217 | 217 | } |
218 | 218 |