Completed
Push — master ( 5d8274...535412 )
by Elf
03:21
created

DeviceModelAttribute   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDeviceModelAttribute() 0 6 2
1
<?php
2
3
namespace ElfSundae\Laravel\Support\Traits;
4
5
use ElfSundae\Laravel\Support\Helper;
6
7
trait DeviceModelAttribute
8
{
9
    /**
10
     * Get the `device_model` attribute.
11
     *
12
     * @return string|null
13
     */
14
    public function getDeviceModelAttribute()
15
    {
16
        $platform = property_exists($this, 'deviceModelKey') ? $this->deviceModelKey : 'platform';
1 ignored issue
show
Bug introduced by
The property deviceModelKey does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
17
18
        return Helper::iDeviceModel($this->{$platform});
19
    }
20
}
21