Completed
Push — master ( 101081...c2c5eb )
by ARCANEDEV
23s queued 10s
created

AbstractBuilder::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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