Timestamp   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 4 1
1
<?php
2
/*
3
 * This file is part of the Backup package, an RunOpenCode project.
4
 *
5
 * (c) 2015 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * This project is fork of "kbond/php-backup", for full credits info, please
11
 * view CREDITS file that was distributed with this source code.
12
 */
13
namespace RunOpenCode\Backup\Namer;
14
15
use RunOpenCode\Backup\Contract\NamerInterface;
16
17
/**
18
 * Class Timestamp
19
 *
20
 * Namer that names backup with current timestamp.
21
 *
22
 * @package RunOpenCode\Backup\Namer
23
 */
24
final class Timestamp implements NamerInterface
25
{
26
    private $format;
27
28 2
    public function __construct($format = 'Y-m-d-H-i-s')
29
    {
30 2
        $this->format = $format;
31 2
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 2
    public function getName()
37
    {
38 2
        return date($this->format);
39
    }
40
}
41