Completed
Push — master ( 5e9169...e507aa )
by Dmitry
04:13
created

Call::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 11
cp 0
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
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
    public function run()
16
    {
17
        $instance = $this->findOrFail($this->space, $this->id);
18
19
        if (!method_exists($instance, $this->method)) {
20
            throw new Exception("Method $this->method not defined");
21
        }
22
23
        $method = $this->method;
24
25
        return [
26
            'result' => $instance->$method(),
27
        ];
28
    }
29
}
30