User   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A validateValue() 0 4 2
A user() 0 4 1
A preference() 0 4 1
1
<?php
2
3
namespace NukaCode\Users\Models\User\Preference;
4
5
use App\Models\BaseModel;
6
7
class User extends BaseModel
8
{
9
    protected $table = 'preferences_users';
10
11
    protected static $observer = 'NukaCode\Users\Models\Observers\User\Preference\UserObserver';
12
13
    public function validateValue()
14
    {
15
        return (preg_match('/' . $this->preference->value . '/', $this->value) == 1 ? true : false);
16
    }
17
18
    public function user()
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
19
    {
20
        return $this->belongsTo('NukaCode\Users\Models\User', 'user_id');
21
    }
22
23
    public function preference()
24
    {
25
        return $this->belongsTo('NukaCode\Users\Models\User\Preference', 'preference_id');
26
    }
27
}
28