Completed
Push — master ( f36413...406191 )
by ARCANEDEV
08:57
created

SessionPresenter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 19
c 1
b 0
f 0
ccs 0
cts 4
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getLocationNameAttribute() 0 7 2
1
<?php namespace Arcanedev\LaravelTracker\Models\Presenters;
2
3
/**
4
 * Class     SessionPresenter
5
 *
6
 * @package  Arcanedev\LaravelTracker\Models\Presenters
7
 * @author   ARCANEDEV <[email protected]>
8
 *
9
 * @property  string  location_name
10
 */
11
trait SessionPresenter
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Get the `location_name` attribute.
19
     *
20
     * @return string
21
     */
22
    public function getLocationNameAttribute()
23
    {
24
        if (is_null($this->geo_ip))
0 ignored issues
show
Bug introduced by
The property geo_ip 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...
25
            return 'undefined';
26
27
        return $this->geo_ip->country_name . ' ' . $this->geo_ip->city;
28
    }
29
}
30