Passed
Push — next ( 142d58...5325de )
by Bas
10:59
created

BindExpression   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 32
ccs 8
cts 10
cp 0.8
rs 10
c 3
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getBindVariable() 0 3 1
A getData() 0 3 1
A __construct() 0 5 1
A compile() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\FluentAQL\Expressions;
6
7
use LaravelFreelancerNL\FluentAQL\QueryBuilder;
8
9
/**
10
 * AQL literal expression.
11
 */
12
class BindExpression extends LiteralExpression implements ExpressionInterface
13
{
14
    protected string $bindVariable;
15
16
    protected mixed $data = null;
17
18 2
    public function __construct(string $bindVariable, mixed $data = null)
19
    {
20 2
        $this->bindVariable = $bindVariable;
21
22 2
        $this->data = $data;
23 2
    }
24
25
    /**
26
     * Compile expression output.
27
     *
28
     * @param QueryBuilder $queryBuilder
29
     * @return string
30
     */
31 2
    public function compile(QueryBuilder $queryBuilder): string
32
    {
33 2
        return $this->bindVariable;
34
    }
35
36 1
    public function getBindVariable(): string
37
    {
38 1
        return $this->bindVariable;
39
    }
40
41
    public function getData(): mixed
42
    {
43
        return $this->data;
44
    }
45
}
46