Passed
Push — master ( 6df11d...8e8817 )
by Julien
05:21
created

BlameAt::getDateCallback()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 2
Bugs 2 Features 0
Metric Value
cc 2
eloc 2
c 2
b 2
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
3
/**
4
 * This file is part of the Zemit Framework.
5
 *
6
 * (c) Zemit Team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.txt
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zemit\Mvc\Model\Blameable;
13
14
trait BlameAt
15
{
16 4
    public function getDateCallback(string $format, ?int $timestamp = null): \Closure
17
    {
18 4
        return function () use ($format, $timestamp) {
19 4
            return isset($timestamp)? date($format, $timestamp) : date($format);
20 4
        };
21
    }
22
}
23