Completed
Push — master ( 4066ce...b4c895 )
by Sebastian
03:10
created

AbstractDate::dateHaveNoTime()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 3
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Linna Filter
5
 *
6
 * @author Sebastian Rapetti <[email protected]>
7
 * @copyright (c) 2018, Sebastian Rapetti
8
 * @license http://opensource.org/licenses/MIT MIT License
9
 */
10
declare(strict_types = 1);
11
12
namespace Linna\Filter\Rules;
13
14
/**
15
 * Abstract Date
16
 */
17
class AbstractDate
18
{
19
    /**
20
     * Check if format contain time keywords.
21
     *
22
     * @param string $format
23
     * @return bool
24
     */
25 40
    protected function dateHaveNoTime(string $format): bool
26
    {
27 40
        foreach (['a','A','B','g','G','h','H','i','s','u','v'] as $char) {
28 40
            if (strpos($format, $char) !== false) {
29 40
                return false;
30
            }
31
        }
32
33 21
        return true;
34
    }
35
}
36