Completed
Push — master ( 9b2b5f...28e902 )
by Sebastian
03:28
created

Abstraction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSummaryData() 0 14 2
1
<?php
2
namespace phpbu\App\Log\ResultFormatter;
3
4
use phpbu\App\Result;
5
6
/**
7
 * ResultFormatter base class
8
 *
9
 * @package    phpbu
10
 * @subpackage Log
11
 * @author     Sebastian Feldmann <[email protected]>
12
 * @copyright  Sebastian Feldmann <[email protected]>
13
 * @license    https://opensource.org/licenses/MIT The MIT License (MIT)
14
 * @link       https://phpbu.de/
15
 * @since      Class available since Release 5.0.0
16
 */
17
abstract class Abstraction
18
{
19
    /**
20
     * Returns summary data.
21
     *
22
     * @param  \phpbu\App\Result $result
23
     * @return array
24
     */
25 10
    public function getSummaryData(Result $result) : array
26
    {
27 10
        $start = $result->started();
28 10
        $end   = microtime(true);
29
30
        return [
31 10
            'status'       => $result->allOk() ? 0 : 1,
32 10
            'timestamp'    => (int) $start,
33 10
            'duration'     => round($end - $start, 4),
34 10
            'backupCount'  => count($result->getBackups()),
35 10
            'backupFailed' => $result->backupsFailedCount(),
36 10
            'errorCount'   => $result->errorCount(),
37
        ];
38
    }
39
}
40