PHP 클래스 Gui\Ipc\Receiver

This class is used to receive communication messages
부터: 0.1
저자: Gabriel Couto @gabrielrcouto
파일 보기 프로젝트 열기: gabrielrcouto/php-gui 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$application gui\Application The application object
$messageCallbacks array Array of callbacks

보호된 프로퍼티들

프로퍼티 타입 설명
$buffer string The buffer of received messages
$isWaitingMessage boolean Defines if is waiting message
$parseMessagesBuffer array Array of messages in buffer
$waitingMessageId integer The id of the waitingMessage
$waitingMessageResult mixed The return of the waitingMessage

공개 메소드들

메소드 설명
__construct ( Application $application ) : void The constructor
addMessageCallback ( integer $id, callable $callback ) : void When the result of a message arrives, we call a callback
callMessageCallback ( integer $id, string | Array | Object | integer $result ) : void Result received, time to call the message callback
callObjectEventListener ( integer $id, string $eventName ) : void Fire a event on a object
onData ( string $data ) : void Process Stdout handler
tick ( ) : void Read the stdout pipe from Lazarus process. This function uses stream_select to be non blocking
waitMessage ( Stream $stdout, MessageInterface $message ) : mixed Wait a message result

보호된 메소드들

메소드 설명
jsonDecode ( string $json ) : MessageInterface | void Decode a received message
parseDebug ( $message ) : void Parse a debug message
parseNormal ( $message ) : void Parse a normal message, can be a command, command result or an event
prepareOutput ( string $string ) : String Construct the output string

메소드 상세

__construct() 공개 메소드

The constructor
public __construct ( Application $application ) : void
$application gui\Application
리턴 void

addMessageCallback() 공개 메소드

When the result of a message arrives, we call a callback
public addMessageCallback ( integer $id, callable $callback ) : void
$id integer Message ID
$callback callable Callback function
리턴 void

callMessageCallback() 공개 메소드

Result received, time to call the message callback
public callMessageCallback ( integer $id, string | Array | Object | integer $result ) : void
$id integer Message ID
$result string | Array | Object | integer Command Result
리턴 void

callObjectEventListener() 공개 메소드

Fire a event on a object
public callObjectEventListener ( integer $id, string $eventName ) : void
$id integer Object ID
$eventName string Event Name
리턴 void

jsonDecode() 보호된 메소드

Decode a received message
protected jsonDecode ( string $json ) : MessageInterface | void
$json string Received json message
리턴 MessageInterface | void

onData() 공개 메소드

Process Stdout handler
public onData ( string $data ) : void
$data string Data received
리턴 void

parseDebug() 보호된 메소드

Parse a debug message
protected parseDebug ( $message ) : void
$message Message
리턴 void

parseNormal() 보호된 메소드

Parse a normal message, can be a command, command result or an event
protected parseNormal ( $message ) : void
$message Message
리턴 void

prepareOutput() 보호된 메소드

Construct the output string
protected prepareOutput ( string $string ) : String
$string string Output string
리턴 String New output string

tick() 공개 메소드

Read the stdout pipe from Lazarus process. This function uses stream_select to be non blocking
public tick ( ) : void
리턴 void

waitMessage() 공개 메소드

Wait a message result
public waitMessage ( Stream $stdout, MessageInterface $message ) : mixed
$stdout React\Stream\Stream Stdout Stream
$message MessageInterface Command waiting result
리턴 mixed The result

프로퍼티 상세

$application 공개적으로 프로퍼티

The application object
public Application,Gui $application
리턴 gui\Application

$buffer 보호되어 있는 프로퍼티

The buffer of received messages
protected string $buffer
리턴 string

$isWaitingMessage 보호되어 있는 프로퍼티

Defines if is waiting message
protected bool $isWaitingMessage
리턴 boolean

$messageCallbacks 공개적으로 프로퍼티

Array of callbacks
public array $messageCallbacks
리턴 array

$parseMessagesBuffer 보호되어 있는 프로퍼티

Array of messages in buffer
protected array $parseMessagesBuffer
리턴 array

$waitingMessageId 보호되어 있는 프로퍼티

The id of the waitingMessage
protected int $waitingMessageId
리턴 integer

$waitingMessageResult 보호되어 있는 프로퍼티

The return of the waitingMessage
protected mixed $waitingMessageResult
리턴 mixed