debug/handlers/Exception.php
public function add($delegate, string $name = null, int $priority = 0) : self
    {
        // Which name should we use?
        // Micro-optimization note: mt_rand() turned out to be several times faster than uniqid and somewhat
        // faster than counting the current number of delegates.
        $name = $name ?: ($delegate instanceof interfaces\Delegate ? get_class($delegate) : 'c\\'.mt_rand());

        if (isset($this->delegates[$name])) {
            throw new \OverflowException("A Delegate with the given name [$name] is already set.");
        }

        return $this->set($name, $delegate, $priority);
    }
public function add($delegate, string $name = null, int $priority = 0) : self
    {
        // Which name should we use?
        // Micro-optimization note: mt_rand() turned out to be several times faster than uniqid and somewhat
        // faster than counting the current number of delegates.
        $name = $name ?: ($delegate instanceof interfaces\Delegate ? get_class($delegate) : 'c\\'.mt_rand());

        if (isset($this->delegates[$name])) {
            throw new \OverflowException("A Delegate with the given name [$name] is already set.");
        }

        return $this->set($name, $delegate, $priority);
    }
public function add ( $ delegate , string $ name = null , int $ priority = 0 ) : self { // Which name should we use? // Micro-optimization note: mt_rand() turned out to be several times faster than uniqid and somewhat // faster than counting the current number of delegates. $ name = $ name ? : ( $ delegate instanceof interfaces \ Delegate ? get_class ( $ delegate ) : 'c\\' . mt_rand ( ) ) ; if ( isset ( $ this -> delegates [ $ name ] ) ) { throw new \ OverflowException ( "A Delegate with the given name [$name] is already set." ) ; } return $ this -> set ( $ name , $ delegate , $ priority ) ; }
Adds the given Delegate with the given optional priority to the stack.

@param   interfaces\Delegate|callable    $delegate   The Delegate to be inserted into the stack.
@param   string                          $name       The name of the Delegate. Has to be unique. If none is
given, the full (ie. with namespace) classname will be
be for Delegates and "c\{mt_rand()}" for callables.
*Also* has to be unique. In other words - If you add an
instance of the same class (or even the same instance)
multiple times, assign different names.
@param   int                             $priority   The priority at which the Delegate should be invoked
when an exception gets handled.
Also {@see self::getHighestPriority()}.
@return  $this
@throws  \OverflowException                          When the given name (or when not given, the class name)
is already set.
Adds the given Delegate with the given optional priority to the stack .