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   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 1
dl 0
loc 30
c 0
b 0
f 0
ccs 0
cts 12
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A filterInterval() 0 18 6
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