GameViewListener   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 6 1
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Listeners;
9
10
use App\Events\GameView;
11
12
class GameViewListener
13
{
14
    /**
15
     * Create the event listener.
16
     *
17
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
18
     */
19
    public function __construct()
20
    {
21
        //
22
    }
23
24
    /**
25
     * Handle the event.
26
     *
27
     * @param GameView $event
28
     *
29
     * @return void
30
     */
31
    public function handle(GameView $event)
32
    {
33
        \DB::table('games')
34
            ->where('id', '=', $event->gameid)
35
            ->increment('views');
36
    }
37
}
38