ExportTask   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 33
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A execute() 0 12 1
1
<?php
2
3
/*
4
 * This file is part of the Conveyor package.
5
 *
6
 * (c) Jeroen Fiege <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webcreate\Conveyor\Task;
13
14
use Webcreate\Conveyor\IO\IOInterface;
15
use Webcreate\Conveyor\Repository\Repository;
16
use Webcreate\Conveyor\Repository\Version;
17
use Webcreate\Conveyor\Task\Result\ExecuteResult;
18
19
class ExportTask extends Task
20
{
21
    protected $io;
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $io. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
22
    protected $repository;
23
24 1
    public function __construct($dest, Repository $repository, IOInterface $io = null)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $io. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
25
    {
26 1
        $this->repository = $repository;
27 1
        $this->io = $io;
28 1
        $this->dest = $dest;
0 ignored issues
show
Bug introduced by
The property dest does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
29 1
    }
30
31
    /**
32
     * @todo better progress (percentage) updating
33
     *
34
     * @param $target
35
     * @param  Version       $version
36
     * @param  array         $options
37
     * @return ExecuteResult
38
     */
39 1
    public function execute($target, Version $version, array $options = array())
40
    {
41 1
        $this->output(sprintf('Exporting: <comment>0%%</comment>'));
42
43 1
        $this->repository->export($version, $this->dest);
44
45 1
        $this->output(sprintf('Exporting: <comment>100%%</comment>'));
46
47 1
        return new ExecuteResult(
48 1
            array('*')
49
        );
50
    }
51
}
52