1 | <?php |
||
2 | /** |
||
3 | * Runtime server (detecting) |
||
4 | * User: moyo |
||
5 | * Date: 18/10/2017 |
||
6 | * Time: 2:42 PM |
||
7 | */ |
||
8 | |||
9 | namespace Carno\RPC\Chips; |
||
10 | |||
11 | use Carno\RPC\Exception\ConfusedRuntimeServerException; |
||
12 | use Carno\RPC\Exception\UnknownRuntimeServerException; |
||
13 | |||
14 | trait RTServer |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $server = null; |
||
20 | |||
21 | /** |
||
22 | * @return string |
||
23 | */ |
||
24 | public function server() : string |
||
25 | { |
||
26 | if ($this->server) { |
||
27 | return $this->server; |
||
28 | } |
||
29 | |||
30 | switch (count($servers = $this->servers())) { |
||
0 ignored issues
–
show
|
|||
31 | case 0: |
||
32 | throw new UnknownRuntimeServerException; |
||
33 | case 1: |
||
34 | return $this->server = current($servers); |
||
35 | default: |
||
36 | throw new ConfusedRuntimeServerException; |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.