diff --git a/src/Socialbox/Classes/StandardMethods/Settings/SettingsInformationFieldExists.php b/src/Socialbox/Classes/StandardMethods/Settings/SettingsInformationFieldExists.php new file mode 100644 index 0000000..3823e81 --- /dev/null +++ b/src/Socialbox/Classes/StandardMethods/Settings/SettingsInformationFieldExists.php @@ -0,0 +1,46 @@ +containsParameter('field')) + { + throw new MissingRpcArgumentException('field'); + } + $fieldName = InformationFieldName::tryFrom(strtoupper($rpcRequest->getParameter('field'))); + if($fieldName === null) + { + throw new InvalidRpcArgumentException('field'); + } + + try + { + return $rpcRequest->produceResponse(PeerInformationManager::fieldExists($request->getPeer(), $fieldName)); + + } + catch(DatabaseOperationException $e) + { + throw new StandardRpcException('Failed to check if the requested information field exists or not', StandardError::INTERNAL_SERVER_ERROR, $e); + } + } + } \ No newline at end of file