Passed
Pull Request — master (#36)
by Cristian
01:57
created

SidebarService   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 30
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getConsoleOutput() 0 3 1
A call() 0 9 2
A getSidebarString() 0 11 1
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
        return 'Added sidebar item to '.$this->command->naming[$this->key]->getRelativeFilePath();
14
    }
15
16
    public function call()
17
    {
18
        $sidebarFile = $this->naming->getFile();
19
20
        if ($this->filesystem->exists($sidebarFile)) {
21
            $this->filesystem->append($sidebarFile, $this->getSidebarString());
22
            $this->addGeneratedFileToIdeStack();
23
        }
24
    }
25
26
    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...
27
    {
28
        return <<<FILE
29
30
<li>
31
    <a href="{{ backpack_url('{$this->command->naming['routeFile']->getName()}') }}">
32
        <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...
33
    </a>
34
</li>
35
FILE;
36
    }
37
}
38