Model   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fill() 0 10 3
A toArray() 0 4 1
1
<?php
2
3
namespace Darkgoldblade01\Dnd5eApi\Models;
4
5
/**
6
 * Class Model
7
 * @package Darkgoldblade01\Dnd5eApi\Models
8
 */
9
class Model
10
{
11
12
    /**
13
     * Fill the Model with
14
     * the data from the array.
15
     *
16
     * @param array $data
17
     *
18
     * @return Model
19
     */
20
    public function fill(array $data): Model
21
    {
22
        foreach($data AS $key => $value) {
23
            if($key === 'url') {
24
                continue;
25
            }
26
            $this->{$key} = $value;
27
        }
28
        return $this;
29
    }
30
31
    /**
32
     * Convert the Model to an array
33
     *
34
     * @return array
35
     */
36
    public function toArray(): array
37
    {
38
        return (array) $this;
39
    }
40
41
}
42