Completed
Push — master ( d33ed4...3917d5 )
by Sebastian
03:14
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;
13
14
class AbstractDate
15
{
16
    /**
17
     * Check if format contain time keywords.
18
     *
19
     * @param string $format
20
     * @return bool
21
     */
22 40
    protected function dateHaveNoTime(string $format): bool
23
    {
24 40
        foreach (['a','A','B','g','G','h','H','i','s','u','v'] as $char) {
25 40
            if (strpos($format, $char) !== false) {
26 40
                return false;
27
            }
28
        }
29
30 21
        return true;
31
    }
32
}
33