MachineStoragePathFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromEnv() 0 5 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Cocotte\Machine;
4
5
use Cocotte\Filesystem\Filesystem;
6
use Cocotte\Host\HostMountFactory;
7
8
class MachineStoragePathFactory
9
{
10
    /**
11
     * @var HostMountFactory
12
     */
13
    private $hostMountFactory;
14
15
    /**
16
     * @var Filesystem
17
     */
18
    private $filesystem;
19
20
    public function __construct(HostMountFactory $hostMountFactory, Filesystem $filesystem)
21
    {
22
        $this->hostMountFactory = $hostMountFactory;
23
        $this->filesystem = $filesystem;
24
    }
25
26
    public function fromEnv(): MachineStoragePath
27
    {
28
        return new MachineStoragePath(
29
            $this->hostMountFactory->fromDocker()->sourcePath().'/machine',
30
            $this->filesystem
31
        );
32
    }
33
34
}
35