PHP code example of acairns / radiate
1. Go to this page and download the library: Download acairns/radiate library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
acairns / radiate example snippets
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)
{
// safety first!
}
}
$registry = new \Cairns\Radiate\Registry\TypehintedClassRegistry;
$registry->register(DisableTransporters::class);
$locator = new Cairns\Radiate\Locator\InMemoryListenerLocator;
$locator->add(new DisableTransporters);
$invoker = new \Cairns\Radiate\Middleware\InvokeListenerMiddleware(
$registry,
$locator,
new Cairns\Radiate\Inflector\TypehintMethodInflector
);
$emitter = new Cairns\Radiate\Emitter([
$invoker
]);
$emitter->emit(new WarpDriveEngaged(9));