SymfonyPropertyAccessor::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\Mapper\Handler\PropertyAccessor;
5
6
use Symfony\Component\PropertyAccess\PropertyAccessorInterface as SymfonyPropertyAccessorInterface;
7
8
/**
9
 * A property-accessor implementation based on the Symfony PropertyAccess component.
10
 *
11
 * @see http://symfony.com/doc/current/components/property_access.html
12
 *
13
 * @package Mikemirten\Component\JsonApi\Mapper\Handler\PropertyAccessor
14
 */
15
class SymfonyPropertyAccessor implements PropertyAccessorInterface
16
{
17
    protected $accessor;
18
19
    /**
20
     * SymfonyPropertyAccessor constructor.
21
     *
22
     * @param SymfonyPropertyAccessorInterface $accessor
23
     */
24 1
    public function __construct(SymfonyPropertyAccessorInterface $accessor)
25
    {
26 1
        $this->accessor = $accessor;
27 1
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    public function getValue($resource, string $path)
33
    {
34 1
        return $this->accessor->getValue($resource, $path);
35
    }
36
}