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

object_assign_value_using_setter_methods()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 3
nop 3
dl 0
loc 14
ccs 7
cts 7
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A set_object_property_value() 0 3 1
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