TemporaryProjectFile
in package
FinalYes
Spool project bytes to a bounded temporary file for ZipArchive-based parsing.
Table of Contents
Constants
- CHUNK_BYTES : mixed = 1048576
Methods
- fromContents() : string
- Write in-memory bytes to a bounded temporary project file.
- fromStream() : string
- Copy a readable stream to a temporary project file.
- createPath() : string
- Create a temporary project path with the requested extension.
- normalizeExtension() : string
- Normalize an extension for a temporary project filename.
- writeAll() : void
- Write an entire string to a stream, handling partial writes.
Constants
CHUNK_BYTES
private
mixed
CHUNK_BYTES
= 1048576
Methods
fromContents()
Write in-memory bytes to a bounded temporary project file.
public
static fromContents(string $contents, string $extension, int $maxBytes) : string
Parameters
- $contents : string
-
Project bytes.
- $extension : string
-
Desired temporary file extension.
- $maxBytes : int
-
Maximum compressed input bytes.
Return values
stringfromStream()
Copy a readable stream to a temporary project file.
public
static fromStream(mixed $stream, string $extension, int $maxBytes) : string
Parameters
- $stream : mixed
-
Readable PHP stream resource.
- $extension : string
-
Desired temporary file extension.
- $maxBytes : int
-
Maximum compressed input bytes.
Return values
stringcreatePath()
Create a temporary project path with the requested extension.
private
static createPath(string $extension) : string
Parameters
- $extension : string
-
Requested extension.
Return values
stringnormalizeExtension()
Normalize an extension for a temporary project filename.
private
static normalizeExtension(string $extension) : string
Parameters
- $extension : string
-
Requested extension.
Return values
stringwriteAll()
Write an entire string to a stream, handling partial writes.
private
static writeAll(resource $stream, string $data) : void
Parameters
- $stream : resource
-
Target stream.
- $data : string
-
Bytes to write.