Completed
Push — master ( e6a217...ab75c5 )
by recca
03:02
created

TerminalPanel::getPanel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
1
<?php
2
3
namespace Recca0120\LaravelTracy\Panels;
4
5
use Exception;
6
use Recca0120\Terminal\Http\Controllers\TerminalController;
7
8
class TerminalPanel extends AbstractPanel
9
{
10
    /**
11
     * getAttributes.
12
     *
13
     * @return array
14
     */
15 2
    protected function getAttributes()
16
    {
17
        $data = [
18 2
            'terminal' => null,
19 2
        ];
20 2
        if ($this->hasLaravel() === true) {
21
            try {
22 2
                $controller = $this->laravel->make(TerminalController::class);
23 1
                $response = $this->laravel->call([$controller, 'index'], ['view' => 'panel']);
24 1
                $data['terminal'] = $response->getContent();
25 2
            } catch (Exception $e) {
26 1
                $data['terminal'] = $e->getMessage();
27
            }
28 2
        }
29
30 2
        return $data;
31
    }
32
33
    /**
34
     * Renders HTML code for custom panel.
35
     *
36
     * @return string
37
     */
38 2
    public function getPanel()
39
    {
40 2
        $this->template->minify(false);
41
42 2
        return $this->render('panel');
43
    }
44
}
45