Exemple #1
0
 /**
  * Creates a new event instance
  *
  * @param EventBaseInterface $base
  * @param string $name
  * @param bool $entropy
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(EventBaseInterface $base, $name = null, $entropy = false)
 {
     $this->entropy = $entropy;
     if (!is_scalar($name)) {
         $name = $this->generateName();
     }
     if ($base->exists($name)) {
         throw new \InvalidArgumentException('Could not create new event. Event with same name already exists.');
     }
     $this->name = $name;
     $this->base = $base;
     $this->initialize();
 }