Passed
Push — master ( a6591a...012b67 )
by Angel Fernando Quiroz
10:47 queued 26s
created

PluginEntityLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntityDirectories() 0 11 2
A __construct() 0 3 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Service;
8
9
use Symfony\Component\Finder\Finder;
10
11
readonly class PluginEntityLoader
12
{
13
    public function __construct(
14
        private string $pluginDir,
15
    ) {}
16
17
    public function getEntityDirectories(): array
18
    {
19
        $finder = new Finder();
20
        $finder->directories()->in($this->pluginDir)->name('Entity')->depth('== 1');
21
22
        $directories = [];
23
        foreach ($finder as $dir) {
24
            $directories[] = $dir->getRealPath();
25
        }
26
27
        return $directories;
28
    }
29
}
30