Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Quoc Vu committed May 9, 2013
149 parents cdb0e25 + 55ca933 + 58174bc + 1804746 + 67c0075 + e5983dd + a8b3425 + a2a193a + 33d1c27 + 1d5cfa1 + 460ae0b + c577f06 + db33b2e + fea371a + c93bbae + a4ff530 + cbd4621 + 4b4dffb + 00380d2 + 3895f9f + 6349844 + b6905a7 + b7735a0 + 8312aef + 7be4333 + 8625190 + 4dd38f5 + e02bd81 + 87c797f + 73208bf + 0272cd1 + 1fcbea4 + 197a891 + 5859e98 + d34ef1c + e06dc2f + 4907ff6 + fd0e0ba + 891fbf7 + 83d5b01 + 4579f15 + c86ed1e + 16b8f20 + 83086b6 + a81c8a5 + a85d989 + 55ef06c + a2d63b1 + 8210d1d + 0a08fc0 + 7d37340 + ab0ab2a + b9e0b9b + e1d4bda + e251276 + 161ba87 + f10c77c + 58cc6ef + cecfbb0 + c165fb8 + 1febb29 + 3325e48 + 8b68fab + 43c1b37 + ec52465 + 2904103 + e4d7a5a + be7b13f + f8dd43d + b1b3322 + 93ccc75 + 2d494af + 25e9a69 + 3f70aa8 + 598d6ed + 8161582 + c01dc55 + 98634fe + 0c55546 + 1c83b8f + 815d8cc + 19c90c8 + 5dbf1b9 + 4a927fd + 4a648ec + d0636ac + 840f139 + aafb3ee + 8600965 + b26220b + 860ba0d + 759cd42 + eebf7bc + 6546e0d + 11d36d3 + 4a1db1e + 04eebff + 892dcff + b878b24 + 2db85a1 + 97242e6 + 9ee6b4d + 13fabed + 8fe32d7 + 035474f + 918b5da + a196779 + 3d3d017 + 6fa20e6 + b20a39d + 226510f + 6d779b2 + ae8a2d3 + b2b7d74 + d748fa1 + dab45d1 + 8d65fb0 + 1f16b54 + 282eead + cb64f10 + 491c672 + e10e997 + 93858ca + d41e72e + 9af5add + 309bc00 + 984be73 + be29716 + 41232e8 + 1b6d07e + 8cd4674 + ee1d485 + e5aa383 + fc3991f + ba6e7b6 + 90ecccb + b1db52f + ef24a14 + ae89a5d + 2963b07 + 5174cf5 + ce1dffc + 0c36811 + 486ca02 + f995ad2 + c4edf83 + f7ed875 + 372eb58 + c450aa4 commit b5dc21d
Show file tree
Hide file tree
Showing 42 changed files with 630 additions and 138 deletions.
6 changes: 6 additions & 0 deletions composer.json
Expand Up @@ -15,6 +15,12 @@
"php": ">=5.3.3",
"zendframework/zend-stdlib": "self.version"
},
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
}
},
"homepage": "https://github.com/zendframework/zend-event-manager",
"autoload-dev": {
"psr-4": {
Expand Down
34 changes: 34 additions & 0 deletions src/AbstractListenerAggregate.php
@@ -0,0 +1,34 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\EventManager;


/**
* Abstract aggregate listener
*/
abstract class AbstractListenerAggregate implements ListenerAggregateInterface
{
/**
* @var \Zend\Stdlib\CallbackHandler[]
*/
protected $listeners = array();

/**
* {@inheritDoc}
*/
public function detach(EventManagerInterface $events)
{
foreach ($this->listeners as $index => $callback) {
if ($events->detach($callback)) {
unset($this->listeners[$index]);
}
}
}
}
6 changes: 1 addition & 5 deletions src/Event.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -17,9 +16,6 @@
*
* Encapsulates the target context and parameters passed, and provides some
* behavior for interacting with the event manager.
*
* @category Zend
* @package Zend_EventManager
*/
class Event implements EventInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/EventInterface.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -14,9 +13,6 @@

/**
* Representation of an event
*
* @category Zend
* @package Zend_EventManager
*/
interface EventInterface
{
Expand Down
18 changes: 11 additions & 7 deletions src/EventManager.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -21,9 +20,6 @@
*
* Use the EventManager when you want to create a per-instance notification
* system for your objects.
*
* @category Zend
* @package Zend_EventManager
*/
class EventManager implements EventManagerInterface
{
Expand Down Expand Up @@ -161,7 +157,7 @@ public function setIdentifiers($identifiers)
public function addIdentifiers($identifiers)
{
if (is_array($identifiers) || $identifiers instanceof Traversable) {
$this->identifiers = array_unique($this->identifiers + (array) $identifiers);
$this->identifiers = array_unique(array_merge($this->identifiers, (array) $identifiers));
} elseif ($identifiers !== null) {
$this->identifiers = array_unique(array_merge($this->identifiers, array($identifiers)));
}
Expand Down Expand Up @@ -205,6 +201,9 @@ public function trigger($event, $target = null, $argv = array(), $callback = nul
throw new Exception\InvalidCallbackException('Invalid callback provided');
}

// Initial value of stop propagation flag should be false
$e->stopPropagation(false);

return $this->triggerListeners($event, $e, $callback);
}

Expand Down Expand Up @@ -247,6 +246,9 @@ public function triggerUntil($event, $target, $argv = null, $callback = null)
throw new Exception\InvalidCallbackException('Invalid callback provided');
}

// Initial value of stop propagation flag should be false
$e->stopPropagation(false);

return $this->triggerListeners($event, $e, $callback);
}

Expand Down Expand Up @@ -459,9 +461,11 @@ protected function triggerListeners($event, EventInterface $e, $callback = null)
}

foreach ($listeners as $listener) {
$listenerCallback = $listener->getCallback();

// Trigger the listener's callback, and push its result onto the
// response collection
$responses->push(call_user_func($listener->getCallback(), $e));
$responses->push(call_user_func($listenerCallback, $e));

// If the event was asked to stop propagating, do so
if ($e->propagationIsStopped()) {
Expand Down
7 changes: 1 addition & 6 deletions src/EventManagerAwareInterface.php
Expand Up @@ -3,19 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;

/**
* Interface to automate setter injection for an EventManager instance
*
* @category Zend
* @package Zend_EventManager
* @subpackage UnitTest
*/
interface EventManagerAwareInterface extends EventsCapableInterface
{
Expand Down
17 changes: 17 additions & 0 deletions src/EventManagerAwareTrait.php
@@ -0,0 +1,17 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\EventManager;

use \Zend\EventManager\ProvidesEvents;

trait EventManagerAwareTrait
{
use ProvidesEvents;
}
6 changes: 1 addition & 5 deletions src/EventManagerInterface.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -15,9 +14,6 @@

/**
* Interface for messengers
*
* @category Zend
* @package Zend_EventManager
*/
interface EventManagerInterface extends SharedEventManagerAwareInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/EventsCapableInterface.php
Expand Up @@ -3,18 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;

/**
* Interface providing events that can be attached, detached and triggered.
*
* @category Zend
* @package Zend_EventManager
*/
interface EventsCapableInterface
{
Expand Down
3 changes: 1 addition & 2 deletions src/Exception/DomainException.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager\Exception;
Expand Down
6 changes: 1 addition & 5 deletions src/Exception/ExceptionInterface.php
Expand Up @@ -3,18 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager\Exception;

/**
* Base exception interface
*
* @category Zend
* @package Zend_EventManager
*/
interface ExceptionInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/Exception/InvalidArgumentException.php
Expand Up @@ -3,18 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager\Exception;

/**
* Invalid argument exception
*
* @category Zend
* @package Zend_EventManager
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/Exception/InvalidCallbackException.php
Expand Up @@ -3,18 +3,14 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager\Exception;

/**
* Invalid callback exception
*
* @category Zend
* @package Zend_EventManager
*/
class InvalidCallbackException extends DomainException implements ExceptionInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/Filter/FilterInterface.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager\Filter;
Expand All @@ -15,9 +14,6 @@

/**
* Interface for intercepting filter chains
*
* @category Zend
* @package Zend_EventManager
*/
interface FilterInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/Filter/FilterIterator.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager\Filter;
Expand All @@ -18,9 +17,6 @@
* filter chain.
*
* Allows removal
*
* @category Zend
* @package Zend_EventManager
*/
class FilterIterator extends SplPriorityQueue
{
Expand Down
6 changes: 1 addition & 5 deletions src/FilterChain.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -14,9 +13,6 @@

/**
* FilterChain: intercepting filter manager
*
* @category Zend
* @package Zend_EventManager
*/
class FilterChain implements Filter\FilterInterface
{
Expand Down
6 changes: 1 addition & 5 deletions src/GlobalEventManager.php
Expand Up @@ -3,9 +3,8 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_EventManager
*/

namespace Zend\EventManager;
Expand All @@ -18,9 +17,6 @@
*
* Use the EventManager when you want to create a per-instance notification
* system for your objects.
*
* @category Zend
* @package Zend_EventManager
*/
class GlobalEventManager
{
Expand Down

0 comments on commit b5dc21d

Please sign in to comment.