Completed
Push — master ( 9792a6...aaaf86 )
by recca
10:22
created

TerminalPanel::getAttributes()   A

Complexity

Conditions 3
Paths 5

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

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