SetContent   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 33
loc 33
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A handle() 6 6 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 namespace Anomaly\DashboardModule\Widget\Extension\Command;
2
3
use Anomaly\DashboardModule\Widget\Contract\WidgetInterface;
4
use Illuminate\Contracts\View\Factory;
5
6
/**
7
 * Class SetContent
8
 *
9
 * @link          http://pyrocms.com/
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 */
13 View Code Duplication
class SetContent
0 ignored issues
show
Duplication introduced by
This class 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...
14
{
15
16
    /**
17
     * The widget extension.
18
     *
19
     * @var WidgetInterface
20
     */
21
    protected $widget;
22
23
    /**
24
     * Create a new SetContent instance.
25
     *
26
     * @param WidgetInterface $widget
27
     */
28
    public function __construct(WidgetInterface $widget)
29
    {
30
        $this->widget = $widget;
31
    }
32
33
    /**
34
     * Handle the output.
35
     *
36
     * @param  Factory                         $view
37
     * @return \Illuminate\Contracts\View\View
38
     */
39
    public function handle(Factory $view)
40
    {
41
        $extension = $this->widget->getExtension();
42
43
        $this->widget->setContent($view->make($extension->getView(), ['widget' => $this->widget]));
44
    }
45
}
46