User   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 31
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 4 4 1
A mentions() 4 4 1
A messages() 4 4 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
declare(strict_types = 1);
3
/**
4
 * This file is part of GitterBot package.
5
 *
6
 * @author Serafim <[email protected]>
7
 * @date 23.03.2016 20:17
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
namespace Domains\User;
13
14
use Carbon\Carbon;
15
use Domains\Message\Message;
16
use Illuminate\Support\Collection;
17
18
/**
19
 * Class User
20
 * TODO This class doesnot implemented Yet
21
 *
22
 * @package Domains\User
23
 * @property string $login
24
 * @property string $name
25
 * @property Carbon $created_at
26
 * @property Carbon $updated_at
27
 * @property-read Mention[]|Collection $mentions
28
 * @property-read Message[]|Collection $messages
29
 */
30 View Code Duplication
class User extends \Eloquent
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...
31
{
32
    /**
33
     * @var string
34
     */
35
    protected $table = 'users';
36
37
    /**
38
     * @return string
39
     */
40
    public function getId()
41
    {
42
        return $this->id;
43
    }
44
45
    /**
46
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
47
     */
48
    public function mentions()
49
    {
50
        return $this->hasMany(Mention::class, 'user_id', 'id');
51
    }
52
53
    /**
54
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
55
     */
56
    public function messages()
57
    {
58
        return $this->hasMany(Message::class, 'user_id', 'id');
59
    }
60
}
61