GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 18180f...0e2fa6 )
by Dusan
01:12
created

ToInt   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 17
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 3
1
<?php
2
/**
3
 * This file is part of the transformers package.
4
 *
5
 * Copyright (c) dutekvejin
6
 *
7
 * For full copyright and license information, please refer to the LICENSE file,
8
 * located at the package root folder.
9
 */
10
11
namespace Dutek\Transformer;
12
13
use InvalidArgumentException;
14
15
/**
16
 * Transformer implementation that performs casting to int on the input value.
17
 *
18
 * @package Dutek\Transformer
19
 * @author Dušan Vejin <[email protected]>
20
 */
21
class ToInt implements Transformer
22
{
23
    /**
24
     * Transforms the input to integer.
25
     *
26
     * @param mixed $value The input value to transform.
27
     * @return int The transformed result.
28
     */
29 10
    public function __invoke($value) : int
30
    {
31 10
        if ($value !== null && !is_scalar($value)) {
32 2
            throw new InvalidArgumentException('Value could not be converted to int.');
33
        }
34
35 8
        return (int) $value;
36
    }
37
}
38