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

Location   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fill() 0 10 3
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