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

PluginEntityLoader::getEntityDirectories()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 11
rs 10
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