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

Base class for actions that share a specific input/output protocol. More...

+ Inheritance diagram for Shellbox\Action\MultipartAction:

Public Member Functions

 __construct (Server $server)
 
 setLogger (LoggerInterface $logger)
 
 baseExecute ( $pathParts)
 The entry point for execution of the action.
 

Protected Member Functions

 execute ( $pathParts)
 Override this to implement the action.
 
 getActionName ()
 Override this to provide the action name as used in the URL.
 
 getRequiredParam ( $name)
 Get a parameter from the request, or throw if it isn't present.
 
 getParam ( $name, $default=null)
 Get a parameter from the request.
 
 getConfig ( $name)
 Get a configuration option, or throw if it doesn't exist.
 
 forgetConfig ( $name)
 Erase a configuration option.
 
 getHeader ( $name)
 Get a request header of a given name, or null if there was no such header.
 
 error ( $message, $code=500)
 Throw an error exception.
 
 writeResult ( $structuredData, $binaryData=[], $files=[])
 Write a standard result.
 
 getReceivedFileNames ()
 Get the names of the received files, relative to the temporary directory.
 

Protected Attributes

 $tempDirManager
 
 $logger
 

Detailed Description

Base class for actions that share a specific input/output protocol.

Todo
Protocol documentation

Constructor & Destructor Documentation

◆ __construct()

Shellbox\Action\MultipartAction::__construct ( Server $server)
Parameters
Server$server

Member Function Documentation

◆ baseExecute()

Shellbox\Action\MultipartAction::baseExecute ( $pathParts)

The entry point for execution of the action.

Parameters
string[]$pathParts

◆ error()

Shellbox\Action\MultipartAction::error ( $message,
$code = 500 )
protected

Throw an error exception.

Parameters
string$message
int$code
Exceptions
ShellboxError
Returns
never

◆ execute()

Shellbox\Action\MultipartAction::execute ( $pathParts)
abstractprotected

Override this to implement the action.

Parameters
string[]$pathParts

Reimplemented in Shellbox\Action\CallAction, and Shellbox\Action\ShellAction.

◆ forgetConfig()

Shellbox\Action\MultipartAction::forgetConfig ( $name)
protected

Erase a configuration option.

Parameters
string$name

◆ getActionName()

Shellbox\Action\MultipartAction::getActionName ( )
abstractprotected

Override this to provide the action name as used in the URL.

Returns
string

Reimplemented in Shellbox\Action\CallAction, and Shellbox\Action\ShellAction.

◆ getConfig()

Shellbox\Action\MultipartAction::getConfig ( $name)
protected

Get a configuration option, or throw if it doesn't exist.

Parameters
string$name
Returns
mixed
Exceptions
ShellboxError

◆ getHeader()

Shellbox\Action\MultipartAction::getHeader ( $name)
protected

Get a request header of a given name, or null if there was no such header.

Parameters
string$name
Returns
string|null

◆ getParam()

Shellbox\Action\MultipartAction::getParam ( $name,
$default = null )
protected

Get a parameter from the request.

Return the specified default if it isn't present.

Parameters
string$name
mixed$default
Returns
mixed

◆ getReceivedFileNames()

Shellbox\Action\MultipartAction::getReceivedFileNames ( )
protected

Get the names of the received files, relative to the temporary directory.

Returns
string[]

◆ getRequiredParam()

Shellbox\Action\MultipartAction::getRequiredParam ( $name)
protected

Get a parameter from the request, or throw if it isn't present.

Parameters
string$name
Returns
mixed
Exceptions
ShellboxError

◆ setLogger()

Shellbox\Action\MultipartAction::setLogger ( LoggerInterface $logger)
Parameters
LoggerInterface$logger

◆ writeResult()

Shellbox\Action\MultipartAction::writeResult ( $structuredData,
$binaryData = [],
$files = [] )
protected

Write a standard result.

Parameters
array$structuredDataJSON serializable data
string[]$binaryDataAn array of strings to be sent as multipart parts
string[]$filesThe names of the output files relative to the working directory

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