for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Phossa Project
*
* PHP version 5.4
* @category Library
* @package Phossa2\Event
* @copyright Copyright (c) 2016 phossa.com
* @license http://mit-license.org/ MIT License
* @link http://www.phossa.com/
*/
/*# declare(strict_types=1); */
namespace Phossa2\Event\Traits;
use Phossa2\Event\Interfaces\ListenerInterface;
* ListenerTrait
* @author Hong Zhang <[email protected]>
* @see ListenerInterface
* @version 2.1.4
* @since 2.1.3 added
* @since 2.1.4 updated
trait ListenerTrait
{
* Events listening
* @var array
* @access protected
protected $events_listening = [];
* {@inheritDoc}
public function eventsListening()/*# : array */
return $this->events_listening;
}
public function registerEvent(/*# string */ $eventName, $handler)
if (!isset($this->events_listening[$eventName])) {
$this->events_listening[$eventName] = [];
$this->events_listening[$eventName][] = $handler;
return $this;