You are here

public function MimeStreamWrapper::getContext in UIkit Components 8.3

Creates a stream's context resource.

Return value

resource

File

src/MimeStreamWrapper.php, line 119

Class

MimeStreamWrapper
Provides a stream wrapper to retrieve mime type information from any source.

Namespace

Drupal\uikit_components

Code

public function getContext() {
  if (!self::$isRegistered) {
    stream_wrapper_register(self::WRAPPER_NAME, get_class());
    self::$isRegistered = TRUE;
  }
  return stream_context_create([
    self::WRAPPER_NAME => [
      'cb' => [
        $this,
        'read',
      ],
      'fileStat' => $this->fileStat,
    ],
  ]);
}