LogoComposer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A compose() 0 13 1
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Http\ViewComposers;
9
10
use Illuminate\Contracts\View\View;
11
12
class LogoComposer
13
{
14
    public function __construct()
15
    {
16
    }
17
18
    /**
19
     * Bind data to the view.
20
     *
21
     * @param View $view
22
     *
23
     * @return void
24
     */
25
    public function compose(View $view)
26
    {
27
        //$logo = Logo::inRandomOrder()->take(1)->get()->first();
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
        $logo = \DB::table('logos')
29
            ->leftJoin('users', 'logos.user_id', '=', 'users.id')
30
            ->leftJoin('logo_votes', 'logos.id', '=', 'logo_votes.logo_id')
31
            ->select(['logos.title', 'logos.filename', 'users.name', 'users.id'])
32
            ->whereRaw('(logo_votes.up - logo_votes.down) > 0')
33
            ->inRandomOrder()
34
            ->first();
35
36
        $view->with('logo', $logo);
37
    }
38
}
39