Completed
Push — master ( 273890...647b73 )
by Sebastian
03:36
created

Abstraction::toAbsolutePath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace phpbu\App\Backup\Crypter;
3
4
use phpbu\App\Backup\Cli;
5
use phpbu\App\Backup\Target;
6
use phpbu\App\Result;
7
8
/**
9
 * Abstract crypter 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 2.1.6
18
 */
19
abstract class Abstraction extends Cli
20
{
21
    /**
22
     * (non-PHPDoc)
23
     *
24
     * @see    \phpbu\App\Backup\Crypter
25
     * @param  \phpbu\App\Backup\Target $target
26
     * @param  \phpbu\App\Result        $result
27
     * @throws Exception
28
     */
29
    public function crypt(Target $target, Result $result)
30
    {
31 6
        $crypt = $this->execute($target);
32
        $name  = strtolower(get_class($this));
33 6
34 6
        $result->debug($name . ':' . $this->getExecutable($target)->getCommandPrintable());
35
36 6
        if (!$crypt->isSuccessful()) {
37
            throw new Exception($name . ' failed:' . PHP_EOL . $crypt->getStdErr());
38 6
        }
39 3
    }
40
41 3
    /**
42
     * Simulate the encryption.
43
     *
44
     * @param \phpbu\App\Backup\Target $target
45
     * @param \phpbu\App\Result        $result
46
     */
47
    public function simulate(Target $target, Result $result)
48
    {
49 2
        $result->debug(
50
            'execute encryption:' . PHP_EOL .
51 2
            $this->getExecutable($target)->getCommandPrintable()
52 2
        );
53 2
    }
54
}
55