Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 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      #[ReturnTypeWillChange]
  99       public function offsetGet($offset)
 100       {
 101           return null;
 102       }
 103  
 104      /**
 105       */
 106      #[ReturnTypeWillChange]
 107      public function offsetSet($offset, $value)
 108      {
 109      }
 110  
 111      /**
 112       */
 113      #[ReturnTypeWillChange]
 114      public function offsetExists($offset)
 115      {
 116          return false;
 117      }
 118  
 119      /**
 120       */
 121      #[ReturnTypeWillChange]
 122      public function offsetUnset($offset)
 123      {
 124      }
 125  
 126      /* Countable methods. */
 127  
 128      /**
 129       */
 130      #[ReturnTypeWillChange]
 131      public function count()
 132      {
 133          return 0;
 134      }
 135  
 136      /* IteratorAggregate method. */
 137  
 138      /**
 139       */
 140      #[ReturnTypeWillChange]
 141      public function getIterator()
 142      {
 143          return new ArrayIterator(array());
 144      }
 145  
 146  }