Timestamp::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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