-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
27 lines (20 loc) · 884 Bytes
/
index.php
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
<?php
namespace App;
use App\EventChannel\EventChannel;
use App\News\NewsPublisher;
use App\Subscriber\Subscriber;
require __DIR__ . '/vendor/autoload.php';
$eventChannel = new EventChannel();
$timesNews = new NewsPublisher('Times News', $eventChannel);
$newNews = new NewsPublisher('New News', $eventChannel);
$oktoNews = new NewsPublisher('Okto news', $eventChannel);
$aslanSubscriber = new Subscriber('Aslan');
$alexSubscriber = new Subscriber('Alex');
$ronSubscriber = new Subscriber('Ron');
echo $eventChannel->subscribe('Times News', $aslanSubscriber) . "<br>";
echo $eventChannel->subscribe('New News', $alexSubscriber) . "<br>";
echo $eventChannel->subscribe('Okto news', $ronSubscriber) . "<br>";
echo "<br>";
echo $timesNews->publish('New "Times News"') . "<br>";
echo $newNews->publish('New "New News"') . "<br>";
echo $oktoNews->publish('New "Okto News"') . "<br>";