forked from clue/reactphp-mdns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactory.php
More file actions
34 lines (27 loc) · 754 Bytes
/
Copy pathFactory.php
File metadata and controls
34 lines (27 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Clue\React\Mdns;
use React\EventLoop\Loop;
use React\EventLoop\LoopInterface;
use React\Dns\Query\ExecutorInterface;
use React\Dns\Resolver\Resolver;
class Factory
{
const DNS = '224.0.0.251:5353';
/** @var LoopInterface */
private $loop;
/** @var ExecutorInterface */
private $executor;
/**
* @param ?LoopInterface $loop
* @param ?ExecutorInterface $executor
*/
public function __construct(LoopInterface $loop = null, ExecutorInterface $executor = null)
{
$this->loop = $loop ?: Loop::get();
$this->executor = $executor ?: new MulticastExecutor($loop);
}
public function createResolver()
{
return new Resolver(self::DNS, $this->executor);
}
}