CloneGitRepository::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Pipes;
4
5
use App\CloneGitRepositoryTask;
6
use Zurbaev\PipelineTasks\Pipe;
7
8
class CloneGitRepository extends Pipe
9
{
10
    /**
11
     * @var CloneGitRepositoryTask
12
     */
13
    protected $task;
14
15
    public function handle()
16
    {
17
        // Since we have $this->task property set,
18
        // we can simply call its method to retrieve
19
        // data instead of passing it to constructor.
20
21
        $command = [
22
            'git clone -b %s --depth=1 %s %s',
23
            $this->task->getBranch(),
24
            $this->task->getGitUrl(),
25
            $this->task->getRootPath(),
26
        ];
27
28
        exec(call_user_func_array('sprintf', $command));
29
30
        return true;
31
    }
32
}
33