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

StringQuestion::id()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Desmond\functions\core;
3
use Desmond\functions\DesmondFunction;
4
use Desmond\ArgumentHelper;
5
use Desmond\exceptions\ArgumentException;
6
7
class StringQuestion extends DesmondFunction
8
{
9
    use ArgumentHelper;
10
11 260
    public function id()
12
    {
13 260
        return 'string?';
14
    }
15
16 3
    public function run(array $args)
17
    {
18 3
        if (empty($args)) {
19 1
            throw new ArgumentException('"string?" expects an argument.');
20
        }
21 2
        return $this->isDesmondType('String', $args[0])
22 1
            ? $this->newReturnType('True')
23 2
            : $this->newReturnType('False');
24
    }
25
}
26