Failed Conditions
Pull Request — master (#28)
by Dallas
06:04
created

CreateFunctionBuilder::__call()   B

Complexity

Conditions 7
Paths 7

Size

Total Lines 30
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 56

Importance

Changes 0
Metric Value
eloc 25
c 0
b 0
f 0
dl 0
loc 30
ccs 0
cts 24
cp 0
rs 8.5866
cc 7
nc 7
nop 2
crap 56
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\Postgres\Schema\Builders\Routines;
6
7
use Illuminate\Support\Fluent;
8
use Umbrellio\Postgres\Schema\Builders\Routines\Functions\ExecutionBuilder;
9
use Umbrellio\Postgres\Schema\Builders\Routines\Functions\FunctionArgumentBuilder;
10
use Umbrellio\Postgres\Schema\Builders\Routines\Functions\FunctionSecurityBuilder;
11
use Umbrellio\Postgres\Schema\Builders\Routines\Functions\FunctionSetBuilder;
12
use Umbrellio\Postgres\Schema\Builders\Routines\Functions\ParallelBuilder;
13
use Umbrellio\Postgres\Schema\Builders\Routines\Functions\StabilityBuilder;
14
15
class CreateFunctionBuilder extends Fluent
16
{
17
    public function __call($method, $parameters)
18
    {
19
        switch ($method) {
20
            case 'arg':
21
                $command = new FunctionArgumentBuilder($this);
22
                $this->attributes[$method] = call_user_func_array([$command, $method], $parameters);
23
                break;
24
            case 'stability':
25
                $command = new StabilityBuilder($this);
26
                $this->attributes[$method] = call_user_func_array([$command, $method], $parameters);
27
                break;
28
            case 'execution':
29
                $command = new ExecutionBuilder($this);
30
                break;
31
            case 'security':
32
                $command = new FunctionSecurityBuilder($this);
33
                break;
34
            case 'set':
35
                $command = new FunctionSetBuilder($this);
36
                break;
37
            case 'parallel':
38
                $command = new ParallelBuilder($this);
39
                break;
40
            default:
41
                $command = $this;
42
        }
43
44
        parent::__call($method, $parameters);
45
46
        return $command ?? $this;
47
    }
48
}
49