Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
50.00% covered (danger)
50.00%
10 / 20
CRAP
93.33% covered (success)
93.33%
364 / 390
PropertyAccessor
0.00% covered (danger)
0.00%
0 / 1
50.00% covered (danger)
50.00%
10 / 20
214.09
93.33% covered (success)
93.33%
364 / 390
 __construct
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
5 / 5
 getValue
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
6 / 6
 setValue
0.00% covered (danger)
0.00%
0 / 1
12.04
93.75% covered (success)
93.75%
30 / 32
 throwInvalidArgumentException
0.00% covered (danger)
0.00%
0 / 1
11.90
73.33% covered (warning)
73.33%
11 / 15
 isReadable
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
9 / 9
 isWritable
0.00% covered (danger)
0.00%
0 / 1
9.01
94.44% covered (success)
94.44%
17 / 18
 readPropertiesUntil
100.00% covered (success)
100.00%
1 / 1
21
100.00% covered (success)
100.00%
28 / 28
 readIndex
100.00% covered (success)
100.00%
1 / 1
7
100.00% covered (success)
100.00%
11 / 11
 readProperty
0.00% covered (danger)
0.00%
0 / 1
23
97.14% covered (success)
97.14%
34 / 35
 getReadAccessInfo
0.00% covered (danger)
0.00%
0 / 1
23
96.30% covered (success)
96.30%
52 / 54
 writeIndex
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
4 / 4
 writeProperty
0.00% covered (danger)
0.00%
0 / 1
10.14
88.89% covered (warning)
88.89%
16 / 18
 writeCollection
100.00% covered (success)
100.00%
1 / 1
10
100.00% covered (success)
100.00%
16 / 16
 getWriteAccessInfo
0.00% covered (danger)
0.00%
0 / 1
30
98.75% covered (success)
98.75%
79 / 80
 isPropertyWritable
0.00% covered (danger)
0.00%
0 / 1
13.04
93.75% covered (success)
93.75%
15 / 16
 camelize
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 findAdderAndRemover
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
12 / 12
 isMethodAccessible
100.00% covered (success)
100.00%
1 / 1
5
100.00% covered (success)
100.00%
7 / 7
 getPropertyPath
0.00% covered (danger)
0.00%
0 / 1
8.05
61.54% covered (warning)
61.54%
8 / 13
 createCache
0.00% covered (danger)
0.00%
0 / 1
18.35
30.00% covered (danger)
30.00%
3 / 10
<?php
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Symfony\Component\PropertyAccess;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\Component\Inflector\Inflector;
use Symfony\Component\PropertyAccess\Exception\AccessException;
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
/**
 * Default implementation of {@link PropertyAccessorInterface}.
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 * @author K√©vin Dunglas <dunglas@gmail.com>
 * @author Nicolas Grekas <p@tchwork.com>
 */
class PropertyAccessor implements PropertyAccessorInterface
{
    private const VALUE = 0;
    private const REF = 1;
    private const IS_REF_CHAINED = 2;
    private const ACCESS_HAS_PROPERTY = 0;
    private const ACCESS_TYPE = 1;
    private const ACCESS_NAME = 2;
    private const ACCESS_REF = 3;
    private const ACCESS_ADDER = 4;
    private const ACCESS_REMOVER = 5;
    private const ACCESS_TYPE_METHOD = 0;
    private const ACCESS_TYPE_PROPERTY = 1;
    private const ACCESS_TYPE_MAGIC = 2;
    private const ACCESS_TYPE_ADDER_AND_REMOVER = 3;
    private const ACCESS_TYPE_NOT_FOUND = 4;
    private const CACHE_PREFIX_READ = 'r';
    private const CACHE_PREFIX_WRITE = 'w';
    private const CACHE_PREFIX_PROPERTY_PATH = 'p';
    /**
     * @var bool
     */
    private $magicCall;
    private $ignoreInvalidIndices;
    private $ignoreInvalidProperty;
    /**
     * @var CacheItemPoolInterface
     */
    private $cacheItemPool;
    private $propertyPathCache = [];
    private $readPropertyCache = [];
    private $writePropertyCache = [];
    private static $resultProto = [self::VALUE => null];
    /**
     * Should not be used by application code. Use
     * {@link PropertyAccess::createPropertyAccessor()} instead.
     */
    public function __construct(bool $magicCall = false, bool $throwExceptionOnInvalidIndex = false, CacheItemPoolInterface $cacheItemPool = null, bool $throwExceptionOnInvalidPropertyPath = true)
    {
        $this->magicCall = $magicCall;