src/Http/Stream.php
public function getMetadata($key = null)
    {
        if (!is_array($this->meta_data) || !count($this->meta_data)) {
            $this->meta_data = is_resource($this->stream) ? stream_get_meta_data($this->stream) : [];
        }

        return is_null($key) ? $this->meta_data :
            $this->meta_data[(string)$key] ?? null;
    }
public function getMetadata($key = null)
    {
        if (!is_array($this->meta_data) || !count($this->meta_data)) {
            $this->meta_data = is_resource($this->stream) ? stream_get_meta_data($this->stream) : [];
        }

        return is_null($key) ? $this->meta_data :
            $this->meta_data[(string)$key] ?? null;
    }
Get stream metadata as an associative array or retrieve a specific key.
The keys returned are identical to the keys returned from PHP's
stream_get_meta_data() function.

@link http://php.net/manual/en/function.stream-get-meta-data.php
@param string $key Specific metadata to retrieve.
@return array|mixed|null Returns an associative array if no key is
provided. Returns a specific key value if a key is provided and the
value is found, or null if the key is not found.