Passed
Push — master ( fe8da9...4bb742 )
by Saulius
02:35
created

define_object()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the sauls/helpers package.
4
 *
5
 * @author    Saulius Vaičeliūnas <[email protected]>
6
 * @link      http://saulius.vaiceliunas.lt
7
 * @copyright 2018
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Sauls\Component\Helper;
14
15
use Sauls\Component\Helper\Exception\ClassPropertyNotSetException;
16
use Sauls\Component\Helper\Exception\PropertyNotAccessibleException;
17
use Sauls\Component\Helper\Operation\ObjectOperation;
18
19
/**
20
 * @throws PropertyNotAccessibleException
21
 */
22
function define_object(object $object, array $properties, array $methodPrefixes = ['set', 'add']): object
23
{
24 2
    return (new ObjectOperation\DefineObject)->execute($object, $properties, $methodPrefixes);
25
}
26
27
/**
28
 * @throws PropertyNotAccessibleException
29
 */
30
function get_object_property_value(object $object, string $property, array $methodPrefixes = ['get', 'is'])
31
{
32 1
    return (new ObjectOperation\GetPropertyValue)->execute($object, $property, $methodPrefixes);
33
}
34
35
/**
36
 * @throws ClassPropertyNotSetException
37
 */
38
function set_object_property_value(object $object, string $property, $value): void
39
{
40 2
    (new ObjectOperation\SetPropertyValue)->execute($object, $property, $value);
41
}
42