/** * Constructor. * * @param array $opts Additional configuration options: * - max_memory: (integer) The maximum amount of memory to allocate to * the PHP temporary stream. * * @throws Horde_Stream_Exception */ public function __construct(array $opts = array()) { $opts = array_merge(array('max_memory' => 2097152), $opts); if (($this->stream = @fopen('php://temp/maxmemory:' . $opts['max_memory'], 'r+')) === false) { throw new Horde_Stream_Exception('Failed to open temporary memory stream.'); } parent::__construct($opts); }
/** * Constructor. * * @param array $opts Additional configuration options: * - stream: (resource) [REQUIRED] The stream resource. * * @throws Horde_Stream_Exception */ public function __construct(array $opts = array()) { if (!isset($opts['stream']) || !is_resource($opts['stream'])) { throw new Horde_Stream_Exception('Need a stream resource.'); } $this->stream = $opts['stream']; unset($opts['stream']); parent::__construct($opts); }
/** * Constructor. * * @param array $opts Additional configuration options: * <pre> * - string: (string) [REQUIRED] The PHP string. * </pre> * * @throws InvalidArgumentException */ public function __construct(array $opts = array()) { if (!isset($opts['string']) || !is_string($opts['string'])) { throw new InvalidArgumentException('Need a PHP string.'); } $this->stream = Horde_Stream_Wrapper_String::getStream($opts['string']); unset($opts['string']); parent::__construct($opts); }
/** * Constructor. * * @param array $opts Additional configuration options: * <pre> * - max_memory: (integer) The maximum amount of memory to allocate to * the PHP temporary stream. * </pre> * * @throws Horde_Stream_Exception */ public function __construct(array $opts = array()) { parent::__construct($opts); }