ParseSchemaFile::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace HSkrasek\OpenAPI\Command\Stages;
2
3
use HSkrasek\OpenAPI\Parsers\ParserFactory;
4
use League\Flysystem\FilesystemInterface;
5
use League\Pipeline\StageInterface;
6
7
class ParseSchemaFile implements StageInterface
8
{
9
    /**
10
     * @var FilesystemInterface
11
     */
12
    private $filesystem;
13
14
    public function __construct(FilesystemInterface $filesystem)
15
    {
16
        $this->filesystem = $filesystem;
17
    }
18
19
    /**
20
     * @inheritDoc
21
     */
22
    public function __invoke($payload)
23
    {
24
        return ParserFactory::make($payload['extension'])->parse($this->filesystem->read($payload['path']));
0 ignored issues
show
Security Bug introduced by
It seems like $this->filesystem->read($payload['path']) targeting League\Flysystem\FilesystemInterface::read() can also be of type false; however, HSkrasek\OpenAPI\Parsers\ParserInterface::parse() does only seem to accept string, did you maybe forget to handle an error condition?
Loading history...
25
    }
26
}
27