public static function fire($name, $data = [], $stop = false)
    {
        if (static::bound($name))
        {
            static::$fired[$name] = true;

            foreach (static::$events[$name] as $key => $value)
            {
                list($type, $callback) = each($value);

                // Call back is a class
                if (is_string($callback)) {
                    $callback = [$instance = new $callback(), 'handle'];
                }

                $responses[] = $response =
                    call_user_func_array($callback, (array) $data);

                if ($type == 'once') {
                    unset(static::$events[$name][$key]);
                }

                if ($stop && !empty($response)) {
                    return $responses;
                }
            }
        }

        return isset($responses) ? $responses : null;
    }
public static function fire($name, $data = [], $stop = false)
    {
        if (static::bound($name))
        {
            static::$fired[$name] = true;

            foreach (static::$events[$name] as $key => $value)
            {
                list($type, $callback) = each($value);

                // Call back is a class
                if (is_string($callback)) {
                    $callback = [$instance = new $callback(), 'handle'];
                }

                $responses[] = $response =
                    call_user_func_array($callback, (array) $data);

                if ($type == 'once') {
                    unset(static::$events[$name][$key]);
                }

                if ($stop && !empty($response)) {
                    return $responses;
                }
            }
        }

        return isset($responses) ? $responses : null;
    }
public static function fire ( $ name , $ data = [ ] , $ stop = false ) { if ( static :: bound ( $ name ) ) { static :: $ fired [ $ name ] = true ; foreach ( static :: $ events [ $ name ] as $ key => $ value ) { list ( $ type , $ callback ) = each ( $ value ) ; // Call back is a class if ( is_string ( $ callback ) ) { $ callback = [ $ instance = new $ callback ( ) , 'handle' ] ; } $ responses [ ] = $ response = call_user_func_array ( $ callback , ( array ) $ data ) ; if ( $ type == 'once' ) { unset ( static :: $ events [ $ name ] [ $ key ] ) ; } if ( $ stop && ! empty ( $ response ) ) { return $ responses ; } } } return isset ( $ responses ) ? $ responses : null ; }
Trigger all callback functions for an event.

The method returns an array containing the responses from all
of the event handlers (even empty responses).

Returns NULL if the event has no handlers.

@param  string $name The name of the event.
@param  array  $data The data passed to the event handlers.
@param  bool   $stop Return after the first non-empty response.
@return mixed
Trigger all callback functions for an event .