for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace N1215\Tsukuyomi\Event;
class Event implements EventInterface
{
/** @var string */
private $name;
/** @var string|object|null */
private $target;
/** @var array */
private $params;
/** @var bool */
private $isPropagationStopped;
/**
* @param string $name
* @param string|object|null $target
* @param array $params
*/
public function __construct(string $name, $target = null, array $params = [])
$this->name = $name;
$this->target = $target;
$this->params = $params;
$this->isPropagationStopped = false;
}
* @inheritdoc
public function getName()
return $this->name;
public function getTarget()
return $this->target;
public function getParams()
return $this->params;
public function getParam($name)
if (!isset($this->params[$name])) {
return null;
return $this->params[$name];
public function setName($name)
if (!is_string($name)) {
throw new \InvalidArgumentException('$name must be a string.');
public function setTarget($target)
public function setParams(array $params)
public function stopPropagation($flag)
if (!is_bool($flag)) {
throw new \InvalidArgumentException('$flag must be a bool.');
$this->isPropagationStopped = $flag;
public function isPropagationStopped()
return $this->isPropagationStopped;