Completed
Push — master ( 8f69e2...0f05a9 )
by ARCANEDEV
06:56
created

HasExpressions   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 22
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getExpression() 0 4 1
1
<?php namespace Arcanedev\LaravelMetrics\Metrics\Concerns;
2
3
use Arcanedev\LaravelMetrics\Expressions\{Expression, Factory};
4
5
/**
6
 * Trait     HasExpressions
7
 *
8
 * @package  Arcanedev\LaravelMetrics\Metrics\Concerns
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
trait HasExpressions
12
{
13
    /* -----------------------------------------------------------------
14
     |  Main Methods
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Get an database expression.
20
     *
21
     * @param  \Illuminate\Database\Eloquent\Builder  $query
22
     * @param  string                                 $name
23
     * @param  mixed|null                             $value
24
     * @param  array                                  $params
25
     *
26
     * @return \Arcanedev\LaravelMetrics\Expressions\Expression|mixed
27
     */
28 4
    protected function getExpression($query, string $name, $value = null, array $params = []): Expression
29
    {
30 4
        return Factory::make($query->getConnection()->getDriverName(), $name, $value, $params);
31
    }
32
}
33