Completed
Push — master ( d99440...b71151 )
by Hunter
13:25
created

ParseSchemaFile   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 6 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()->parse(
25
            $this->filesystem->getAdapter()->getPathPrefix() . DIRECTORY_SEPARATOR . $payload['path']
26
        );
27
    }
28
}
29