DashboardComposer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 1
c 2
b 1
f 1
lcom 0
cbo 4
dl 15
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 7 7 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
/*
4
 * This file is part of Gitamin.
5
 *
6
 * Copyright (C) 2015-2016 The Gitamin Team
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Gitamin\Composers;
13
14
use Gitamin\Models\Group;
15
use Gitamin\Models\Issue;
16
use Gitamin\Models\Moment;
17
use Gitamin\Models\Project;
18
use Illuminate\Contracts\View\View;
19
20 View Code Duplication
class DashboardComposer
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...
21
{
22
    /**
23
     * Bind data to the view.
24
     *
25
     * @param \Illuminate\Contracts\View\View $view
26
     */
27
    public function compose(View $view)
28
    {
29
        $view->withIssueCount(Issue::all()->count());
0 ignored issues
show
Bug introduced by
The method withIssueCount() does not seem to exist on object<Illuminate\Contracts\View\View>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
        $view->withProjectCount(Project::all()->count());
0 ignored issues
show
Bug introduced by
The method withProjectCount() does not seem to exist on object<Illuminate\Contracts\View\View>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
        $view->withGroupCount(Group::IsGroup()->Mine()->count());
0 ignored issues
show
Bug introduced by
The method IsGroup() does not exist on Gitamin\Models\Group. Did you maybe mean scopeIsGroup()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
Bug introduced by
The method withGroupCount() does not seem to exist on object<Illuminate\Contracts\View\View>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        $view->withMomentCount(Moment::all()->count());
0 ignored issues
show
Bug introduced by
The method withMomentCount() does not seem to exist on object<Illuminate\Contracts\View\View>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
    }
34
}
35