containsParameter('channel_uuid')) { throw new MissingRpcArgumentException('channel_uuid'); } elseif(!Validator::validateUuid($rpcRequest->getParameter('channel_uuid'))) { throw new InvalidRpcArgumentException('channel_uuid', 'The given channel uuid is not a valid UUID V4'); } $page = 1; $limit = Configuration::getPoliciesConfiguration()->getEncryptionChannelIncomingLimit(); if($rpcRequest->containsParameter('page')) { $page = (int)$rpcRequest->getParameter('page'); } if($rpcRequest->containsParameter('limit')) { $limit = (int)$rpcRequest->getParameter('limit'); } try { $requestingPeer = $request->getPeer(); return $rpcRequest->produceResponse(array_map(function($channel) use ($requestingPeer) { return $channel->toStandard(); }, EncryptionChannelManager::getIncomingChannels($requestingPeer->getAddress(), $page, $limit))); } catch(DatabaseOperationException $e) { throw new StandardRpcException('There was an error while trying to obtain incoming encryption channels', StandardError::INTERNAL_SERVER_ERROR, $e); } } }