Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — 1.1 ( fca464...0e73bc )
by Henrique
09:36 queued 06:14
created

AbstractInterval::filterInterval()   A

Complexity

Conditions 6
Paths 4

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 0
cts 8
cp 0
rs 9.0444
c 0
b 0
f 0
cc 6
nc 4
nop 1
crap 42
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * (c) Alexandre Gomes Gaigalas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the "LICENSE.md"
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Respect\Validation\Rules;
13
14
use DateTime;
15
use Exception;
16
17
abstract class AbstractInterval extends AbstractRule
18
{
19
    public $interval;
20
    public $inclusive;
21
22
    public function __construct($interval, $inclusive = true)
23
    {
24
        $this->interval = $interval;
25
        $this->inclusive = $inclusive;
26
    }
27
28
    protected function filterInterval($value)
29
    {
30
        if (!is_string($value) || is_numeric($value) || empty($value)) {
31
            return $value;
32
        }
33
34
        if (strlen($value) == 1) {
35
            return $value;
36
        }
37
38
        try {
39
            return new DateTime($value);
40
        } catch (Exception $e) {
41
            // Pokémon Exception Handling
42
        }
43
44
        return $value;
45
    }
46
}
47