Completed
Push — master ( c70864...b6d4e5 )
by Dmitry
03:30 queued 27s
created

Call::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 5
cts 6
cp 0.8333
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2.0185
1
<?php
2
3
namespace Basis\Job\Module;
4
5
use Basis\Job;
6
use Exception;
7
8
class Call extends Job
9
{
10
    public $space;
11
    public $id;
12
13
    public $method;
14
15 1
    public function run()
16
    {
17 1
        $instance = $this->findOrFail($this->space, $this->id);
18
19 1
        if (!method_exists($instance, $this->method)) {
20
            throw new Exception("Method $this->method not defined");
21
        }
22
23 1
        $method = $this->method;
24
25
        return [
26 1
            'result' => $instance->$method(),
27
        ];
28
    }
29
}
30