public function stream($refresh = FALSE) {

    // If we're working on local content, return that content wrapped in
    // a fake IO stream.
    if (!$refresh && isset($this->content)) {
      return $this->localFileStream();
    }

    // Otherwise, we fetch a fresh version from the remote server and
    // return its stream handle.
    $response = $this->fetchObject(TRUE);

    return $response->file();
  }
public function stream($refresh = FALSE) {

    // If we're working on local content, return that content wrapped in
    // a fake IO stream.
    if (!$refresh && isset($this->content)) {
      return $this->localFileStream();
    }

    // Otherwise, we fetch a fresh version from the remote server and
    // return its stream handle.
    $response = $this->fetchObject(TRUE);

    return $response->file();
  }
public function stream ( $ refresh = FALSE ) { // If we're working on local content, return that content wrapped in // a fake IO stream. if ( ! $ refresh && isset ( $ this -> content ) ) { return $ this -> localFileStream ( ) ; } // Otherwise, we fetch a fresh version from the remote server and // return its stream handle. $ response = $ this -> fetchObject ( TRUE ) ; return $ response -> file ( ) ; }
Get the content of this object as a file stream.

This is useful for large objects. Such objects should not be read
into memory all at once (as content() does), but should instead be
made available as an input stream.

PHP offers low-level stream support in the form of PHP stream
wrappers, and this mechanism is used internally whenever available.

If there is a local copy of the content, the stream will be read
out of the content as if it were a temp-file backed in-memory
resource. To ignore the local version, pass in TRUE for the
$refresh parameter.

If the content is coming from a remote copy, the stream will be
read directly from the underlying IO stream.

Each time stream() is called, a new stream is created. In most
cases, this results in a new HTTP transaction (unless $refresh is
FALSE and the content is already stored locally).

The stream is read-only.

@param boolean $refresh
If this is set to TRUE, any existing local modifications will be ignored
and the content will be refreshed from the server. Any
local changes to the object will be discarded.
@retval resource
@return resource
A handle to the stream, which is already opened and positioned at
the beginning of the stream.
Get the content of this object as a file stream .