ParseSchemaFile   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
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