From 0849804a0b152d2e9b2b5e75f3710c407c619ede Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 27 Mar 2015 00:32:17 -0700 Subject: [PATCH] CRM_Cxn_BAO_Cxn - Comments --- CRM/Cxn/BAO/Cxn.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CRM/Cxn/BAO/Cxn.php b/CRM/Cxn/BAO/Cxn.php index 7e28772b12..76150455a8 100644 --- a/CRM/Cxn/BAO/Cxn.php +++ b/CRM/Cxn/BAO/Cxn.php @@ -40,6 +40,12 @@ use Civi\Cxn\Rpc\Constants; * This class helps to manage connections to third-party apps. */ class CRM_Cxn_BAO_Cxn extends CRM_Cxn_DAO_Cxn { + + /** + * Determine the current site's callback URL. + * + * @return string + */ public static function getSiteCallbackUrl() { $config = CRM_Core_Config::singleton(); if (preg_match('/^(http|https):/', $config->resourceBase)) { @@ -51,6 +57,12 @@ class CRM_Cxn_BAO_Cxn extends CRM_Cxn_DAO_Cxn { return rtrim($civiUrl, '/') . '/extern/cxn.php'; } + /** + * Update the AppMeta for any existing connections. + * + * @param array $appMeta + * @throws \Civi\Cxn\Rpc\Exception\CxnException + */ public static function updateAppMeta($appMeta) { \Civi\Cxn\Rpc\AppMeta::validate($appMeta); CRM_Core_DAO::executeQuery('UPDATE civicrm_cxn SET app_meta = %1 WHERE app_id = %2', array( @@ -59,6 +71,13 @@ class CRM_Cxn_BAO_Cxn extends CRM_Cxn_DAO_Cxn { )); } + /** + * Get the AppMeta for an existing connection. + * + * @param string $cxnId + * @return array + * @throws \Civi\Cxn\Rpc\Exception\CxnException + */ public static function getAppMeta($cxnId) { $appMetaJson = CRM_Core_DAO::getFieldValue('CRM_Cxn_DAO_Cxn', $cxnId, 'app_meta', 'cxn_id', TRUE); $appMeta = json_decode($appMetaJson, TRUE); @@ -126,6 +145,12 @@ class CRM_Cxn_BAO_Cxn extends CRM_Cxn_DAO_Cxn { } } + /** + * Construct a client for performing registration actions. + * + * @return \Civi\Cxn\Rpc\RegistrationClient + * @throws CRM_Core_Exception + */ public static function createRegistrationClient() { $cxnStore = new \CRM_Cxn_CiviCxnStore(); $client = new \Civi\Cxn\Rpc\RegistrationClient(self::getCACert(), $cxnStore, \CRM_Cxn_BAO_Cxn::getSiteCallbackUrl()); -- 2.25.1