PHP Classes

File: test/Helpers/ServerServiceManagerPlugin.php

Recommend this page to a friend!
  Classes of Artur Graniszewski   ZEUS for PHP   test/Helpers/ServerServiceManagerPlugin.php   Download  
File: test/Helpers/ServerServiceManagerPlugin.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: ZEUS for PHP
Manage the execution of multiple parallel tasks
Author: By
Last change:
Date: 7 years ago
Size: 1,217 bytes
 

Contents

Class file image Download
<?php

namespace ZeusTest\Helpers;

use
Zend\EventManager\EventManagerInterface;
use
Zend\EventManager\ListenerAggregateInterface;
use
Zeus\ServerService\ManagerEvent;

class
ServerServiceManagerPlugin implements ListenerAggregateInterface
{
    protected
$eventsTriggered = [];

   
/**
     * Attach one or more listeners
     *
     * Implementors may add an optional $priority argument; the EventManager
     * implementation will pass this to the aggregate.
     *
     * @param EventManagerInterface $events
     * @param int $priority
     * @return void
     */
   
public function attach(EventManagerInterface $events, $priority = 1)
    {
       
$events->attach('*', function(ManagerEvent $event) {
           
$this->eventsTriggered[] = $event->getName();
        });
    }

   
/**
     * Detach all previously attached listeners
     *
     * @param EventManagerInterface $events
     * @return void
     */
   
public function detach(EventManagerInterface $events)
    {
       
// TODO: Implement detach() method.
   
}

   
/**
     * @return string[]
     */
   
public function getTriggeredEvents()
    {
        return
$this->eventsTriggered;
    }
}