Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / EventManager / ResponseCollection.php
blob5131d1d402ac22a425e55699c09e7398b61408d0
1 <?php
2 /**
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
8 */
10 namespace Zend\EventManager;
12 use SplStack;
14 /**
15 * Collection of signal handler return values
17 class ResponseCollection extends SplStack
19 protected $stopped = false;
21 /**
22 * Did the last response provided trigger a short circuit of the stack?
24 * @return bool
26 public function stopped()
28 return $this->stopped;
31 /**
32 * Mark the collection as stopped (or its opposite)
34 * @param bool $flag
35 * @return ResponseCollection
37 public function setStopped($flag)
39 $this->stopped = (bool) $flag;
40 return $this;
43 /**
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();
53 /**
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) {
64 return null;
66 return parent::top();
69 /**
70 * Check if any of the responses match the given value.
72 * @param mixed $value The value to look for among responses
73 * @return bool
75 public function contains($value)
77 foreach ($this as $response) {
78 if ($response === $value) {
79 return true;
82 return false;