Passed
Push — develop ( c02995...7d7bf0 )
by Septianata
18:18
created

Attribute::getGoogleMapUrlAttribute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 10
cc 2
nc 2
nop 1
crap 2.0625
1
<?php
2
3
namespace App\Models\Concerns\Branch;
4
5
/**
6
 * @property string $name
7
 * @property string $address
8
 * @property float $address_latitude
9
 * @property float $address_longitude
10
 * @property string $google_map_url
11
 *
12
 * @see \App\Models\Branch
13
 */
14
trait Attribute
15
{
16
    /**
17
     * Return "google_map_url" attribute value.
18
     *
19
     * @param  mixed  $value
20
     * @return string
21
     */
22 2
    public function getGoogleMapUrlAttribute($value): string
23
    {
24 2
        if (!is_null($value)) {
25 2
            return $value;
26
        }
27
28
        return google_map_url($this->address_latitude, $this->address_longitude);
29
    }
30
}
31