Shellbox
Library and server for containerized shell execution
Loading...
Searching...
No Matches
Shellbox\Command\OutputFile Class Reference

The base class for encapsulated output files. More...

+ Inheritance diagram for Shellbox\Command\OutputFile:

Public Member Functions

 getInstance ( $boxedName)
 Get an OutputFile corresponding to an instance of the OutputEntity.
 
 copyFromFile ( $sourcePath)
 Copy from the specified source path to the registered destination location, which may be either a string or a path outside the working directory.
 
 getContents ()
 Get the contents of the output file from its final destination.
 
 readFromMultipart (MultipartReader $multipartReader)
 Copy from the MultipartReader to the registered destination location.
 
 wasReceived ()
 Return true if the file was received from the command or server.
 
 getClientData ()
 

Static Public Member Functions

static newFromClientData ( $data)
 This is used to create a placeholder object for use on the server side.
 

Protected Attributes

 $received = false
 

Detailed Description

The base class for encapsulated output files.

Member Function Documentation

◆ copyFromFile()

Shellbox\Command\OutputFile::copyFromFile ( $sourcePath)
abstract

Copy from the specified source path to the registered destination location, which may be either a string or a path outside the working directory.

Parameters
string$sourcePath

Reimplemented in Shellbox\Command\OutputFilePlaceholder, Shellbox\Command\OutputFileToFile, Shellbox\Command\OutputFileToStream, and Shellbox\Command\OutputFileToString.

◆ getContents()

Shellbox\Command\OutputFile::getContents ( )
abstract

Get the contents of the output file from its final destination.

This should be called after copyFromFile() or readFromMultipart(). It will throw if the file is not readable.

Returns
string
Exceptions
ShellboxError

Reimplemented in Shellbox\Command\OutputFilePlaceholder, Shellbox\Command\OutputFileToFile, Shellbox\Command\OutputFileToStream, and Shellbox\Command\OutputFileToString.

◆ getInstance()

Shellbox\Command\OutputFile::getInstance ( $boxedName)

Get an OutputFile corresponding to an instance of the OutputEntity.

For OutputFile objects this returns $this. For OutputGlob objects it returns an OutputFile object for a file that matches the glob.

Parameters
string$boxedName
Returns
OutputFile

Reimplemented from Shellbox\Command\OutputEntity.

◆ newFromClientData()

static Shellbox\Command\OutputFile::newFromClientData ( $data)
static

This is used to create a placeholder object for use on the server side.

It doesn't need to actually be functional since the server is responsible for reading output files.

Parameters
array$data
Returns
OutputFilePlaceholder

◆ readFromMultipart()

Shellbox\Command\OutputFile::readFromMultipart ( MultipartReader $multipartReader)
abstract

Copy from the MultipartReader to the registered destination location.

The MultipartReader must be at the appropriate place in the input stream. Used by the client.

Parameters
MultipartReader$multipartReader

Reimplemented in Shellbox\Command\OutputFilePlaceholder, Shellbox\Command\OutputFileToFile, Shellbox\Command\OutputFileToStream, and Shellbox\Command\OutputFileToString.

◆ wasReceived()

Shellbox\Command\OutputFile::wasReceived ( )

Return true if the file was received from the command or server.

Returns
bool

The documentation for this class was generated from the following file: