-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.php
More file actions
47 lines (37 loc) · 1009 Bytes
/
example.php
File metadata and controls
47 lines (37 loc) · 1009 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
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php require_once __DIR__ . '/vendor/autoload.php';
final class WarpDriveEngaged
{
private $speed;
public function __construct($speed)
{
$this->speed = $speed;
}
public function getSpeed()
{
return $this->speed;
}
}
final class DisableTransporters
{
public function whenWarpDriveIsEngaged(WarpDriveEngaged $event)
{
var_dump($event);
echo "Disabling Transporters!\n";
}
}
final class NewInstanceListenerLocator implements \Cairns\Radiate\Locator\ListenerLocator {
public function locate($fqcn) {
return new $fqcn;
}
}
$registry = new \Cairns\Radiate\Registry\TypehintedClassRegistry;
$registry->register(DisableTransporters::class);
$invoker = new \Cairns\Radiate\Middleware\InvokeListenerMiddleware(
$registry,
new NewInstanceListenerLocator,
new Cairns\Radiate\Inflector\TypehintMethodInflector
);
$emitter = new Cairns\Radiate\Emitter([
$invoker
]);
$emitter->emit(new WarpDriveEngaged(9));