Completed
Push — master ( 6ad8e7...beae1d )
by Maxime
05:13
created

Location::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Distilleries\Contentful\Models;
4
5
6
/**
7
 * @property string $lon
8
 * @property string $lat
9
 */
10
class Location
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    protected $fillable = [
16
        'lon',
17
        'lat'
18
    ];
19
20
    /**
21
     * @param  array $attributes
22
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
23
     */
24
    public function __construct(array $attributes = [])
25
    {
26
        $this->fill($attributes);
27
    }
28
29
    /**
30
     * Fill the model with an array of attributes.
31
     *
32
     * @param  array $attributes
33
     * @return $this
34
     *
35
     */
36
    public function fill(array $attributes)
37
    {
38
        foreach ($attributes as $key => $value) {
39
            if (in_array($key, $this->fillable)) {
40
                $this->{$key} = $value;
41
            }
42
        }
43
44
        return $this;
45
    }
46
47
}
48