1
|
|
|
<?php namespace Arcanedev\LaravelHtml\Bases; |
2
|
|
|
|
3
|
|
|
use Arcanedev\LaravelHtml\Traits\Componentable; |
4
|
|
|
use BadMethodCallException; |
5
|
|
|
use Illuminate\Support\HtmlString; |
6
|
|
|
use Illuminate\Support\Traits\Macroable; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class Builder |
10
|
|
|
* |
11
|
|
|
* @package Arcanedev\LaravelHtml\Bases |
12
|
|
|
* @author ARCANEDEV <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
abstract class Builder |
15
|
|
|
{ |
16
|
|
|
/* ------------------------------------------------------------------------------------------------ |
17
|
|
|
| Traits |
18
|
|
|
| ------------------------------------------------------------------------------------------------ |
19
|
|
|
*/ |
20
|
|
|
use Macroable, Componentable { |
21
|
|
|
Macroable::__call as macroCall; |
22
|
|
|
Componentable::__call as componentCall; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/* ------------------------------------------------------------------------------------------------ |
26
|
|
|
| Main Functions |
27
|
|
|
| ------------------------------------------------------------------------------------------------ |
28
|
|
|
*/ |
29
|
|
|
/** |
30
|
|
|
* Dynamically handle calls to the class. |
31
|
|
|
* |
32
|
|
|
* @param string $method |
33
|
|
|
* @param array $parameters |
34
|
|
|
* |
35
|
|
|
* @return \Illuminate\Contracts\View\View|mixed |
36
|
|
|
* |
37
|
|
|
* @throws \BadMethodCallException |
38
|
|
|
*/ |
39
|
8 |
|
public function __call($method, $parameters) |
40
|
|
|
{ |
41
|
|
|
try { |
42
|
8 |
|
return $this->componentCall($method, $parameters); |
43
|
|
|
} |
44
|
|
|
catch (BadMethodCallException $e) { |
45
|
|
|
// Continue |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
return $this->macroCall($method, $parameters); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/* ------------------------------------------------------------------------------------------------ |
52
|
|
|
| Other Functions |
53
|
|
|
| ------------------------------------------------------------------------------------------------ |
54
|
|
|
*/ |
55
|
|
|
/** |
56
|
|
|
* Transform the string to an Html serializable object |
57
|
|
|
* |
58
|
|
|
* @param string $html |
59
|
|
|
* |
60
|
|
|
* @return \Illuminate\Support\HtmlString |
61
|
|
|
*/ |
62
|
944 |
|
protected function toHtmlString($html) |
63
|
|
|
{ |
64
|
944 |
|
return new HtmlString($html); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|