Passed
Push — master ( 1f7f34...948e88 )
by Thomas
04:12 queued 02:03
created

SidebarService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 34.62 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 9
loc 26
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A call() 9 9 2
A getSidebarString() 0 11 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Webfactor\Laravel\Generators\Services;
4
5
use Illuminate\Filesystem\Filesystem;
6
use Webfactor\Laravel\Generators\Commands\MakeEntity;
7
use Webfactor\Laravel\Generators\Contracts\ServiceAbstract;
8
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
9
10
class SidebarService extends ServiceAbstract implements ServiceInterface
11
{
12
    protected $key = 'sidebar';
13
14 View Code Duplication
    public function call()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
    {
16
        $sidebarFile = $this->naming->getFile();
17
18
        if ($this->filesystem->exists($sidebarFile)) {
19
            $this->filesystem->append($sidebarFile, $this->getSidebarString());
20
            $this->addGeneratedFileToIdeStack();
21
        }
22
    }
23
24
    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...
25
    {
26
        return <<<FILE
27
28
<li>
29
    <a href="{{ backpack_url('{$this->command->naming['routeFile']->getName()}') }}">
30
        <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...
31
    </a>
32
</li>
33
FILE;
34
    }
35
}
36