Completed
Push — master ( f96373...76c18a )
by Thomas
22s
created

DebugClassLoader   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A findFile() 0 10 4
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Action\EnableDebugClassLoader;
15
16
use Symfony\Component\Debug\DebugClassLoader as BaseDebugClassLoader;
17
18
class DebugClassLoader extends BaseDebugClassLoader
19
{
20
    /**
21
     * @var bool|null
22
     */
23
    private $isFinder = null;
24
25
    public function findFile(string $class): ?string
26
    {
27
        if (null === $this->isFinder) {
28
            $refl = new \ReflectionProperty(BaseDebugClassLoader::class, 'isFinder');
29
            $refl->setAccessible(true);
30
31
            $this->isFinder = $refl->getValue($this);
32
        }
33
34
        return $this->isFinder ? $this->getClassLoader()[0]->findFile($class) ?: null : null;
35
    }
36
}
37