MachineStoragePathFactory::fromEnv()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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