Passed
Push — master ( aa397c...819f04 )
by Thomas
02:33
created

SidebarService::getConsoleOutput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Services;
4
5
use Webfactor\Laravel\Generators\Contracts\ServiceAbstract;
6
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
7
8
class SidebarService extends ServiceAbstract implements ServiceInterface
9
{
10
    protected $key = 'sidebar';
11
12
    public function getConsoleOutput()
13
    {
14
        return 'Added sidebar item to '.$this->command->naming[$this->key]->getRelativeFilePath();
15
    }
16
17
    public function call()
18
    {
19
        $sidebarFile = $this->naming->getFile();
20
21
        if ($this->filesystem->exists($sidebarFile)) {
22
            $this->filesystem->append($sidebarFile, $this->getSidebarString());
23
            $this->addGeneratedFileToIdeStack();
24
        }
25
    }
26
27
    private function getSidebarString()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
28
    {
29
        return <<<FILE
30
31
<li>
32
    <a href="{{ backpack_url('{$this->command->naming['routeFile']->getName()}') }}">
33
        <i class="fa fa-question"></i><span>{{ trans('models.{$this->command->naming['languageFile']->getName()}.plural') }}</span>
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 131 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
34
    </a>
35
</li>
36
FILE;
37
    }
38
}
39