ValueTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 1
eloc 6
c 3
b 0
f 1
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A coalesce() 0 5 1
1
<?php
2
3
namespace Helix\DB\Fluent\Value;
4
5
use Helix\DB\Fluent\Value;
6
7
/**
8
 * Type-agnostic functions.
9
 */
10
trait ValueTrait
11
{
12
13
    use AggregateTrait;
14
    use ComparisonTrait;
15
16
    /**
17
     * `COALESCE($this, ...$values)`
18
     *
19
     * @param scalar[] $values
20
     * @return Value
21
     */
22
    public function coalesce(array $values)
23
    {
24
        array_unshift($values, $this);
25
        $values = $this->db->quoteList($values);
26
        return Value::factory($this->db, "COALESCE({$values})");
27
    }
28
}
29