• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daycry / class-finder / 16724626674

04 Aug 2025 01:32PM UTC coverage: 82.262% (-12.2%) from 94.493%
16724626674

push

github

web-flow
Update php.yml

320 of 389 relevant lines covered (82.26%)

3.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/Libraries/BaseFactory.php
1
<?php
2

3
namespace Daycry\ClassFinder\Libraries;
4

5
use Config\Autoload;
6

7
class BaseFactory
8
{
9
    private $composer;
10
    private ?Autoload $config                   = null;
11
    private ?array $classMapCache               = null;
12
    private ?array $psr4Cache                   = null;
13
    private ?array $autoloadConfigPsr4Cache     = null;
14
    private ?array $autoloadConfigClassMapCache = null;
15
    private ?array $autoloadConfigFilesCache    = null;
16

17
    public function __construct()
18
    {
19
        $this->composer = include COMPOSER_PATH;
8✔
20
    }
21

22
    private function getConfig(): Autoload
23
    {
24
        return $this->config ??= new Autoload();
8✔
25
    }
26

27
    protected function getClassMap(): array
28
    {
29
        return $this->classMapCache ??= $this->composer->getClassMap();
3✔
30
    }
31

32
    protected function getPSR4(): array
33
    {
34
        return $this->psr4Cache ??= $this->composer->getPrefixesPsr4();
2✔
35
    }
36

37
    protected function loadAutoloadConfigPsr4(): array
38
    {
39
        if ($this->autoloadConfigPsr4Cache !== null) {
2✔
40
            return $this->autoloadConfigPsr4Cache;
×
41
        }
42

43
        $namespaces = [];
2✔
44
        $config     = $this->getConfig();
2✔
45

46
        foreach ($config->psr4 as $psr4 => $dir) {
2✔
47
            $psr4              = rtrim($psr4, '\\') . '\\';
2✔
48
            $namespaces[$psr4] = [$dir];
2✔
49
        }
50

51
        return $this->autoloadConfigPsr4Cache = $namespaces;
2✔
52
    }
53

54
    protected function loadAutoloadConfigClassMap(): array
55
    {
56
        if ($this->autoloadConfigClassMapCache !== null) {
3✔
57
            return $this->autoloadConfigClassMapCache;
×
58
        }
59

60
        $config = $this->getConfig();
3✔
61

62
        return $this->autoloadConfigClassMapCache = $config->classmap;
3✔
63
    }
64

65
    protected function loadAutoloadConfigFiles(): array
66
    {
67
        if ($this->autoloadConfigFilesCache !== null) {
3✔
68
            return $this->autoloadConfigFilesCache;
×
69
        }
70

71
        helper('text');
3✔
72

73
        $files  = [];
3✔
74
        $config = $this->getConfig();
3✔
75

76
        foreach ($config->files as $file) {
3✔
77
            $files[random_string('alnum', 32)] = $file;
×
78
        }
79

80
        return $this->autoloadConfigFilesCache = $files;
3✔
81
    }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc