From fb1335fd8786041c53b1cc8b56b5b6e3d5a05eca Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 8 Jul 2021 11:39:48 +0200 Subject: [PATCH] Remove use cases in examples --- README.md | 4 ++-- examples/dump-received.php | 7 ++----- examples/echo-received.php | 4 +--- examples/send-once.php | 4 +--- examples/send-wait.php | 7 ++----- examples/ssdp.php | 3 +-- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f05dd55..16a6818 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Once [installed](#install), you can use the following code to create a simple echo server that listens for incoming multicast messages: ```php -$factory = new Factory(); +$factory = new Clue\React\Multicast\Factory(); $socket = $factory->createReceiver('224.10.20.30:4050'); $socket->on('message', function ($data, $remote) use ($socket) { @@ -60,7 +60,7 @@ See also the [examples](examples). The `Factory` is responsible for creating your [`SocketInterface`](#socketinterface) instances. ```php -$factory = new Factory(); +$factory = new Clue\React\Multicast\Factory(); ``` This class takes an optional `LoopInterface|null $loop` parameter that can be used to diff --git a/examples/dump-received.php b/examples/dump-received.php index 42f739c..efa2448 100644 --- a/examples/dump-received.php +++ b/examples/dump-received.php @@ -5,9 +5,6 @@ * Accepts a single argument socket address (defaults to 224.10.20.30:12345) */ -use Clue\React\Multicast\Factory; -use Clue\Hexdump\Hexdump; - require __DIR__ . '/../vendor/autoload.php'; $address = '224.10.20.30:12345'; // random test address @@ -18,9 +15,9 @@ $address = $argv[1]; } -$factory = new Factory(); +$factory = new Clue\React\Multicast\Factory(); $socket = $factory->createReceiver($address); -$hex = new Hexdump(); +$hex = new Clue\Hexdump\Hexdump(); $socket->on('message', function ($data, $remote) use ($hex) { echo 'Received from ' . $remote . PHP_EOL; diff --git a/examples/echo-received.php b/examples/echo-received.php index f121434..c13030c 100644 --- a/examples/echo-received.php +++ b/examples/echo-received.php @@ -5,8 +5,6 @@ * Accepts a single argument socket address (defaults to 224.10.20.30:12345) */ -use Clue\React\Multicast\Factory; - require __DIR__ . '/../vendor/autoload.php'; $address = '224.10.20.30:12345'; // random test address @@ -17,7 +15,7 @@ $address = $argv[1]; } -$factory = new Factory(); +$factory = new Clue\React\Multicast\Factory(); $socket = $factory->createReceiver($address); $socket->on('message', function ($data, $remote) use ($socket) { diff --git a/examples/send-once.php b/examples/send-once.php index b73644e..e399201 100644 --- a/examples/send-once.php +++ b/examples/send-once.php @@ -5,13 +5,11 @@ * Accepts a single argument socket address (defaults to 224.10.20.30:12345) */ -use Clue\React\Multicast\Factory; - require __DIR__ . '/../vendor/autoload.php'; $address = isset($argv[1]) ? $argv[1] : '224.10.20.30:12345'; -$factory = new Factory(); +$factory = new Clue\React\Multicast\Factory(); $sender = $factory->createSender(); // do not wait for incoming messages diff --git a/examples/send-wait.php b/examples/send-wait.php index 6e5b2f5..5d28e04 100644 --- a/examples/send-wait.php +++ b/examples/send-wait.php @@ -5,16 +5,13 @@ * Accepts a single argument socket address (defaults to 224.10.20.30:12345) */ -use Clue\React\Multicast\Factory; -use Clue\Hexdump\Hexdump; - require __DIR__ . '/../vendor/autoload.php'; $address = isset($argv[1]) ? $argv[1] : '224.10.20.30:12345'; -$factory = new Factory(); +$factory = new Clue\React\Multicast\Factory(); $sender = $factory->createSender(); -$hex = new Hexdump(); +$hex = new Clue\Hexdump\Hexdump(); // print a hexdump of every message received $sender->on('message', function ($data, $remote) use ($hex) { diff --git a/examples/ssdp.php b/examples/ssdp.php index 7d79feb..b4d60b2 100644 --- a/examples/ssdp.php +++ b/examples/ssdp.php @@ -3,13 +3,12 @@ * UPnP simple service discovery protocol (SSDP) */ -use Clue\React\Multicast\Factory; require __DIR__ . '/../vendor/autoload.php'; $address = '239.255.255.250:1900'; -$factory = new Factory(); +$factory = new Clue\React\Multicast\Factory(); $sender = $factory->createSender(); // dump all incoming messages