3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\EventManager
;
15 * Collection of signal handler return values
17 class ResponseCollection
extends SplStack
19 protected $stopped = false;
22 * Did the last response provided trigger a short circuit of the stack?
26 public function stopped()
28 return $this->stopped
;
32 * Mark the collection as stopped (or its opposite)
35 * @return ResponseCollection
37 public function setStopped($flag)
39 $this->stopped
= (bool) $flag;
44 * Convenient access to the first handler return value.
46 * @return mixed The first handler return value
48 public function first()
50 return parent
::bottom();
54 * Convenient access to the last handler return value.
56 * If the collection is empty, returns null. Otherwise, returns value
57 * returned by last handler.
59 * @return mixed The last handler return value
61 public function last()
63 if (count($this) === 0) {
70 * Check if any of the responses match the given value.
72 * @param mixed $value The value to look for among responses
75 public function contains($value)
77 foreach ($this as $response) {
78 if ($response === $value) {