AbstractBuilder::__call()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\LaravelHtml;
6
7
use Arcanedev\LaravelHtml\Traits\Componentable;
8
use BadMethodCallException;
9
use Illuminate\Support\Traits\Macroable;
10
11
/**
12
 * Class     AbstractBuilder
13
 *
14
 * @author   ARCANEDEV <[email protected]>
15
 */
16
abstract class AbstractBuilder
17
{
18
    /* -----------------------------------------------------------------
19
     |  Traits
20
     | -----------------------------------------------------------------
21
     */
22
23 1
    use Macroable, Componentable {
24
        Macroable::__call     as macroCall;
25
        Componentable::__call as componentCall;
26
    }
27
28
    /* -----------------------------------------------------------------
29
     |  Main Methods
30
     | -----------------------------------------------------------------
31
     */
32
33
    /**
34
     * Dynamically handle calls to the class.
35
     *
36
     * @param  string  $method
37
     * @param  array   $parameters
38
     *
39
     * @return mixed
40
     *
41
     * @throws \BadMethodCallException
42
     */
43 12
    public function __call($method, $parameters)
44
    {
45
        try {
46 12
            return $this->componentCall($method, $parameters);
47
        }
48 6
        catch (BadMethodCallException $e) {
49 6
            return $this->macroCall($method, $parameters);
50
        }
51
    }
52
}
53