Device::isComputer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php namespace Arcanedev\LaravelTracker\Models;
2
3
use Arcanedev\LaravelTracker\Contracts\Models\Device as DeviceContract;
4
5
/**
6
 * Class     Device
7
 *
8
 * @package  Arcanedev\LaravelTracker\Models
9
 * @author   ARCANEDEV <[email protected]>
10
 *
11
 * @property  int             id
12
 * @property  string          kind
13
 * @property  string          model
14
 * @property  string          platform
15
 * @property  string          platform_version
16
 * @property  \Carbon\Carbon  created_at
17
 * @property  \Carbon\Carbon  updated_at
18
 */
19
class Device extends AbstractModel implements DeviceContract
20
{
21
    /* -----------------------------------------------------------------
22
     |  Properties
23
     | -----------------------------------------------------------------
24
     */
25
26
    /**
27
     * The table associated with the model.
28
     *
29
     * @var string
30
     */
31
    protected $table = 'devices';
32
33
    /**
34
     * The attributes that are mass assignable.
35
     *
36
     * @var array
37
     */
38
    protected $fillable = [
39
        'kind',
40
        'model',
41
        'platform',
42
        'platform_version',
43
    ];
44
45
    /**
46
     * The attributes that should be cast to native types.
47
     *
48
     * @var array
49
     */
50
    protected $casts = [
51
        'id' => 'integer',
52
    ];
53
54
    /* -----------------------------------------------------------------
55
     |  Check Methods
56
     | -----------------------------------------------------------------
57
     */
58
59
    /**
60
     * Is this a computer?
61
     *
62
     * @return bool
63
     */
64
    public function isComputer()
65
    {
66
        return $this->kind == static::KIND_COMPUTER;
67
    }
68
69
    /**
70
     * Is this a phone?
71
     *
72
     * @return bool
73
     */
74
    public function isPhone()
75
    {
76
        return $this->kind == static::KIND_PHONE;
77
    }
78
79
    /**
80
     * Is this a tablet?
81
     *
82
     * @return bool
83
     */
84
    public function isTablet()
85
    {
86
        return $this->kind == static::KIND_TABLET;
87
    }
88
}
89