Location   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 11
c 4
b 0
f 0
dl 0
loc 38
ccs 0
cts 14
cp 0
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fill() 0 11 3
A __construct() 0 3 1
1
<?php
2
3
namespace Distilleries\Contentful\Models;
4
5
/**
6
 * @property string $lon
7
 * @property string $lat
8
 */
9
class Location
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    protected $fillable = [
15
        'lon',
16
        'lat',
17
    ];
18
19
    /**
20
     * Location constructor.
21
     *
22
     * @param  array  $attributes
23
     * @return void
24
     */
25
    public function __construct(array $attributes = [])
26
    {
27
        $this->fill($attributes);
28
    }
29
30
    /**
31
     * Fill the model with an array of attributes.
32
     *
33
     * @param  array  $attributes
34
     * @return $this
35
     */
36
    public function fill(array $attributes)
37
    {
38
        foreach ($this->fillable as $key => $value) {
39
            if (isset($attributes[$value])) {
40
                $this->{$value} = $attributes[$value];
41
            } else {
42
                $this->{$value} = null;
43
            }
44
        }
45
46
        return $this;
47
    }
48
}
49