PipeSession
in package
uses
LineSessionTrait
Table of Contents
Constants
- METHOD_REGEX = ';^[a-z][a-zA-Z0-9_]*$;'
Properties
- $bufferSize : int
- Maximum size of the buffer for reading lines.
- $delimiter : string
- Line-delimiter.
- $input : resource
- $methods : object
- Open-ended object. Any public method from this object will be available during this session.
- $output : resource
- $responsePrefix : string|null
- A value to display immediately before the response lines.
- $trusted : bool|null
Methods
- __construct() : mixed
- getBufferSize() : int
- getResponsePrefix() : string|null
- isTrusted() : bool
- run() : mixed
- Run the main loop. Poll for commands on $input and write responses to $output.
- setBufferSize() : $this
- setIO() : $this
- setResponsePrefix() : $this
- setTrusted() : PipeSession
- onConnect() : string|null
- onException() : string|null
- onRequest() : string|null
- write() : void
Constants
METHOD_REGEX
protected
mixed
METHOD_REGEX
= ';^[a-z][a-zA-Z0-9_]*$;'
Properties
$bufferSize
Maximum size of the buffer for reading lines.
protected
int
$bufferSize
= 524288
Clients may need to set this if they submit large requests.
$delimiter
Line-delimiter.
protected
string
$delimiter
= "\n"
$input
protected
resource
$input
Ex: STDIN
$methods
Open-ended object. Any public method from this object will be available during this session.
protected
object
$methods
Tags
$output
protected
resource
$output
Ex: STDOUT
$responsePrefix
A value to display immediately before the response lines.
protected
string|null
$responsePrefix
= NULL
Clients may set this is if they want to detect and skip buggy noise.
Ex: chr(1).chr(1)
$trusted
protected
bool|null
$trusted
Methods
__construct()
public
__construct([resource|null $input = NULL ][, resource|null $output = NULL ]) : mixed
Parameters
- $input : resource|null = NULL
- $output : resource|null = NULL
getBufferSize()
public
getBufferSize() : int
Return values
intgetResponsePrefix()
public
getResponsePrefix() : string|null
Return values
string|nullisTrusted()
public
isTrusted() : bool
Return values
boolrun()
Run the main loop. Poll for commands on $input and write responses to $output.
public
run([string $negotiationFlags = '' ]) : mixed
Parameters
- $negotiationFlags : string = ''
-
List of pipe initialization flags. See Civi::pipe() for description of flags.
setBufferSize()
public
setBufferSize(int $bufferSize) : $this
Parameters
- $bufferSize : int
Return values
$thissetIO()
public
setIO(resource $input, resource $output) : $this
Parameters
- $input : resource
- $output : resource
Return values
$thissetResponsePrefix()
public
setResponsePrefix(string|null $responsePrefix) : $this
Parameters
- $responsePrefix : string|null
Return values
$thissetTrusted()
public
setTrusted(bool $trusted) : PipeSession
Parameters
- $trusted : bool
Return values
PipeSessiononConnect()
protected
onConnect(string $negotiationFlags) : string|null
Parameters
- $negotiationFlags : string
Tags
Return values
string|nullonException()
protected
onException(string $requestLine, Throwable $t) : string|null
Parameters
- $requestLine : string
- $t : Throwable
Tags
Return values
string|nullonRequest()
protected
onRequest(string $requestLine) : string|null
Parameters
- $requestLine : string
Tags
Return values
string|nullwrite()
protected
write(string|null $response) : void
Parameters
- $response : string|null