[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/zendframework/zend-eventmanager/src/ -> ResponseCollection.php (source)

   1  <?php
   2  /**
   3   * Zend Framework (http://framework.zend.com/)
   4   *
   5   * @link      http://github.com/zendframework/zend-eventmanager for the canonical source repository
   6   * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
   7   * @license   https://github.com/zendframework/zend-eventmanager/blob/master/LICENSE.md
   8   */
   9  
  10  namespace Zend\EventManager;
  11  
  12  use SplStack;
  13  
  14  /**
  15   * Collection of signal handler return values
  16   */
  17  class ResponseCollection extends SplStack
  18  {
  19      protected $stopped = false;
  20  
  21      /**
  22       * Did the last response provided trigger a short circuit of the stack?
  23       *
  24       * @return bool
  25       */
  26      public function stopped()
  27      {
  28          return $this->stopped;
  29      }
  30  
  31      /**
  32       * Mark the collection as stopped (or its opposite)
  33       *
  34       * @param  bool $flag
  35       */
  36      public function setStopped($flag)
  37      {
  38          $this->stopped = (bool) $flag;
  39      }
  40  
  41      /**
  42       * Convenient access to the first handler return value.
  43       *
  44       * @return mixed The first handler return value
  45       */
  46      public function first()
  47      {
  48          return parent::bottom();
  49      }
  50  
  51      /**
  52       * Convenient access to the last handler return value.
  53       *
  54       * If the collection is empty, returns null. Otherwise, returns value
  55       * returned by last handler.
  56       *
  57       * @return mixed The last handler return value
  58       */
  59      public function last()
  60      {
  61          if (count($this) === 0) {
  62              return;
  63          }
  64          return parent::top();
  65      }
  66  
  67      /**
  68       * Check if any of the responses match the given value.
  69       *
  70       * @param  mixed $value The value to look for among responses
  71       * @return bool
  72       */
  73      public function contains($value)
  74      {
  75          foreach ($this as $response) {
  76              if ($response === $value) {
  77                  return true;
  78              }
  79          }
  80          return false;
  81      }
  82  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1