Completed
Push — master ( e7b529...3b65c3 )
by Scott
02:52
created

IntQuestion::run()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 4

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 6
cts 6
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 6
nc 5
nop 1
crap 4
1
<?php
2
namespace Desmond\functions\core;
3
use Desmond\functions\DesmondFunction;
4
use Desmond\ArgumentHelper;
5
use Desmond\exceptions\ArgumentException;
6
7 View Code Duplication
class IntQuestion extends DesmondFunction
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    use ArgumentHelper;
10
11 260
    public function id()
12
    {
13 260
        return 'int?';
14
    }
15
16 4
    public function run(array $args)
17
    {
18 4
        if (empty($args)) {
19 1
            throw new ArgumentException('"int?" expects an argument.');
20
        }
21 3
        return $this->isDesmondType('Number', $args[0]) && is_int($args[0]->value())
22 1
            ? $this->newReturnType('True')
23 3
            : $this->newReturnType('False');
24
    }
25
}
26