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

Profile   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 4
Bugs 1 Features 1
Metric Value
eloc 18
c 4
b 1
f 1
dl 0
loc 41
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMissionAttribute() 0 3 1
A getVisionAttribute() 0 3 1
A getLocationAttribute() 0 15 2
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