Passed
Push — master ( 25567b...280d06 )
by Innocent
02:56
created

Profile::getLocationAttribute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
cc 2
eloc 9
c 2
b 1
f 1
nc 2
nop 1
dl 0
loc 15
rs 9.9666
1
<?php
2
3
namespace FaithGen\SDK\Models\Ministry;
4
5
use FaithGen\SDK\Models\UuidModel;
6
use FaithGen\SDK\Traits\Relationships\Belongs\BelongsToMinistryTrait;
7
8
class Profile extends UuidModel
9
{
10
    use  BelongsToMinistryTrait;
11
12
    protected $table = 'fg_profiles';
13
14
    protected $casts = [
15
        'location' => 'array',
16
        'phones'   => 'array',
17
        'emails'   => 'array',
18
    ];
19
20
    //****************************************************************************//
21
    //***************************** MODEL ATTRIBUTES *****************************//
22
    //****************************************************************************///
23
24
    public function getVisionAttribute($val)
25
    {
26
        return ucfirst($val);
27
    }
28
29
    public function getMissionAttribute($val)
30
    {
31
        return ucfirst($val);
32
    }
33
34
    public function getLocationAttribute($location)
35
    {
36
        if (! $location) {
37
            return [
38
                'address'     => [
39
                    'name'      => 'not-set',
40
                    'formatted' => 'not-set',
41
                ],
42
                'locality'    => 'not-set',
43
                'country'     => 'not-set',
44
                'postal_code' => 'not-set',
45
            ];
46
        }
47
48
        return $location;
49
    }
50
51
    //****************************************************************************//
52
    //***************************** MODEL ATTRIBUTES *****************************//
53
    //****************************************************************************//
54
}
55