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.
   1  <?php
   2  /**
   3   * Copyright 2012-2017 Horde LLC (http://www.horde.org/)
   4   *
   5   * See the enclosed file LICENSE for license information (LGPL). If you
   6   * did not receive this file, see http://www.horde.org/licenses/lgpl21.
   7   *
   8   * @category  Horde
   9   * @copyright 2012-2017 Horde LLC
  10   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  11   * @package   Stream
  12   */
  13  
  14  /**
  15   * Implementation of Horde_Stream for an existing stream resource. This
  16   * resource will be directly modified when manipulating using this class.
  17   *
  18   * @since 1.2.0
  19   *
  20   * @author    Michael Slusarz <slusarz@horde.org>
  21   * @category  Horde
  22   * @copyright 2012-2017 Horde LLC
  23   * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
  24   * @package   Stream
  25   */
  26  class Horde_Stream_Existing extends Horde_Stream
  27  {
  28      /**
  29       * Constructor.
  30       *
  31       * @param array $opts  Additional configuration options:
  32       *   - stream: (resource) [REQUIRED] The stream resource.
  33       *
  34       * @throws InvalidArgumentException
  35       */
  36      public function __construct(array $opts = array())
  37      {
  38          if (!isset($opts['stream']) || !is_resource($opts['stream'])) {
  39              throw new InvalidArgumentException('Need a stream resource.');
  40          }
  41  
  42          $this->stream = $opts['stream'];
  43          unset($opts['stream']);
  44  
  45          parent::__construct($opts);
  46      }
  47  
  48  }