FunctionList::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 5
Ratio 35.71 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 5
loc 14
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 1
crap 2
1
<?php
2
namespace Desmond\functions\core;
3
use Desmond\functions\DesmondFunction;
4
use Desmond\functions\FileOperations;
5
6
class FunctionList extends DesmondFunction
7
{
8
    use \Desmond\TypeHelper;
9
10 334
    public function id()
11
    {
12 334
        return 'function-list';
13
    }
14
15 1
    public function run(array $args)
16
    {
17
        $list = [
18 1
            'define', 'let', 'do', 'if',
19
            'lambda', 'load-file', 'eval',
20
            'try'
21
        ];
22 1 View Code Duplication
        foreach (FileOperations::getFunctionFiles() as $file) {
23 1
            $class = sprintf('Desmond\\functions\\core\\%s', substr($file, 0, -4));
24 1
            $function = new $class;
25 1
            $list[] = $function->id();
26
        }
27 1
        return self::fromPhpType($list);
28
    }
29
}
30