PHP 8.2.30
Preview: FileSnippetProvider.php Size: 789 B
/proc/thread-self/root/home/byroehnu/easetack.com/vendor/spatie/backtrace/src/CodeSnippets/FileSnippetProvider.php

<?php

namespace Spatie\Backtrace\CodeSnippets;

use SplFileObject;

class FileSnippetProvider implements SnippetProvider
{
    /** @var \SplFileObject */
    protected $file;

    public function __construct(string $path)
    {
        $this->file = new SplFileObject($path);
    }

    public function numberOfLines(): int
    {
        $this->file->seek(PHP_INT_MAX);

        return $this->file->key() + 1;
    }

    public function getLine(?int $lineNumber = null): string
    {
        if (is_null($lineNumber)) {
            return $this->getNextLine();
        }

        $this->file->seek($lineNumber - 1);

        return $this->file->current();
    }

    public function getNextLine(): string
    {
        $this->file->next();

        return $this->file->current();
    }
}

Directory Contents

Dirs: 0 × Files: 5

Name Size Perms Modified Actions
1.93 KB lrw-rw-rw- 2024-12-02 13:28:15
Edit Download
789 B lrw-rw-rw- 2024-12-02 13:28:15
Edit Download
1.50 KB lrw-rw-rw- 2024-12-02 13:28:15
Edit Download
393 B lrw-rw-rw- 2024-12-02 13:28:15
Edit Download
228 B lrw-rw-rw- 2024-12-02 13:28:15
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).