@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return string (guid) |
| 50 | 50 | */ |
| 51 | - public function findId($code, $key='Code'){ |
|
| 52 | - if ( $this->isFillable($key) ) { |
|
| 51 | + public function findId($code, $key = 'Code') { |
|
| 52 | + if ($this->isFillable($key)) { |
|
| 53 | 53 | $format = ($this->url == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s'; |
| 54 | 54 | if (preg_match('/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/', $code)) { |
| 55 | 55 | $format = "guid'$format'"; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | '$select' => $this->primaryKey, |
| 66 | 66 | '$orderby' => $this->primaryKey, |
| 67 | 67 | ]; |
| 68 | - if( $records = $this->connection()->get($this->url, $request) ){ |
|
| 68 | + if ($records = $this->connection()->get($this->url, $request)) { |
|
| 69 | 69 | return $records[0][$this->primaryKey]; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $result = $this->connection()->get($this->url, $request, $headers); |
| 99 | 99 | |
| 100 | - if (!empty($divisionId)) { |
|
| 100 | + if ( ! empty($divisionId)) { |
|
| 101 | 101 | $this->connection()->setDivision($originalDivision); // Restore division |
| 102 | 102 | } |
| 103 | 103 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | // If we have one result which is not an assoc array, make it the first element of an array for the |
| 133 | 133 | // collectionFromResult function so we always return a collection from filter |
| 134 | 134 | if ((bool) count(array_filter(array_keys($result), 'is_string'))) { |
| 135 | - $result = [ $result ]; |
|
| 135 | + $result = [$result]; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | while ($this->connection()->nextUrl !== null) |
@@ -141,12 +141,12 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | // If we have one result which is not an assoc array, make it the first element of an array for the array_merge function |
| 143 | 143 | if ((bool) count(array_filter(array_keys($nextResult), 'is_string'))) { |
| 144 | - $nextResult = [ $nextResult ]; |
|
| 144 | + $nextResult = [$nextResult]; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | $result = array_merge($result, $nextResult); |
| 148 | 148 | } |
| 149 | - $collection = [ ]; |
|
| 149 | + $collection = []; |
|
| 150 | 150 | foreach ($result as $r) { |
| 151 | 151 | $collection[] = new self($this->connection(), $r); |
| 152 | 152 | } |
@@ -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; |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | * @return mixed |
| 78 | 78 | */ |
| 79 | 79 | public function getSalesInvoiceLines() { |
| 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}'"); |
| 82 | 82 | } |
| 83 | 83 | return $this->attributes['PurchaseInvoiceLines']; |