ArrayPopulatedObject::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gnutix\Library\Helper;
6
7
use Webmozart\Assert\Assert;
8
9
abstract class ArrayPopulatedObject
10
{
11
    public function __construct(array $data = [])
12
    {
13
        foreach ($data as $property => $value) {
14
            Assert::propertyExists($this, $property);
15
            $this->{$property} = $value;
16
        }
17
    }
18
}
19