Now::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 1
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\Filter\Rule\Sanitize;
10
11
/**
12
 *
13
 * Force the value to the current time, default format "Y-m-d H:i:s".
14
 *
15
 * @package Aura.Filter
16
 *
17
 */
18
class Now
19
{
20
    /**
21
     *
22
     * Force the value to the current time, default format "Y-m-d H:i:s".
23
     *
24
     * @param object $subject The subject to be filtered.
25
     *
26
     * @param string $field The subject field name.
27
     *
28
     * @param mixed $format The date format.
29
     *
30
     * @return bool Always true.
31
     *
32
     */
33 5
    public function __invoke($subject, $field, $format = 'Y-m-d H:i:s')
34
    {
35 5
        $subject->$field = date($format);
36 5
        return true;
37
    }
38
}
39