Skip to content

Commit 8fe3eb0

Browse files
code sniffer clean up
1 parent d997139 commit 8fe3eb0

28 files changed

+78
-78
lines changed

src/Clauses/CollectClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function compile()
1919
{
2020
$output = 'COLLECT';
2121
if (isset($this->variableName) && isset($this->expression)) {
22-
$output .= ' '.$this->variableName.' = '.$this->expression;
22+
$output .= ' ' . $this->variableName . ' = ' . $this->expression;
2323
}
2424

2525
return $output;

src/Clauses/EdgeCollectionsClause.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public function compile()
1818
return implode(', ', array_map(function ($expression) {
1919
$output = '';
2020
if (isset($expression[1])) {
21-
$output = $expression[1].' ';
21+
$output = $expression[1] . ' ';
2222
}
2323

24-
return $output.$expression[0];
24+
return $output . $expression[0];
2525
}, $this->edgeCollections));
2626
}
2727
}

src/Clauses/FilterClause.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function compile()
2626
{
2727
$compiledPredicates = $this->compilePredicates($this->predicates);
2828

29-
return 'FILTER '.rtrim($compiledPredicates);
29+
return 'FILTER ' . rtrim($compiledPredicates);
3030
}
3131

3232
protected function compilePredicates($predicates, $compiledPredicates = '')
@@ -35,7 +35,7 @@ protected function compilePredicates($predicates, $compiledPredicates = '')
3535
foreach ($predicates as $predicate) {
3636
if ($predicate instanceof PredicateExpression) {
3737
if ($compiledPredicates != '' && $compiledPredicates !== '(') {
38-
$compiledPredicates .= ' '.$predicate->logicalOperator.' ';
38+
$compiledPredicates .= ' ' . $predicate->logicalOperator . ' ';
3939
}
4040
$compiledPredicates .= $predicate;
4141
}

src/Clauses/ForClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function compile()
3131

3232
$inExpression = (string) $this->in;
3333
if (is_array($this->in)) {
34-
$inExpression = '['.implode(', ', $this->in).']';
34+
$inExpression = '[' . implode(', ', $this->in) . ']';
3535
}
3636

3737
return "FOR {$variableExpression} IN {$inExpression}";

src/Clauses/GraphClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public function __construct($graphName)
1313

1414
public function compile()
1515
{
16-
return 'GRAPH '.$this->graphName;
16+
return 'GRAPH ' . $this->graphName;
1717
}
1818
}

src/Clauses/GroupClause.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public function __construct($groupsVariable, $projectionExpression = null)
1515

1616
public function compile()
1717
{
18-
$output = 'INTO '.$this->groupsVariable;
18+
$output = 'INTO ' . $this->groupsVariable;
1919
if (isset($this->projectionExpression)) {
20-
$output .= ' = '.$this->projectionExpression;
20+
$output .= ' = ' . $this->projectionExpression;
2121
}
2222

2323
return $output;

src/Clauses/KeepClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public function __construct($keepVariable)
1313

1414
public function compile()
1515
{
16-
return 'KEEP '.$this->keepVariable;
16+
return 'KEEP ' . $this->keepVariable;
1717
}
1818
}

src/Clauses/LimitClause.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public function compile()
3030
{
3131
$output = 'LIMIT ';
3232
if ($this->offset !== null) {
33-
$output .= $this->offset.', ';
33+
$output .= $this->offset . ', ';
3434
}
3535

36-
return $output.$this->count;
36+
return $output . $this->count;
3737
}
3838
}

src/Clauses/OptionsClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public function __construct($options)
1313

1414
public function compile()
1515
{
16-
return 'OPTIONS '.$this->options;
16+
return 'OPTIONS ' . $this->options;
1717
}
1818
}

src/Clauses/PruneClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public function compile()
1212
{
1313
$compiledPredicates = $this->compilePredicates($this->predicates);
1414

15-
return 'PRUNE '.rtrim($compiledPredicates);
15+
return 'PRUNE ' . rtrim($compiledPredicates);
1616
}
1717
}

src/Clauses/ReturnClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public function compile()
3030
$output .= ' DISTINCT';
3131
}
3232

33-
return $output.' '.$this->expression;
33+
return $output . ' ' . $this->expression;
3434
}
3535
}

src/Clauses/SearchClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public function compile()
1212
{
1313
$compiledPredicates = $this->compilePredicates($this->predicates);
1414

15-
return 'SEARCH '.rtrim($compiledPredicates);
15+
return 'SEARCH ' . rtrim($compiledPredicates);
1616
}
1717
}

src/Clauses/SortClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public function compile()
1919
return implode(' ', $expression);
2020
}, $this->by));
2121

22-
return 'SORT '.$sortBy;
22+
return 'SORT ' . $sortBy;
2323
}
2424
}

src/Clauses/TraverseClause.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public function compile()
3939
if (isset($this->toVertex)) {
4040
$output .= ($this->kShortestPaths) ? ' K_SHORTEST_PATHS' : ' SHORTEST_PATH';
4141
}
42-
$output .= ' '.$this->startVertex;
42+
$output .= ' ' . $this->startVertex;
4343
if (isset($this->toVertex)) {
44-
$output .= ' TO '.$this->toVertex;
44+
$output .= ' TO ' . $this->toVertex;
4545
}
4646

4747
return $output;

src/Clauses/WithCountClause.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public function __construct($countVariableName)
1313

1414
public function compile()
1515
{
16-
return 'WITH COUNT INTO '.$this->countVariableName;
16+
return 'WITH COUNT INTO ' . $this->countVariableName;
1717
}
1818
}

src/Expressions/ConditionalExpression.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public function __construct($if, $then, $else = null)
2323

2424
public function compile()
2525
{
26-
return $this->parameters['if'].' ? '.$this->parameters['then'].' : '.$this->parameters['else'];
26+
return $this->parameters['if'] . ' ? ' . $this->parameters['then'] . ' : ' . $this->parameters['else'];
2727
}
2828
}

src/Expressions/FunctionExpression.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ public function __construct(string $functionName, $parameters = [])
4242

4343
public function compile()
4444
{
45-
$output = strtoupper($this->functionName).'(';
45+
$output = strtoupper($this->functionName) . '(';
4646
$implosion = '';
4747
foreach ($this->parameters as $parameter) {
48-
$implosion .= ', '.(string) $parameter;
48+
$implosion .= ', ' . (string) $parameter;
4949
}
5050
if ($implosion != '') {
5151
$output .= ltrim($implosion, ', ');
5252
}
5353

54-
return $output.')';
54+
return $output . ')';
5555
}
5656
}

src/Expressions/ListExpression.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public function __construct(array $expression)
1717

1818
public function compile()
1919
{
20-
return '['.implode(',', $this->expression).']';
20+
return '[' . implode(',', $this->expression) . ']';
2121
}
2222
}

src/Expressions/ObjectExpression.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public function compile()
1414
if ($output != '') {
1515
$output .= ',';
1616
}
17-
$output .= '"'.$key.'":'.$value;
17+
$output .= '"' . $key . '":' . $value;
1818
}
1919

20-
return '{'.$output.'}';
20+
return '{' . $output . '}';
2121
}
2222
}

src/Expressions/PredicateExpression.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ public function __construct(
4343
*/
4444
public function compile()
4545
{
46-
return $this->leftOperand.' '.$this->comparisonOperator.' '.$this->rightOperand;
46+
return $this->leftOperand . ' ' . $this->comparisonOperator . ' ' . $this->rightOperand;
4747
}
4848
}

src/Expressions/TernaryExpression.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public function __construct($if, $then, $else = null)
3434
*/
3535
public function compile()
3636
{
37-
return $this->if.' ? '.$this->then.' : '.$this->else;
37+
return $this->if . ' ? ' . $this->then . ' : ' . $this->else;
3838
}
3939
}

src/Grammar.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function getDateFormat()
136136

137137
public function wrap($value): string
138138
{
139-
return '`'.addcslashes($value, '`').'`';
139+
return '`' . addcslashes($value, '`') . '`';
140140
}
141141

142142
public function mapArgumentTypeToExpressionType($argumentType): string
@@ -155,7 +155,7 @@ public function formatBind(string $bindVariableName, bool $collection = null)
155155
$prefix = '@@';
156156
}
157157

158-
return $prefix.$bindVariableName;
158+
return $prefix . $bindVariableName;
159159
}
160160

161161
public function getAllowedExpressionTypes()

src/QueryBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function bind($data, $to = null, $collection = false): BindExpression
203203
}
204204

205205
if ($to == null) {
206-
$to = $this->queryId.'_'.(count($this->binds) + 1);
206+
$to = $this->queryId . '_' . (count($this->binds) + 1);
207207
}
208208

209209
$this->binds[$to] = $data;
@@ -224,7 +224,7 @@ public function compile(): self
224224

225225
foreach ($this->commands as $command) {
226226
$result = $command->compile();
227-
$this->query .= ' '.$result;
227+
$this->query .= ' ' . $result;
228228

229229
if ($command instanceof self) {
230230
// Extract binds
@@ -239,7 +239,7 @@ public function compile(): self
239239
$this->query = trim($this->query);
240240

241241
if ($this->isSubQuery) {
242-
$this->query = '('.$this->query.')';
242+
$this->query = '(' . $this->query . ')';
243243
}
244244

245245
return $this;

src/Traits/NormalizesExpressions.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function createExpression($argument, $argumentType)
5656
return $this->bind($argument);
5757
}
5858

59-
$expressionClass = '\LaravelFreelancerNL\FluentAQL\Expressions\\'.$expressionType.'Expression';
59+
$expressionClass = '\LaravelFreelancerNL\FluentAQL\Expressions\\' . $expressionType . 'Expression';
6060

6161
return new $expressionClass($argument);
6262
}
@@ -200,7 +200,7 @@ protected function determineArgumentType($argument, $allowedExpressionTypes = nu
200200
}
201201

202202
foreach ($allowedExpressionTypes as $allowedExpressionType) {
203-
$check = 'is'.$allowedExpressionType;
203+
$check = 'is' . $allowedExpressionType;
204204
if ($allowedExpressionType == 'Reference' || $allowedExpressionType == 'RegisteredVariable') {
205205
if ($this->grammar->$check($argument, $this->variables)) {
206206
return $allowedExpressionType;
@@ -218,8 +218,8 @@ protected function determineArgumentType($argument, $allowedExpressionTypes = nu
218218
}
219219

220220
throw new ExpressionTypeException("This argument, '{$argument}', does not match one of these expression types: "
221-
.implode(', ', $allowedExpressionTypes)
222-
.'.');
221+
. implode(', ', $allowedExpressionTypes)
222+
. '.');
223223
}
224224

225225
/**

src/Traits/ValidatesExpressions.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function isRegisteredVariable($value, $registeredVariables = []): bool
191191
public function isAttribute($value): bool
192192
{
193193
$pattern = '/^(@?[\d\w_]+|`@?[\d\w_]+`)(\[\`.+\`\]|\[[\d\w\*]*\])*'
194-
.'(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/';
194+
. '(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/';
195195
if (
196196
is_string($value) &&
197197
preg_match($pattern, $value)
@@ -212,14 +212,14 @@ public function isReference($value, $registeredVariables = []): bool
212212
{
213213
$variables = '';
214214
if (!empty($registeredVariables)) {
215-
$variables = implode('|', $registeredVariables).'|';
215+
$variables = implode('|', $registeredVariables) . '|';
216216
}
217217

218218
if (
219219
is_string($value)
220220
&& preg_match('/^('
221-
.$variables
222-
.'NEW|OLD)(\[\`.+\`\]|\[[\d\w\*]*\])*(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/', $value)
221+
. $variables
222+
. 'NEW|OLD)(\[\`.+\`\]|\[[\d\w\*]*\])*(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/', $value)
223223
) {
224224
return true;
225225
}

tests/unit/QueryBuilderTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ public function testBind()
6666
]
6767
}');
6868
self::assertInstanceOf(BindExpression::class, $bind);
69-
self::assertEquals('@'.$qb->getQueryId().'_1', (string) $bind);
69+
self::assertEquals('@' . $qb->getQueryId() . '_1', (string) $bind);
7070

71-
self::arrayHasKey($qb->getQueryId().'_1');
72-
self::assertIsString($qb->binds[$qb->getQueryId().'_1']);
73-
self::assertEquals(121, strlen($qb->binds[$qb->getQueryId().'_1']));
71+
self::arrayHasKey($qb->getQueryId() . '_1');
72+
self::assertIsString($qb->binds[$qb->getQueryId() . '_1']);
73+
self::assertEquals(121, strlen($qb->binds[$qb->getQueryId() . '_1']));
7474
}
7575

7676
public function testRegisterCollections()

tests/unit/QueryClausesTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testCollectClause()
3232
$result = (new QueryBuilder())
3333
->collect('doc', 'expression')
3434
->get();
35-
self::assertEquals('COLLECT doc = @'.$result->getQueryId().'_1', $result->query);
35+
self::assertEquals('COLLECT doc = @' . $result->getQueryId() . '_1', $result->query);
3636

3737
$result = (new QueryBuilder())
3838
->for('u', 'Users')
@@ -51,22 +51,22 @@ public function testGroupClause()
5151
$result = (new QueryBuilder())
5252
->group('groupsVariable', 'projectionExpression')
5353
->get();
54-
self::assertEquals('INTO groupsVariable = @'.$result->getQueryId().'_1', $result->query);
54+
self::assertEquals('INTO groupsVariable = @' . $result->getQueryId() . '_1', $result->query);
5555

5656
$result = (new QueryBuilder())
5757
->group('groupsVariable', '{
5858
"name" : u.name,
5959
"isActive" : u.status == "active"
6060
}')->get();
61-
self::assertEquals('INTO groupsVariable = @'.$result->getQueryId().'_1', $result->query);
61+
self::assertEquals('INTO groupsVariable = @' . $result->getQueryId() . '_1', $result->query);
6262
}
6363

6464
public function testAggregateClause()
6565
{
6666
$result = (new QueryBuilder())
6767
->aggregate('variableName', 'aggregateExpression')
6868
->get();
69-
self::assertEquals('AGGREGATE variableName = @'.$result->getQueryId().'_1', $result->query);
69+
self::assertEquals('AGGREGATE variableName = @' . $result->getQueryId() . '_1', $result->query);
7070
}
7171

7272
public function testKeepClause()
@@ -168,7 +168,7 @@ public function testFilterOnNullValueCanUseAllLogicalOperators()
168168
->get();
169169
self::assertEquals(
170170
'FOR doc IN documents FILTER doc.attribute1 != null AND doc.attribute2 != null'
171-
.' AND doc.attribute3 != null RETURN doc',
171+
. ' AND doc.attribute3 != null RETURN doc',
172172
$result->query
173173
);
174174
}
@@ -312,7 +312,7 @@ public function testReturnSyntax()
312312
$result = (new QueryBuilder())
313313
->return('u.name')
314314
->get();
315-
self::assertEquals('RETURN @'.$result->getQueryId().'_1', $result->query);
315+
self::assertEquals('RETURN @' . $result->getQueryId() . '_1', $result->query);
316316

317317
$result = (new QueryBuilder())
318318
->for('u', 'Users')
@@ -323,11 +323,11 @@ public function testReturnSyntax()
323323
$result = (new QueryBuilder())
324324
->return('1 + 1')
325325
->get();
326-
self::assertEquals('RETURN @'.$result->getQueryId().'_1', $result->query);
326+
self::assertEquals('RETURN @' . $result->getQueryId() . '_1', $result->query);
327327

328328
$result = (new QueryBuilder())
329329
->return('1 + 1', true)
330330
->get();
331-
self::assertEquals('RETURN DISTINCT @'.$result->getQueryId().'_1', $result->query);
331+
self::assertEquals('RETURN DISTINCT @' . $result->getQueryId() . '_1', $result->query);
332332
}
333333
}

0 commit comments

Comments
 (0)