• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tochka-developers / jsonrpc / 4135501466

pending completion
4135501466

push

github

darkdarin
Merge remote-tracking branch 'origin/v5.0'

209 of 813 new or added lines in 51 files covered. (25.71%)

233 of 1307 relevant lines covered (17.83%)

1.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/DTO/JsonRpcRoute.php
1
<?php
2

3
namespace Tochka\JsonRpc\DTO;
4

5
use Tochka\JsonRpc\Contracts\ApiAnnotationInterface;
6
use Tochka\JsonRpc\Route\Parameters\Parameter;
7

8
/**
9
 * @psalm-api
10
 */
11
final class JsonRpcRoute
12
{
13
    public string $serverName;
14
    public ?string $group;
15
    public ?string $action;
16
    public string $jsonRpcMethodName;
17
    /** @var class-string|null */
18
    public ?string $controllerClass = null;
19
    public ?string $controllerMethod = null;
20
    /** @var array<string, Parameter> */
21
    public array $parameters = [];
22
    public ?Parameter $result = null;
23
    /** @var array<ApiAnnotationInterface> */
24
    public array $annotations = [];
25

26
    public function __construct(
27
        string $serverName,
28
        string $jsonRpcMethodName,
29
        string $group = null,
30
        string $action = null
31
    ) {
NEW
32
        $this->serverName = $serverName;
×
NEW
33
        $this->jsonRpcMethodName = $jsonRpcMethodName;
×
NEW
34
        $this->group = $group;
×
NEW
35
        $this->action = $action;
×
36
    }
37

38
    public function getRouteName(): string
39
    {
NEW
40
        return implode(
×
NEW
41
            '@',
×
NEW
42
            [
×
NEW
43
                $this->serverName,
×
NEW
44
                $this->group,
×
NEW
45
                $this->action,
×
NEW
46
                $this->jsonRpcMethodName
×
NEW
47
            ]
×
NEW
48
        );
×
49
    }
50

51
    /**
52
     * @param array{
53
     *     serverName: string,
54
     *     jsonRpcMethodName: string,
55
     *     group?: string,
56
     *     action?: string,
57
     *     controllerClass?: class-string,
58
     *     controllerMethod?: string,
59
     *     parameters?: array<string, Parameter>,
60
     *     result?: Parameter,
61
     *     annotations?: array<ApiAnnotationInterface>
62
     * } $array
63
     */
64
    public static function __set_state(array $array): self
65
    {
NEW
66
        $instance = new self(
×
NEW
67
            $array['serverName'],
×
NEW
68
            $array['jsonRpcMethodName'],
×
NEW
69
            $array['group'] ?? null,
×
NEW
70
            $array['action'] ?? null
×
NEW
71
        );
×
NEW
72
        $instance->controllerClass = $array['controllerClass'] ?? null;
×
NEW
73
        $instance->controllerMethod = $array['controllerMethod'] ?? null;
×
NEW
74
        $instance->parameters = $array['parameters'] ?? [];
×
NEW
75
        $instance->result = $array['result'] ?? null;
×
NEW
76
        $instance->annotations = $array['annotations'] ?? [];
×
77

NEW
78
        return $instance;
×
79
    }
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc