code: 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;
      }
docs: Returns stream metadata as an associative array or retrieve a specific key.
  
  @param  string $key
  @return array|mixed|null