mirror of
https://github.com/Icinga/icinga-php-thirdparty.git
synced 2025-08-23 02:28:15 +02:00
96 lines
2.4 KiB
PHP
96 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* Zend Framework
|
|
*
|
|
* LICENSE
|
|
*
|
|
* This source file is subject to the new BSD license that is bundled
|
|
* with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* http://framework.zend.com/license/new-bsd
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@zend.com so we can send you a copy immediately.
|
|
*
|
|
* @category Zend
|
|
* @package Zend_EventManager
|
|
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
*/
|
|
|
|
/**
|
|
* Collection of signal handler return values
|
|
*
|
|
* @category Zend
|
|
* @package Zend_EventManager
|
|
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
*/
|
|
class Zend_EventManager_ResponseCollection extends SplStack
|
|
{
|
|
protected $stopped = false;
|
|
|
|
/**
|
|
* Did the last response provided trigger a short circuit of the stack?
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function stopped()
|
|
{
|
|
return $this->stopped;
|
|
}
|
|
|
|
/**
|
|
* Mark the collection as stopped (or its opposite)
|
|
*
|
|
* @param bool $flag
|
|
* @return Zend_EventManager_ResponseCollection
|
|
*/
|
|
public function setStopped($flag)
|
|
{
|
|
$this->stopped = (bool) $flag;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Convenient access to the first handler return value.
|
|
*
|
|
* @return mixed The first handler return value
|
|
*/
|
|
public function first()
|
|
{
|
|
return parent::bottom();
|
|
}
|
|
|
|
/**
|
|
* Convenient access to the last handler return value.
|
|
*
|
|
* If the collection is empty, returns null. Otherwise, returns value
|
|
* returned by last handler.
|
|
*
|
|
* @return mixed The last handler return value
|
|
*/
|
|
public function last()
|
|
{
|
|
if (count($this) === 0) {
|
|
return null;
|
|
}
|
|
return parent::top();
|
|
}
|
|
|
|
/**
|
|
* Check if any of the responses match the given value.
|
|
*
|
|
* @param mixed $value The value to look for among responses
|
|
*/
|
|
public function contains($value)
|
|
{
|
|
foreach ($this as $response) {
|
|
if ($response === $value) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|