| 1 |
<?php |
| 2 |
|
| 3 |
namespace Shellbox\RPC; |
| 4 |
|
| 5 |
use Shellbox\ShellboxError; |
| 6 |
|
| 7 |
/** |
| 8 |
* A client that executes PHP code on Shellbox server. |
| 9 |
*/ |
| 10 |
interface RpcClient { |
| 11 |
|
| 12 |
/** |
| 13 |
* Call a PHP function remotely. |
| 14 |
* |
| 15 |
* @param string $routeName A short string identifying the function |
| 16 |
* @param array|string $functionName A JSON-serializable callback |
| 17 |
* @param array $params Function parameters. If "binary" is false or absent, |
| 18 |
* the parameters must be JSON-serializable, which means that any strings |
| 19 |
* must be valid UTF-8. If "binary" is true, the parameters must all be |
| 20 |
* strings. |
| 21 |
* @param array $options An associative array of options: |
| 22 |
* - sources: An array of source file paths, to be executed on the |
| 23 |
* remote side prior to calling the function. |
| 24 |
* - classes: An array of class names. The source files for the classes |
| 25 |
* will be identified using reflection, and the files will be sent to |
| 26 |
* the server as if they were specified in the "sources" array. |
| 27 |
* - binary: If true, $params will be sent as 8-bit clean strings, and the |
| 28 |
* return value will be similarly converted to a string. |
| 29 |
* @return mixed |
| 30 |
* @throws ShellboxError |
| 31 |
*/ |
| 32 |
public function call( |
| 33 |
string $routeName, |
| 34 |
$functionName, |
| 35 |
array $params = [], |
| 36 |
array $options = [] |
| 37 |
); |
| 38 |
|
| 39 |
} |