VideoController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A show() 0 16 1
1
<?php
2
3
namespace LearnParty\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use LearnParty\Http\Requests;
7
use LearnParty\Video;
8
use LearnParty\Comment;
9
use LearnParty\User;
10
11
class VideoController extends Controller
12
{
13
    /**
14
     * Show a single video, comments, favorites, views and categories
15
     *
16
     * @param  Integer $id Video Id
17
     * @return View
18
     */
19
    public function show($id)
20
    {
21
        $video = $this->videoRepository->getVideo($id);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $video is correct as $this->videoRepository->getVideo($id) (which targets LearnParty\Http\Reposito...oRepository::getVideo()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
22
23
        $user = $video->user;
24
        $categories = $video->categories;
25
        $favorites = $video->favorites;
26
27
        $likesVideo = $this->videoRepository->getLikeStatus($video);
28
29
        $comments = $this->videoRepository->getAllComments($id);
30
31
        $this->videoRepository->updateViews($id);
32
33
        return view('video.video', compact('video', 'categories', 'comments', 'user', 'favorites', 'likesVideo'));
34
    }
35
}
36