Passed
Push — master ( f8f76e...e5015c )
by Bas
12:29
created

HasOperatorExpressions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 30
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A calc() 0 3 1
A if() 0 3 1
1
<?php
2
3
namespace LaravelFreelancerNL\FluentAQL\AQL;
4
5
use LaravelFreelancerNL\FluentAQL\Expressions\ArithmeticExpression;
6
use LaravelFreelancerNL\FluentAQL\Expressions\TernaryExpression;
7
8
/**
9
 * Trait hasFunctions.
10
 *
11
 * AQL Function API calls.
12
 */
13
trait HasOperatorExpressions
14
{
15
    /**
16
     * Evaluate a condition
17
     *
18
     * @link https://www.arangodb.com/docs/stable/aql/operators.html#ternary-operator
19
     *
20
     * @param $conditions
21
     * @param $then
22
     * @param $else
23
     * @return TernaryExpression
24
     */
25 1
    public function if($conditions, $then, $else)
26
    {
27 1
        return new TernaryExpression($conditions, $then, $else);
28
    }
29
30
    /**
31
     * Perform an arithmetic operation on two numbers
32
     *
33
     * @link https://www.arangodb.com/docs/stable/aql/operators.html#arithmetic-operators
34
     *
35
     * @param $leftOperand
36
     * @param $operator
37
     * @param $rightOperand
38
     * @return ArithmeticExpression
39
     */
40 2
    public function calc($leftOperand, $operator, $rightOperand)
41
    {
42 2
        return new ArithmeticExpression($leftOperand, $operator, $rightOperand);
43
    }
44
}
45