Component::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Mosaic\Filesystem;
4
5
use Mosaic\Common\Components\AbstractComponent;
6
use Mosaic\Common\Conventions\FolderStructureConvention;
7
use Mosaic\Filesystem\Adapters\Flysystem\Component as FlysystemComponent;
8
9
class Component extends AbstractComponent
10
{
11
    /**
12
     * @var FolderStructureConvention
13
     */
14
    private $folderStructure;
15
16
    /**
17
     * @param string                    $implementation
18
     * @param FolderStructureConvention $folderStructure
19
     */
20 1
    protected function __construct(string $implementation, FolderStructureConvention $folderStructure)
21
    {
22 1
        parent::__construct($implementation);
23 1
        $this->folderStructure = $folderStructure;
24 1
    }
25
26
    /**
27
     * @param  FolderStructureConvention $folderStructure
28
     * @return FlysystemComponent
29
     */
30 1
    public static function flysystem(FolderStructureConvention $folderStructure)
31
    {
32 1
        return new FlysystemComponent($folderStructure);
33
    }
34
35
    /**
36
     * @param  callable $callback
37
     * @return array
38
     */
39 1
    public function resolveCustom(callable $callback) : array
40
    {
41 1
        return $callback($this->folderStructure);
42
    }
43
}
44