EnvironmentFunction::run()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
cc 3
eloc 6
nc 4
nop 1
crap 3
1
<?php
2
namespace Desmond\functions\special;
3
use Desmond\functions\DesmondSpecialFunction;
4
5
class EnvironmentFunction extends DesmondSpecialFunction
6
{
7 280
    public function run(array $args)
8
    {
9 280
        foreach ($args as $formIndex => $atom) {
10 233
            $args[$formIndex] = $this->eval->getReturn($atom);
11
        }
12 280
        $actualFunction = $this->currentEnv->get($this->function);
13 280
        $object = new $actualFunction;
14 280
        return method_exists($object, 'run') ? $object->run($args) : $object;
15
    }
16
}
17