Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SeekableFileContent.php

function SeekableFileContent::seek

seeks to the given offset

Parameters

int $offset:

int $whence:

Return value

bool

Overrides FileContent::seek

File

vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/content/SeekableFileContent.php, line 53

Class

SeekableFileContent
Default implementation for file contents based on simple strings.

Namespace

org\bovigo\vfs\content

Code

public function seek($offset, $whence) {
    $newOffset = $this->offset;
    switch ($whence) {
        case SEEK_CUR:
            $newOffset += $offset;
            break;
        case SEEK_END:
            $newOffset = $this->size() + $offset;
            break;
        case SEEK_SET:
            $newOffset = $offset;
            break;
        default:
            return false;
    }
    if ($newOffset < 0) {
        return false;
    }
    $this->offset = $newOffset;
    return true;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal