Passed
Push — master ( ecea98...79bda6 )
by Jonas
12:45 queued 01:47
created

PostgresBuilder::stringifyBindings()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 4
nc 4
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Staudenmeir\LaravelMigrationViews\Schema\Builders;
4
5
use Illuminate\Database\Schema\PostgresBuilder as Base;
6
7
class PostgresBuilder extends Base
8
{
9
    use ManagesViews {
10
        stringifyBindings as parentStringifyBindings;
11
    }
12
13
    /**
14
     * Stringify the query bindings.
15
     *
16
     * @param array $bindings
17
     * @return array
18
     */
19 9
    protected function stringifyBindings(array $bindings)
20
    {
21 9
        foreach ($bindings as &$binding) {
22 9
            if (is_bool($binding)) {
23 7
                $binding = $binding ? 'true' : 'false';
24
            }
25
        }
26
27 9
        return $this->parentStringifyBindings($bindings);
28
    }
29
30
    /**
31
     * Get the bindings for a "Has View" statement.
32
     *
33
     * @param string $view
34
     * @return array
35
     */
36 3
    protected function getBindingsForHasView($view)
37
    {
38 3
        [, $schema, $view] = $this->parseSchemaAndTable($view);
39
40 3
        return [$schema, $view];
41
    }
42
}
43