ChangeWorkingDirectoryStep   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 22
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 6 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zalas\Symfify\Composer\SymfifyStep;
6
7
use Zalas\Symfify\Composer\SymfifyStep;
8
9
class ChangeWorkingDirectoryStep implements SymfifyStep
10
{
11
    /**
12
     * @var string
13
     */
14
    private $path;
15
16
    /**
17
     * @param string $path
18
     */
19 5
    public function __construct($path)
20
    {
21 5
        $this->path = $path;
22
    }
23
24 4
    public function __invoke()
25
    {
26 4
        if (!\is_dir($this->path) || !\chdir($this->path)) {
27 2
            throw new \InvalidArgumentException(\sprintf('The given directory path does not exist: "%s".', $this->path));
28
        }
29
    }
30
}
31