SimulatorExecutable::simulate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
namespace phpbu\App\Backup\Source;
3
4
use phpbu\App\Backup\Cli;
5
use phpbu\App\Backup\Target;
6
use phpbu\App\Result;
7
8
/**
9
 * Executable Simulator class.
10
 *
11
 * @package    phpbu
12
 * @subpackage Backup
13
 * @author     Sebastian Feldmann <[email protected]>
14
 * @copyright  Sebastian Feldmann <[email protected]>
15
 * @license    https://opensource.org/licenses/MIT The MIT License (MIT)
16
 * @link       http://phpbu.de/
17
 * @since      Class available since Release 3.0.0
18
 */
19
abstract class SimulatorExecutable extends Cli
20
{
21
    /**
22
     * Simulate the backup execution.
23
     *
24
     * @param  \phpbu\App\Backup\Target $target
25
     * @param  \phpbu\App\Result        $result
26
     * @return \phpbu\App\Backup\Source\Status
27
     */
28 2
    public function simulate(Target $target, Result $result) : Status
29
    {
30 2
        $result->debug('backup data:' . PHP_EOL . $this->getExecutable($target)->getCommandPrintable());
31
32 2
        return $this->createStatus($target);
33
    }
34
35
    /**
36
     * Create backup status.
37
     *
38
     * @param  \phpbu\App\Backup\Target $target
39
     * @return \phpbu\App\Backup\Source\Status
40
     */
41
    abstract protected function createStatus(Target $target) : Status;
42
}
43