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

Commit

Permalink
Removed old test files for Zend/Cloud/Infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 82 deletions.
4 changes: 2 additions & 2 deletions src/Event.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -33,7 +33,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Event implements EventDescription
Expand Down
4 changes: 2 additions & 2 deletions src/EventCollection.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface EventCollection
Expand Down
4 changes: 2 additions & 2 deletions src/EventDescription.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -28,7 +28,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface EventDescription
Expand Down
80 changes: 42 additions & 38 deletions src/EventManager.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -38,7 +38,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class EventManager implements EventCollection
Expand Down Expand Up @@ -122,8 +122,8 @@ public function getStaticConnections()
}

/**
* Get the identifier(s) for this EventManager
*
* Get the identifier(s) for this EventManager
*
* @return array
*/
public function getIdentifiers()
Expand All @@ -132,9 +132,9 @@ public function getIdentifiers()
}

/**
* Set the identifiers (overrides any currently set identifiers)
*
* @param string|int|array|Traversable $identifiers
* Set the identifiers (overrides any currently set identifiers)
*
* @param string|int|array|Traversable $identifiers
* @return ModuleManager
*/
public function setIdentifiers($identifiers)
Expand All @@ -148,9 +148,9 @@ public function setIdentifiers($identifiers)
}

/**
* Add some identifier(s) (appends to any currently set identifiers)
*
* @param string|int|array|Traversable $identifiers
* Add some identifier(s) (appends to any currently set identifiers)
*
* @param string|int|array|Traversable $identifiers
* @return ModuleManager
*/
public function addIdentifiers($identifiers)
Expand All @@ -171,7 +171,7 @@ public function addIdentifiers($identifiers)
* @param string $event
* @param string|object $target Object calling emit, or symbol describing target (such as static method name)
* @param array|ArrayAccess $argv Array of arguments; typically, should be associative
* @param null|callback $callback
* @param null|callback $callback
* @return ResponseCollection All listener return values
*/
public function trigger($event, $target = null, $argv = array(), $callback = null)
Expand All @@ -195,10 +195,8 @@ public function trigger($event, $target = null, $argv = array(), $callback = nul
$e->setParams($argv);
}

if (!$callback) {
$callback = function() {
return false;
};
if ($callback && !is_callable($callback)) {
throw new InvalidCallbackException('Invalid callback provided');
}

return $this->triggerListeners($event, $e, $callback);
Expand Down Expand Up @@ -377,29 +375,35 @@ public function prepareArgs(array $args)
/**
* Trigger listeners
*
* Actual functionality for triggering listeners, to which both trigger() and triggerUntil()
* Actual functionality for triggering listeners, to which both trigger() and triggerUntil()
* delegate.
*
* @param string $event Event name
* @param EventDescription $e
* @param callback $callback
*
* @param string $event Event name
* @param EventDescription $e
* @param null|callback $callback
* @return ResponseCollection
*/
protected function triggerListeners($event, EventDescription $e, $callback)
protected function triggerListeners($event, EventDescription $e, $callback = null)
{
$responses = new ResponseCollection;

$listeners = clone $this->getListeners($event);
foreach ($this->getStaticListeners($event) as $listener) {
$priority = $listener->getOption('priority');
if (null === $priority) {
$priority = 1;
} elseif (is_array($priority)) {
// If we have an array, likely using PriorityQueue. Grab first
// element of the array, as that's the actual priority.
$priority = array_shift($priority);
$listeners = $this->getListeners($event);

// add static listeners to the list of listeners
// but don't modify the listeners object
$staticListeners = $this->getStaticListeners($event);
if (count($staticListeners)) {
$listeners = clone $listeners;
foreach ($staticListeners as $listener) {
$priority = $listener->getOption('priority');
if (null === $priority) {
$priority = 1;
} elseif (is_array($priority)) {
// If we have an array, likely using PriorityQueue. Grab first
// element of the array, as that's the actual priority.
$priority = array_shift($priority);
}
$listeners->insert($listener, $priority);
}
$listeners->insert($listener, $priority);
}

if ($listeners->isEmpty()) {
Expand All @@ -413,7 +417,7 @@ protected function triggerListeners($event, EventDescription $e, $callback)
continue;
}

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

Expand All @@ -423,9 +427,9 @@ protected function triggerListeners($event, EventDescription $e, $callback)
break;
}

// If the result causes our validation callback to return true,
// If the result causes our validation callback to return true,
// stop propagation
if (call_user_func($callback, $responses->last())) {
if ($callback && call_user_func($callback, $responses->last())) {
$responses->setStopped(true);
break;
}
Expand All @@ -435,10 +439,10 @@ protected function triggerListeners($event, EventDescription $e, $callback)
}

/**
* Get list of all listeners attached to the static collection for
* Get list of all listeners attached to the static collection for
* identifiers registered by this instance
*
* @param string $event
*
* @param string $event
* @return array
*/
protected function getStaticListeners($event)
Expand Down
4 changes: 2 additions & 2 deletions src/Exception.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -28,7 +28,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/InvalidArgumentException.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidArgumentException
Expand Down
4 changes: 2 additions & 2 deletions src/Filter.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Filter
Expand Down
4 changes: 2 additions & 2 deletions src/Filter/FilterIterator.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -34,7 +34,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class FilterIterator extends SplPriorityQueue
Expand Down
4 changes: 2 additions & 2 deletions src/FilterChain.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -31,7 +31,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class FilterChain implements Filter
Expand Down
4 changes: 2 additions & 2 deletions src/GlobalEventManager.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -35,7 +35,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class GlobalEventManager
Expand Down
4 changes: 2 additions & 2 deletions src/ListenerAggregate.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -33,7 +33,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ListenerAggregate
Expand Down
4 changes: 2 additions & 2 deletions src/ProvidesEvents.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
trait ProvidesEvents
Expand Down
4 changes: 2 additions & 2 deletions src/ResponseCollection.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ResponseCollection extends SplStack
Expand Down
4 changes: 2 additions & 2 deletions src/StaticEventCollection.php
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -28,7 +28,7 @@
*
* @category Zend
* @package Zend_EventManager
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface StaticEventCollection
Expand Down

0 comments on commit ec52465

Please sign in to comment.