Completed
Push — work-fleets ( ad253d...d9c01a )
by SuperNova.WS
06:45
created

Invoker::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
/**
3
 * Created by Gorlum 21.08.2016 13:33
4
 */
5
6
namespace Common;
7
8
9
class Invoker {
10
11
  protected $callable;
12
13
  public function __construct($callable) {
14
    $this->callable = $callable;
15
  }
16
17
  public static function build($callable) {
18
    if(is_array($callable) && count($callable) == 2 && is_object($callable[0])) {
19
      return new static($callable);
20
    } else {
21
      return false;
22
    }
23
  }
24
25
  public function __invoke() {
26
    return call_user_func_array($this->callable, func_get_args());
27
  }
28
29
}
30