1 | <?php |
||
29 | class Client |
||
30 | { |
||
31 | /** |
||
32 | * Connection manager |
||
33 | * |
||
34 | * @var ManagerInterface |
||
35 | */ |
||
36 | protected $connectionManager; |
||
37 | |||
38 | /** |
||
39 | * Command handlers |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $commandHandlers = []; |
||
44 | |||
45 | /** |
||
46 | * List of built queues |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | private $queues; |
||
51 | |||
52 | /** |
||
53 | * A list of credentials to Disque servers |
||
54 | * |
||
55 | * @var Disque\Connection\Credentials[] |
||
56 | */ |
||
57 | private $servers; |
||
58 | |||
59 | /** |
||
60 | * Create a new Client |
||
61 | * |
||
62 | * @param Disque\Connection\Credentials[] $servers |
||
63 | */ |
||
64 | public function __construct(array $servers = []) |
||
94 | |||
95 | /** |
||
96 | * Set a connection manager |
||
97 | * |
||
98 | * @param ManagerInterface $manager |
||
99 | */ |
||
100 | public function setConnectionManager(ManagerInterface $manager) |
||
107 | |||
108 | /** |
||
109 | * Get the connection manager |
||
110 | * |
||
111 | * @return ManagerInterface Connection manager |
||
112 | */ |
||
113 | public function getConnectionManager() |
||
117 | |||
118 | /** |
||
119 | * Tells if connection is established |
||
120 | * |
||
121 | * @return bool Success |
||
122 | */ |
||
123 | public function isConnected() |
||
127 | |||
128 | /** |
||
129 | * Connect to Disque |
||
130 | * |
||
131 | * @return Disque\Connection\Node\Node Connected node information |
||
132 | * @throws Disque\Connection\ConnectionException |
||
133 | */ |
||
134 | public function connect() |
||
138 | |||
139 | /** |
||
140 | * @throws InvalidCommandException |
||
141 | */ |
||
142 | public function __call($command, array $arguments) |
||
154 | |||
155 | /** |
||
156 | * Register a command handler |
||
157 | * |
||
158 | * @param CommandInterface $commandHandler Command |
||
159 | * @return void |
||
160 | */ |
||
161 | public function registerCommand(CommandInterface $commandHandler) |
||
166 | |||
167 | /** |
||
168 | * Get a queue |
||
169 | * |
||
170 | * @param string $name Queue name |
||
171 | * @return Queue Queue |
||
172 | */ |
||
173 | public function queue($name) |
||
180 | } |