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

PostgresBuilder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 34
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stringifyBindings() 0 9 4
A getBindingsForHasView() 0 5 1
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