public function getMetadata($key = null)
    {
        isset($this->stream) && $this->meta = stream_get_meta_data($this->stream);

        $metadata = isset($this->meta[$key]) ? $this->meta[$key] : null;

        return is_null($key) ? $this->meta : $metadata;
    }