JsonRpcController::method_3()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace PhpJsonRpc\Server\Stub;
4
5
use PhpJsonRpc\Server\Request\Params;
6
use PhpJsonRpc\Server\Stub\ValueObject\Age;
7
use PhpJsonRpc\Server\Stub\ValueObject\Name;
8
use PhpJsonRpc\Server\Stub\ValueObject\CustomParams;
9
10
class JsonRpcController
11
{
12
    public function method_1()
13
    {
14
        return 'result of method_1';
15
    }
16
17
    public function method_2($name, $age)
18
    {
19
        return "result of method_2: {$name}, {$age}";
20
    }
21
22
    public function method_3(Name $name, Age $age)
23
    {
24
        return "result of method_3: {$name->toNative()}, {$age->toNative()}";
25
    }
26
27
    public function method_4(Params $params)
28
    {
29
        return "result of method_4: {$params->get('name')}, {$params->get('age')}";
30
    }
31
32
    public function method_5(CustomParams $params)
33
    {
34
        return "result of method_5: {$params->name()}, {$params->age()}";
35
    }
36
37
    public function method_6()
38
    {
39
        throw new \RuntimeException('Something is wrong!');
40
    }
41
}
42