1 | <?php |
||
12 | class Pool implements TubeAwareInterface |
||
13 | { |
||
14 | use TubeAwareTrait; |
||
15 | |||
16 | /** @var Server[] */ |
||
17 | protected $servers = []; |
||
18 | |||
19 | /** |
||
20 | * @param Server[] $servers |
||
21 | * @throws InvalidArgumentException |
||
22 | */ |
||
23 | 7 | public function __construct(array $servers) |
|
35 | |||
36 | /** |
||
37 | * @param Server $server |
||
38 | * @return $this |
||
39 | */ |
||
40 | 6 | protected function addServer(Server $server) |
|
45 | |||
46 | /** |
||
47 | * @return Server[] |
||
48 | */ |
||
49 | 3 | public function getServers() |
|
53 | |||
54 | /** |
||
55 | * @param string $name |
||
56 | * @return Server |
||
57 | * @throws InvalidArgumentException |
||
58 | */ |
||
59 | 2 | public function getServer($name) |
|
67 | |||
68 | /** |
||
69 | * @param CommandInterface $command |
||
70 | * @return \Beanie\Server\ResponseOath |
||
71 | */ |
||
72 | 2 | public function dispatchCommand(CommandInterface $command) |
|
79 | |||
80 | /** |
||
81 | * @return Server |
||
82 | */ |
||
83 | 1 | public function getRandomServer() |
|
87 | } |
||
88 |