1 | <?php |
||
15 | class Server |
||
16 | { |
||
17 | /** |
||
18 | * @var string array |
||
19 | */ |
||
20 | private $payload; |
||
21 | |||
22 | /** |
||
23 | * @var Processor |
||
24 | */ |
||
25 | private $processor; |
||
26 | |||
27 | /** |
||
28 | * @var RequestParser |
||
29 | */ |
||
30 | private $requestParser; |
||
31 | |||
32 | /** |
||
33 | * @var ResponseBuilder |
||
34 | */ |
||
35 | private $responseBuilder; |
||
36 | |||
37 | /** |
||
38 | * Server constructor. |
||
39 | * |
||
40 | * @param string $payload |
||
41 | */ |
||
42 | public function __construct(string $payload = null) |
||
50 | |||
51 | /** |
||
52 | * Add handler-object for handling request |
||
53 | * |
||
54 | * @param mixed $object |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function addHandler($object) |
||
62 | |||
63 | /** |
||
64 | * Add mapper-object for mapping request-method on class and method |
||
65 | * |
||
66 | * @param MapperInterface $mapper |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function addMapper(MapperInterface $mapper) |
||
74 | |||
75 | /** |
||
76 | * Run server |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function execute(): string |
||
87 | } |
||
88 |