1 | <?php |
||
11 | abstract class AbstractPanel implements IBarPanel, ILaravelPanel |
||
12 | { |
||
13 | /** |
||
14 | * $attributes. |
||
15 | * |
||
16 | * @var mixed |
||
17 | */ |
||
18 | protected $attributes; |
||
19 | |||
20 | /** |
||
21 | * $viewPath. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $viewPath = null; |
||
26 | |||
27 | /** |
||
28 | * $template. |
||
29 | * |
||
30 | * @var \Recca0120\LaravelTracy\Template |
||
31 | */ |
||
32 | protected $template; |
||
33 | |||
34 | /** |
||
35 | * $laravel description. |
||
36 | * |
||
37 | * @var \Illuminate\Contracts\Foundation\Application |
||
38 | */ |
||
39 | protected $laravel; |
||
40 | |||
41 | /** |
||
42 | * __construct. |
||
43 | * |
||
44 | * @param \Recca0120\LaravelTracy\Template $template |
||
45 | */ |
||
46 | 17 | public function __construct(Template $template = null) |
|
47 | { |
||
48 | 17 | $this->template = $template ?: new Template; |
|
49 | 17 | } |
|
50 | |||
51 | /** |
||
52 | * setLaravel. |
||
53 | * |
||
54 | * @param \Illuminate\Contracts\Foundation\Application $laravel |
||
55 | * @return $this |
||
56 | */ |
||
57 | 14 | public function setLaravel(Application $laravel = null) |
|
58 | { |
||
59 | 14 | if (is_null($laravel) === false) { |
|
60 | 14 | $this->laravel = $laravel; |
|
61 | } |
||
62 | |||
63 | 14 | return $this; |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * Renders HTML code for custom tab. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 16 | public function getTab() |
|
72 | { |
||
73 | 16 | return $this->render('tab'); |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * Renders HTML code for custom panel. |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | 14 | public function getPanel() |
|
82 | { |
||
83 | 14 | return $this->render('panel'); |
|
84 | } |
||
85 | |||
86 | /** |
||
87 | * has laravel. |
||
88 | * |
||
89 | * @return bool |
||
90 | */ |
||
91 | 14 | protected function hasLaravel() |
|
95 | |||
96 | /** |
||
97 | * render. |
||
98 | * |
||
99 | * @param string $view |
||
100 | * @return string |
||
101 | */ |
||
102 | 16 | protected function render($view) |
|
113 | |||
114 | /** |
||
115 | * getViewPath. |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 16 | protected function getViewPath() |
|
127 | |||
128 | /** |
||
129 | * getAttributes. |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | abstract protected function getAttributes(); |
||
134 | |||
135 | /** |
||
136 | * Use a backtrace to search for the origin of the query. |
||
137 | * |
||
138 | * @return string|array |
||
139 | */ |
||
140 | 4 | protected static function findSource() |
|
165 | |||
166 | /** |
||
167 | * editor link. |
||
168 | * |
||
169 | * @param string|array $source |
||
170 | * @return string |
||
171 | */ |
||
172 | 6 | protected static function editorLink($source) |
|
184 | } |
||
185 |