Syscall::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Syscall
4
 * User: moyo
5
 * Date: 16/08/2017
6
 * Time: 2:52 PM
7
 */
8
9
namespace Carno\Coroutine;
10
11
use Throwable;
12
13
class Syscall
14
{
15
    /**
16
     * @var callable
17
     */
18
    private $program = null;
19
20
    /**
21
     * Syscall constructor.
22
     * @param callable $program
23
     */
24
    public function __construct(callable $program)
25
    {
26
        $this->program = $program;
27
    }
28
29
    /**
30
     * @param Job $job
31
     * @return mixed
32
     */
33
    public function exec(Job $job)
34
    {
35
        try {
36
            return ($this->program)($job);
37
        } catch (Throwable $e) {
38
            return $e;
39
        }
40
    }
41
}
42