X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FCxn.php;h=66ed809b8be503f15781f55fa2eda4f146695d59;hb=594eddc519b33992b5f046fa91627c87966e2527;hp=b88b0bd0abe4d27f5d96113d05d6dc07559469fc;hpb=c9baa85a27f776bc2b49bc5d38611f537cf19f30;p=civicrm-core.git diff --git a/api/v3/Cxn.php b/api/v3/Cxn.php index b88b0bd0ab..66ed809b8b 100644 --- a/api/v3/Cxn.php +++ b/api/v3/Cxn.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2017 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -43,14 +43,14 @@ function _civicrm_api3_cxn_register_spec(&$spec) { $daoFields = CRM_Cxn_DAO_Cxn::fields(); $spec['app_guid'] = $daoFields['app_guid']; - $spec['app_meta_url'] = array( + $spec['app_meta_url'] = [ 'name' => 'app_meta_url', 'type' => CRM_Utils_Type::T_STRING, 'title' => ts('Application Metadata URL'), 'description' => 'Application Metadata URL', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - ); + ]; } /** @@ -79,9 +79,9 @@ function civicrm_api3_cxn_register($params) { } } elseif (!empty($params['app_guid'])) { - $appMeta = civicrm_api3('CxnApp', 'getsingle', array( + $appMeta = civicrm_api3('CxnApp', 'getsingle', [ 'appId' => $params['app_guid'], - )); + ]); } if (empty($appMeta) || !is_array($appMeta)) { @@ -112,13 +112,13 @@ function _civicrm_api3_cxn_unregister_spec(&$spec) { $daoFields = CRM_Cxn_DAO_Cxn::fields(); $spec['cxn_guid'] = $daoFields['cxn_guid']; $spec['app_guid'] = $daoFields['app_guid']; - $spec['force'] = array( + $spec['force'] = [ 'name' => 'force', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Force'), 'description' => 'Destroy connection even if the remote application is non-responsive.', 'default' => '0', - ); + ]; } /** @@ -159,9 +159,9 @@ function _civicrm_api3_cxn_parseCxnId($params) { $cxnId = $params['cxn_guid']; } elseif (!empty($params['app_guid'])) { - $cxnId = CRM_Core_DAO::singleValueQuery('SELECT cxn_guid FROM civicrm_cxn WHERE app_guid = %1', array( - 1 => array($params['app_guid'], 'String'), - )); + $cxnId = CRM_Core_DAO::singleValueQuery('SELECT cxn_guid FROM civicrm_cxn WHERE app_guid = %1', [ + 1 => [$params['app_guid'], 'String'], + ]); if (!$cxnId) { throw new API_Exception("The app_guid does not correspond to an active connection."); } @@ -222,15 +222,15 @@ function _civicrm_api3_cxn_getlink_spec(&$spec) { $daoFields = CRM_Cxn_DAO_Cxn::fields(); $spec['app_guid'] = $daoFields['app_guid']; $spec['cxn_guid'] = $daoFields['cxn_guid']; - $spec['page_name'] = array( + $spec['page_name'] = [ 'name' => 'page_name', 'type' => CRM_Utils_Type::T_STRING, 'title' => ts('Page Type'), 'description' => 'The type of page (eg "settings")', 'maxlength' => 63, 'size' => CRM_Utils_Type::HUGE, - 'api.aliases' => array('page'), - ); + 'api.aliases' => ['page'], + ]; } /** @@ -252,9 +252,9 @@ function civicrm_api3_cxn_getlink($params) { /** @var \Civi\Cxn\Rpc\RegistrationClient $client */ $client = \Civi::service('cxn_reg_client'); - return $client->call($appMeta, 'Cxn', 'getlink', array( + return $client->call($appMeta, 'Cxn', 'getlink', [ 'page' => $params['page_name'], - )); + ]); } /** @@ -264,12 +264,12 @@ function civicrm_api3_cxn_getlink($params) { * @throws Exception */ function civicrm_api3_cxn_getcfg($params) { - $result = array( + $result = [ 'CIVICRM_CXN_CA' => defined('CIVICRM_CXN_CA') ? CIVICRM_CXN_CA : NULL, 'CIVICRM_CXN_VIA' => defined('CIVICRM_CXN_VIA') ? CIVICRM_CXN_VIA : NULL, 'CIVICRM_CXN_APPS_URL' => defined('CIVICRM_CXN_APPS_URL') ? CIVICRM_CXN_APPS_URL : NULL, 'siteCallbackUrl' => CRM_Cxn_BAO_Cxn::getSiteCallbackUrl(), - ); + ]; return civicrm_api3_create_success($result); } @@ -317,7 +317,7 @@ function civicrm_api3_cxn_create($params) { return civicrm_api3_create_success($result, $params, 'Cxn', 'create'); } - catch(Exception $ex){ + catch (Exception $ex) { throw $ex; } }