Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

   1  <?php
   2  /**
   3   * Copyright 2008-2017 Horde LLC (http://www.horde.org/)
   4   *
   5   * @category  Horde
   6   * @copyright 2008-2017 Horde LLC
   7   * @license   http://www.horde.org/licenses/bsd BSD
   8   * @package   Support
   9   */
  10  
  11  /**
  12   * Class that can substitute for any object and safely do nothing.
  13   *
  14   * @category  Horde
  15   * @copyright 2008-2017 Horde LLC
  16   * @license   http://www.horde.org/licenses/bsd BSD
  17   * @package   Support
  18   */
  19  class Horde_Support_Stub implements ArrayAccess, Countable, IteratorAggregate
  20  {
  21      /**
  22       * Cooerce to an empty string.
  23       *
  24       * @return string
  25       */
  26      public function __toString()
  27      {
  28          return '';
  29      }
  30  
  31      /**
  32       * Ignore setting the requested property.
  33       *
  34       * @param string $key  The property.
  35       * @param mixed $val   The property's value.
  36       */
  37      public function __set($key, $val)
  38      {
  39      }
  40  
  41      /**
  42       * Return null for any requested property.
  43       *
  44       * @param string $key  The requested object property.
  45       *
  46       * @return null  Null.
  47       */
  48      public function __get($key)
  49      {
  50          return null;
  51      }
  52  
  53      /**
  54       * Property existence.
  55       *
  56       * @param string $key  The requested object property.
  57       *
  58       * @return boolean  False.
  59       */
  60      public function __isset($key)
  61      {
  62          return false;
  63      }
  64  
  65      /**
  66       * Ignore unsetting a property.
  67       *
  68       * @param string $key  The requested object property.
  69       */
  70      public function __unset($key)
  71      {
  72      }
  73  
  74      /**
  75       * Gracefully accept any method call and do nothing.
  76       *
  77       * @param string $method  The method that was called.
  78       * @param array $args     The method's arguments.
  79       */
  80      public function __call($method, $args)
  81      {
  82      }
  83  
  84      /**
  85       * Gracefully accept any static method call and do nothing.
  86       *
  87       * @param string $method  The method that was called.
  88       * @param array $args     The method's arguments.
  89       */
  90      public static function __callStatic($method, $args)
  91      {
  92      }
  93  
  94      /* ArrayAccess methods. */
  95  
  96       /**
  97        */
  98       public function offsetGet($offset)
  99       {
 100           return null;
 101       }
 102  
 103      /**
 104       */
 105      public function offsetSet($offset, $value)
 106      {
 107      }
 108  
 109      /**
 110       */
 111      public function offsetExists($offset)
 112      {
 113          return false;
 114      }
 115  
 116      /**
 117       */
 118      public function offsetUnset($offset)
 119      {
 120      }
 121  
 122      /* Countable methods. */
 123  
 124      /**
 125       */
 126      public function count()
 127      {
 128          return 0;
 129      }
 130  
 131      /* IteratorAggregate method. */
 132  
 133      /**
 134       */
 135      public function getIterator()
 136      {
 137          return new ArrayIterator(array());
 138      }
 139  
 140  }