Implement encryption channel methods and refactor related classes
This commit is contained in:
parent
fe5909aeae
commit
1b3829f62e
1 changed files with 37 additions and 0 deletions
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Classes\StandardMethods\EncryptionChannel;
|
||||
|
||||
use Socialbox\Abstracts\Method;
|
||||
use Socialbox\Enums\StandardError;
|
||||
use Socialbox\Exceptions\DatabaseOperationException;
|
||||
use Socialbox\Exceptions\Standard\MissingRpcArgumentException;
|
||||
use Socialbox\Exceptions\Standard\StandardRpcException;
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
use Socialbox\Managers\EncryptionChannelManager;
|
||||
use Socialbox\Objects\ClientRequest;
|
||||
use Socialbox\Objects\RpcRequest;
|
||||
|
||||
class EncryptionChannelExists extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(ClientRequest $request, RpcRequest $rpcRequest): ?SerializableInterface
|
||||
{
|
||||
if(!$rpcRequest->containsParameter('channel_uuid'))
|
||||
{
|
||||
throw new MissingRpcArgumentException('channel_uuid');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return $rpcRequest->produceResponse(EncryptionChannelManager::channelUuidExists($rpcRequest->getParameter('channel_uuid')));
|
||||
}
|
||||
catch (DatabaseOperationException $e)
|
||||
{
|
||||
throw new StandardRpcException('An error occurred while checking if the channel exists', StandardError::INTERNAL_SERVER_ERROR, $e);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue