Skip to content

Commit b94e4f3

Browse files
author
David Nahodyl
committed
auto-format
1 parent 992fe72 commit b94e4f3

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

src/Database/Query/FMBaseBuilder.php

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,14 @@ class FMBaseBuilder extends Builder
116116
* @var string[]
117117
*/
118118
public $operators = [
119-
'=','==', '', '!', '<', '>', '<=', '', '>=', '', '~',
119+
'=', '==', '', '!', '<', '>', '<=', '', '>=', '', '~',
120120
];
121121

122122

123123
public $containerFieldName;
124124
public $containerFile;
125125

126126

127-
128127
/**
129128
* Add a basic where clause to the query.
130129
*
@@ -133,7 +132,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
133132
{
134133

135134
// This is an "orWhere" type query, so add a find request and then work from there
136-
if ($boolean === 'or'){
135+
if ($boolean === 'or') {
137136
$this->addFindRequest();
138137
}
139138
// If the column is an array, we will assume it is an array of key-value pairs
@@ -181,16 +180,16 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
181180
public function delete($recordId = null)
182181
{
183182
// If an ID is passed to the method we will delete the record with this internal FileMaker record ID
184-
if (! is_null($recordId)) {
183+
if (!is_null($recordId)) {
185184
$this->recordId($recordId);
186185
}
187186

188187
$this->applyBeforeQueryCallbacks();
189188

190189
try {
191190
$this->connection->deleteRecord($this);
192-
} catch (FileMakerDataApiException $e){
193-
if ($e->getCode() === 101){
191+
} catch (FileMakerDataApiException $e) {
192+
if ($e->getCode() === 101) {
194193
// no record was found to be deleted, return modified count of 0
195194
return 0;
196195
} else {
@@ -276,7 +275,7 @@ public function script($name, $param = null): FMBaseBuilder
276275
$this->script = $name;
277276

278277
// set the script parameter if one was passed in
279-
if ($param){
278+
if ($param) {
280279
$this->scriptParam = $param;
281280
}
282281

@@ -294,7 +293,7 @@ public function scriptPresort($name, $param = null): FMBaseBuilder
294293
$this->scriptPresort = $name;
295294

296295
// set the script parameter if one was passed in
297-
if ($param){
296+
if ($param) {
298297
$this->scriptPresortParam = $param;
299298
}
300299

@@ -312,7 +311,7 @@ public function scriptPrerequest($name, $param = null): FMBaseBuilder
312311
$this->scriptPrerequest = $name;
313312

314313
// set the script parameter if one was passed in
315-
if ($param){
314+
if ($param) {
316315
$this->scriptPrerequestParam = $param;
317316
}
318317

@@ -350,7 +349,7 @@ public function get($columns = ['*'])
350349
$records = collect($response['response']['data']);
351350

352351
// filter to only requested columns
353-
if ($columns !== ['*']){
352+
if ($columns !== ['*']) {
354353
$records = $records->intersectByKeys(array_flip($columns));
355354
}
356355
return $records;
@@ -421,7 +420,7 @@ public function omit($boolean = true): FMBaseBuilder
421420

422421
$currentFind['omit'] = $boolean ? 'true' : 'false';
423422

424-
$this->wheres[$count -1] = $currentFind;
423+
$this->wheres[$count - 1] = $currentFind;
425424

426425
return $this;
427426
}
@@ -469,7 +468,8 @@ public function editRecord()
469468
* @return bool
470469
* @throws FileMakerDataApiException
471470
*/
472-
public function createRecord(){
471+
public function createRecord()
472+
{
473473
$response = $this->connection->createRecord($this);
474474
return $response;
475475
}
@@ -545,7 +545,7 @@ public function duplicate(int $recordId): array
545545
/**
546546
* Update records in the database.
547547
*
548-
* @param array $values
548+
* @param array $values
549549
* @return int
550550
*/
551551
public function update(array $values)
@@ -580,18 +580,17 @@ public function findByRecordId($recordId)
580580
*/
581581
public function whereNull($columns, $boolean = 'and', $not = false)
582582
{
583-
if ($not){
583+
if ($not) {
584584
// where NOT null
585585
$this->where($columns, null, '*', $boolean);
586-
} else{
586+
} else {
587587
// where null
588588
$this->where($columns, null, '=', $boolean);
589589
}
590590
return $this;
591591
}
592592

593593

594-
595594
protected function addFindRequest()
596595
{
597596
array_push($this->wheres, []);
@@ -652,7 +651,8 @@ public function performScript($script = null, $param = null)
652651
* @param null $script
653652
* @param null $param
654653
*/
655-
public function executeScript($script = null, $param = null){
654+
public function executeScript($script = null, $param = null)
655+
{
656656
if ($script) {
657657
$this->script = $script;
658658
}
@@ -669,9 +669,9 @@ public function executeScript($script = null, $param = null){
669669
/**
670670
* Prepare the value and operator for a where clause.
671671
*
672-
* @param string $value
673-
* @param string $operator
674-
* @param bool $useDefault
672+
* @param string $value
673+
* @param string $operator
674+
* @param bool $useDefault
675675
* @return array
676676
*
677677
* @throws \InvalidArgumentException
@@ -687,34 +687,36 @@ public function prepareValueAndOperator($value, $operator, $useDefault = false)
687687
return [$value, $operator];
688688
}
689689

690-
public function setGlobalFields(array $globals){
690+
public function setGlobalFields(array $globals)
691+
{
691692
$this->globalFields = $globals;
692693
return $this->connection->setGlobalFields($this);
693694
}
695+
694696
/**
695697
* Retrieve the "count" result of the query.
696698
*
697-
* @param string $columns
699+
* @param string $columns
698700
* @return int
699701
*/
700702
public function count($columns = '*')
701703
{
702704
$this->limit(1);
703705
try {
704706
$result = $this->connection->performFind($this);
705-
} catch (FileMakerDataApiException $e){
706-
if ($e->getCode() === 401){
707+
} catch (FileMakerDataApiException $e) {
708+
if ($e->getCode() === 401) {
707709
// no records found - this is ok
708710
// return 0
709711
return 0;
710712
}
711713

712714
// not a 401, so throw it
713-
throw $e;
715+
throw $e;
714716
}
715717

716718
$count = $result['response']['dataInfo']['foundCount'];
717-
return (int) $count;
719+
return (int)$count;
718720
}
719721

720722
}

0 commit comments

Comments
 (0)