Event

Build Status Code Coverage Scrutinizer Code Quality SensioLabsInsight

The Event Component.

Example(s)

<?php

use miBadger\Event\EventListenerInterface;

/**
 * The event listener class.
 */
class EventListener implements EventListenerInterface
{
    /**
     * {@inheritdoc}
     */
    public function update(SubjectInterface $subject, $arguments = null)
    {
        // Action that needs to be executed if the event fires.
    }
}
<?php

use miBadger\Event\Event;

/**
 * Construct a new event.
 */
$event = new Event();

/**
 * Construct a new event listener.
 */
$eventListener = new EventListener()

/**
 * Returns true if the observer is attached successfully.
 */
$event->attach($eventListener);

/**
 * Notify all the attached observers.
 */
$event->notify();