Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4102487
LocalRpcClient.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
975 B
Referenced Files
None
Subscribers
None
LocalRpcClient.php
View Options
<?php
namespace
Shellbox\RPC
;
use
Shellbox\ShellboxError
;
use
Throwable
;
/**
* An implementation of RPCClient that executes the provided commands locally.
*/
class
LocalRpcClient
implements
RpcClient
{
public
function
call
(
string
$routeName
,
$functionName
,
array
$params
=
[],
array
$options
=
[]
)
{
$binary
=
!
empty
(
$options
[
'binary'
]
);
if
(
$binary
)
{
$params
=
array_map
(
static
function
(
$param
)
{
return
(
string
)
$param
;
},
$params
);
}
foreach
(
$options
[
'sources'
]
??
[]
as
$source
)
{
require_once
$source
;
}
// We don't need to require $options['classes'] sources - local client
// is run in the same environment as the calling code, so classes
// be autoloaded.
try
{
$result
=
call_user_func_array
(
$functionName
,
$params
);
}
catch
(
Throwable
$e
)
{
throw
new
ShellboxError
(
$e
->
getMessage
(),
$e
->
getCode
(),
$e
);
}
if
(
$binary
)
{
$result
=
(
string
)
$result
;
}
return
$result
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 17:28 (3 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e9/db/d9b633ddfc42e24aca30aaa9f688
Default Alt Text
LocalRpcClient.php (975 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment