Merge pull request #15821 from seamuslee001/dev_core_183_custom_group
[civicrm-core.git] / api / v3 / CxnApp.php
index d3f6585f43679d5bf707390e2e2e6ce304ec0c7f..f087d53e04043a2a11b36676ad87cbecba4d4a9d 100644 (file)
@@ -1,32 +1,16 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
 
-use \Civi\Cxn\Rpc\Message\AppMetasMessage;
-use \Civi\Cxn\Rpc\Message\GarbledMessage;
+use Civi\Cxn\Rpc\Message\AppMetasMessage;
+use Civi\Cxn\Rpc\Message\GarbledMessage;
 
 /**
  * The CxnApp API provides a pseudo-entity for exploring the list
@@ -48,34 +32,34 @@ use \Civi\Cxn\Rpc\Message\GarbledMessage;
  *   List of fields.
  */
 function _civicrm_api3_cxn_app_get_spec(&$spec) {
-  $spec['appCert'] = array(
+  $spec['appCert'] = [
     'name' => 'appCert',
     'type' => CRM_Utils_Type::T_TEXT,
     'title' => ts('Certificate'),
     'description' => 'PEM-encoded certificate',
-  );
-  $spec['appId'] = array(
+  ];
+  $spec['appId'] = [
     'name' => 'appId',
     'type' => CRM_Utils_Type::T_STRING,
     'title' => ts('Application GUID'),
     'description' => 'Application GUID',
     'maxlength' => 128,
     'size' => CRM_Utils_Type::HUGE,
-  );
-  $spec['appUrl'] = array(
+  ];
+  $spec['appUrl'] = [
     'name' => 'appUrl',
     'type' => CRM_Utils_Type::T_STRING,
     'title' => ts('Registration URL'),
     'description' => 'An endpoint to notify when performing registration',
     'maxlength' => 255,
     'size' => CRM_Utils_Type::HUGE,
-  );
-  $spec['desc'] = array(
+  ];
+  $spec['desc'] = [
     'name' => 'desc',
     'type' => CRM_Utils_Type::T_TEXT,
     'title' => ts('Description'),
     'description' => 'Description',
-  );
+  ];
   //$spec['perm'] = array(
   //  'name' => 'perm',
   //  'type' => CRM_Utils_Type::T_TEXT,
@@ -104,16 +88,16 @@ function civicrm_api3_cxn_app_get($params) {
 
   $agent = new \Civi\Cxn\Rpc\Agent(NULL, NULL);
   $agent->setCertValidator(CRM_Cxn_BAO_Cxn::createCertificateValidator());
-  $message = $agent->decode(array(AppMetasMessage::NAME, GarbledMessage::NAME), $blob);
+  $message = $agent->decode([AppMetasMessage::NAME, GarbledMessage::NAME], $blob);
 
   if ($message instanceof AppMetasMessage) {
     return _civicrm_api3_basic_array_get('CxnApp', $params, $message->getData(), 'appId',
-      array('appId', 'appUrl', 'desc', 'appCert', 'perm'));
+      ['appId', 'appUrl', 'desc', 'appCert', 'perm']);
   }
   elseif ($message instanceof GarbledMessage) {
-    return civicrm_api3_create_error('Received garbled response', array(
+    return civicrm_api3_create_error('Received garbled response', [
       'garbled_message' => $message->getData(),
-    ));
+    ]);
   }
   else {
     return civicrm_api3_create_error("Unrecognized message");