Completed
Push — master ( 2daeca...cab24a )
by Tyler
02:26
created

Model::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
rs 9.4285
cc 3
eloc 5
nc 4
nop 1
crap 3
1
<?php
2
3
namespace Zenapply\PeopleMatter\Models;
4
5
class Model
6
{
7
    protected $properties = [
8
        
9
    ];
10
    
11 12
    public function __construct($options)
12
    {
13 12
        foreach ($this->properties as $key) {
14 6
            $this->{$key} = "";
15 12
        }
16
17 12
        foreach ($options as $key => $value) {
18 12
            $this->{$key} = $value;
19 12
        }
20 12
    }
21
22 3
    public function toArray()
23
    {
24 3
        $arr = [];
25 3
        foreach ($this->properties as $key) {
26 3
            $arr[$key] = $this->{$key};
27 3
        }
28 3
        return $arr;
29
    }
30
}
31