Completed
Push — master ( 1f44ff...9311e4 )
by Emily
02:16
created

AutoConstructTrait::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of the Composite Utils package.
4
 *
5
 * (c) Emily Shepherd <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the
8
 * LICENSE.md file that was distributed with this source code.
9
 *
10
 * @package spaark/composite-utils
11
 * @author Emily Shepherd <emily@emilyshepherd>
12
 * @license MIT
13
 */
14
15
namespace Spaark\CompositeUtils\Traits;
16
17
use Spaark\CompositeUtils\Service\PropertyAccessor;
18
19
trait AutoConstructTrait
20
{
21
    use HasReflectorTrait;
22
23 3
    public function __construct(...$args)
24
    {
25 3
        $this->autoBuild(...$args);
26 2
    }
27
28 3
    protected function autoBuild(...$args)
29
    {
30 3
        (new PropertyAccessor($this, static::getReflectionComposite()))
31 3
            ->constructObject(...$args);
32 2
    }
33
}
34
35