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

Passed
Pull Request — master (#1117)
by Henrique
02:29
created

MacAddress   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 12
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 7 2
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
declare(strict_types=1);
13
14
namespace Respect\Validation\Rules;
15
16
use function is_string;
17
use function preg_match;
18
19
/**
20
 * Validates whether the input is a valid MAC address.
21
 *
22
 * @author Alexandre Gomes Gaigalas <[email protected]>
23
 * @author Danilo Correa <[email protected]>
24
 * @author Fábio da Silva Ribeiro <[email protected]>
25
 * @author Henrique Moody <[email protected]>
26
 */
27
final class MacAddress extends AbstractRule
28
{
29
    /**
30
     * {@inheritdoc}
31
     */
32 10
    public function validate($input): bool
33
    {
34 10
        if (!is_string($input)) {
35
            return false;
36
        }
37
38 10
        return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $input) > 0;
39
    }
40
}
41