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 — 2.0 ( e6a123...4184ab )
by Henrique
03:41
created

Image   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 26
ccs 0
cts 11
cp 0
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A validate() 0 16 4
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 finfo;
15
use SplFileInfo;
16
17
class Image extends AbstractRule
18
{
19
    public $fileInfo;
20
21
    public function __construct(finfo $fileInfo = null)
22
    {
23
        $this->fileInfo = $fileInfo ?: new finfo(FILEINFO_MIME_TYPE);
24
    }
25
26
    public function validate($input)
27
    {
28
        if ($input instanceof SplFileInfo) {
29
            $input = $input->getPathname();
30
        }
31
32
        if (!is_string($input)) {
33
            return false;
34
        }
35
36
        if (!is_file($input)) {
37
            return false;
38
        }
39
40
        return 0 === mb_strpos($this->fileInfo->file($input), 'image/');
41
    }
42
}
43