Stream::getMetadata( $key = null ): mixed

In this article

Return

mixed

Source

public function getMetadata($key = null)
{
    if (null !== $key && !\is_string($key)) {
        throw new \InvalidArgumentException('Metadata key must be a string');
    }
    if (!isset($this->stream)) {
        return $key ? null : [];
    }
    $meta = \stream_get_meta_data($this->stream);
    if (null === $key) {
        return $meta;
    }
    return $meta[$key] ?? null;
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.