src/AbstractStream.php
public function open($path = null, $mode = null, $options = null, &$openedPath = null)
    {
        $context = [];
        if (is_resource($this->context)) {
            $context = stream_context_get_options($this->context);
        }
        $resource = 'php://temp';
        if (isset($context[static::PROTOCOL]['resource'])) {
            $resource = $context[static::PROTOCOL]['resource'];
        }
        if (is_resource($this->resource)) {
            fclose($this->resource);
        }
        try {
            $this->setResource($resource, $mode);
        } catch (InvalidArgumentException $ex) {
            return false;
        }

        return true;
    }
public function open($path = null, $mode = null, $options = null, &$openedPath = null)
    {
        $context = [];
        if (is_resource($this->context)) {
            $context = stream_context_get_options($this->context);
        }
        $resource = 'php://temp';
        if (isset($context[static::PROTOCOL]['resource'])) {
            $resource = $context[static::PROTOCOL]['resource'];
        }
        if (is_resource($this->resource)) {
            fclose($this->resource);
        }
        try {
            $this->setResource($resource, $mode);
        } catch (InvalidArgumentException $ex) {
            return false;
        }

        return true;
    }
public function open ( $ path = null , $ mode = null , $ options = null , & $ openedPath = null ) { $ context = [ ] ; if ( is_resource ( $ this -> context ) ) { $ context = stream_context_get_options ( $ this -> context ) ; } $ resource = 'php://temp' ; if ( isset ( $ context [ static :: PROTOCOL ] [ 'resource' ] ) ) { $ resource = $ context [ static :: PROTOCOL ] [ 'resource' ] ; } if ( is_resource ( $ this -> resource ) ) { fclose ( $ this -> resource ) ; } try { $ this -> setResource ( $ resource , $ mode ) ; } catch ( InvalidArgumentException $ ex ) { return false ; } return true ; }
Opens an stream.
Uses by PHP to open an stream for specified protocol.

@param string $path        Not used. The path as "scheme://target"
@param string $mode        Not used. The type of access to the stream
@param int    $options     Not used. Holds additional flags set by the
streams API
@param string $openedPath& Not used. The full path of the file/resource
to be set

@return bool Returns true on success, false otherwise
Opens an stream . Uses by PHP to open an stream for specified protocol .