Passed
Push — master ( f58add...4aa999 )
by Luis
54s queued 13s
created

src/Parser/CodebaseDirectory.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 7.4
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Parser;
9
10
use SplFileInfo;
11
use Webmozart\Assert\Assert;
0 ignored issues
show
The type Webmozart\Assert\Assert was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
final class CodebaseDirectory
14
{
15
    private SplFileInfo $directory;
16
17 96
    public function __construct(string $path)
18
    {
19 96
        $this->setDirectory($path);
20
    }
21
22 87
    public function absolutePath(): string
23
    {
24 87
        return (string) $this->directory->getRealPath();
25
    }
26
27 96
    private function setDirectory(string $path): void
28
    {
29 96
        Assert::stringNotEmpty(
30 87
            $path,
31
            'The directory with the code to be scanned cannot be empty'
32 96
        );
33
        $directory = new SplFileInfo($path);
34 96
        if (! $directory->isDir()) {
35 9
            throw InvalidDirectory::notFoundAt($directory);
36
        }
37 87
        $this->directory = $directory;
38 87
    }
39
}
40