From cf8f0fff2d9b29aeeb6b511208054da760b4d544 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 28 Mar 2019 19:47:17 -0400 Subject: [PATCH] Short array syntax - auto-convert api dir --- api/Exception.php | 16 +- api/api.php | 6 +- api/class.api.php | 20 +- api/v3/ActionSchedule.php | 2 +- api/v3/Activity.php | 144 +-- api/v3/ActivityType.php | 10 +- api/v3/Address.php | 20 +- api/v3/Attachment.php | 80 +- api/v3/Case.php | 138 +-- api/v3/CaseContact.php | 12 +- api/v3/CaseType.php | 6 +- api/v3/Constant.php | 22 +- api/v3/ContactType.php | 2 +- api/v3/Contribution.php | 246 ++--- api/v3/ContributionPage.php | 14 +- api/v3/ContributionRecur.php | 2 +- api/v3/CustomField.php | 32 +- api/v3/CustomGroup.php | 2 +- api/v3/CustomSearch.php | 2 +- api/v3/CustomValue.php | 68 +- api/v3/Cxn.php | 32 +- api/v3/CxnApp.php | 24 +- api/v3/Dashboard.php | 4 +- api/v3/DashboardContact.php | 4 +- api/v3/Domain.php | 22 +- api/v3/Entity.php | 4 +- api/v3/EntityTag.php | 6 +- api/v3/Event.php | 32 +- api/v3/Extension.php | 52 +- api/v3/File.php | 12 +- api/v3/Generic.php | 100 +- api/v3/Generic/Getactions.php | 2 +- api/v3/Generic/Getlist.php | 86 +- api/v3/Generic/Getunique.php | 2 +- api/v3/Generic/Setvalue.php | 22 +- api/v3/Generic/Update.php | 2 +- api/v3/Grant.php | 2 +- api/v3/Group.php | 2 +- api/v3/GroupContact.php | 30 +- api/v3/Job.php | 82 +- api/v3/LocBlock.php | 20 +- api/v3/Logging.php | 32 +- api/v3/Mailing.php | 98 +- api/v3/MailingAB.php | 70 +- api/v3/MailingContact.php | 38 +- api/v3/MailingEventConfirm.php | 12 +- api/v3/MailingEventQueue.php | 2 +- api/v3/MailingEventResubscribe.php | 12 +- api/v3/MailingEventSubscribe.php | 10 +- api/v3/MailingEventUnsubscribe.php | 12 +- api/v3/MailingGroup.php | 4 +- api/v3/Membership.php | 38 +- api/v3/MembershipPayment.php | 4 +- api/v3/MembershipStatus.php | 6 +- api/v3/MembershipType.php | 4 +- api/v3/MessageTemplate.php | 24 +- api/v3/Navigation.php | 6 +- api/v3/Note.php | 2 +- api/v3/OptionGroup.php | 2 +- api/v3/OptionValue.php | 10 +- api/v3/Order.php | 44 +- api/v3/Participant.php | 24 +- api/v3/Payment.php | 84 +- api/v3/PaymentProcessor.php | 16 +- api/v3/Pledge.php | 22 +- api/v3/PledgePayment.php | 8 +- api/v3/Premium.php | 4 +- api/v3/PriceFieldValue.php | 4 +- api/v3/Profile.php | 98 +- api/v3/RecurringEntity.php | 8 +- api/v3/Relationship.php | 4 +- api/v3/RelationshipType.php | 4 +- api/v3/ReportInstance.php | 4 +- api/v3/ReportTemplate.php | 22 +- api/v3/SavedSearch.php | 2 +- api/v3/Setting.php | 116 +- api/v3/Survey.php | 12 +- api/v3/SurveyRespondant.php | 4 +- api/v3/System.php | 114 +- api/v3/Tag.php | 2 +- api/v3/UFField.php | 6 +- api/v3/UFGroup.php | 20 +- api/v3/User.php | 18 +- .../Activity/ContactRefCustomField.php | 20 +- .../Activity/ContactRefCustomFieldGet.php | 20 +- api/v3/examples/Activity/Create.php | 20 +- api/v3/examples/Activity/DateTimeHigh.php | 20 +- api/v3/examples/Activity/DateTimeLow.php | 20 +- api/v3/examples/Activity/Delete.php | 12 +- api/v3/examples/Activity/Get.php | 20 +- api/v3/examples/Activity/GetFields.php | 236 ++--- .../Activity/GetTargetandAssignee.php | 20 +- .../Activity/GetTargetandAssigneeName.php | 30 +- .../Activity/ReturnAssigneeContact.php | 40 +- api/v3/examples/ActivityContact/Create.php | 20 +- api/v3/examples/ActivityContact/Delete.php | 12 +- api/v3/examples/ActivityType/Create.php | 20 +- api/v3/examples/ActivityType/Get.php | 14 +- api/v3/examples/Address/AddressLike.php | 24 +- api/v3/examples/Address/AddressParse.php | 20 +- api/v3/examples/Address/AddressSort.php | 28 +- api/v3/examples/Address/Create.php | 20 +- api/v3/examples/Address/Delete.php | 12 +- api/v3/examples/Address/Get.php | 20 +- api/v3/examples/Address/GetOptions.php | 16 +- api/v3/examples/Batch/Create.php | 20 +- api/v3/examples/Batch/Delete.php | 12 +- api/v3/examples/Batch/Get.php | 20 +- api/v3/examples/Batch/Update.php | 20 +- api/v3/examples/Campaign/Create.php | 20 +- api/v3/examples/Campaign/Delete.php | 12 +- api/v3/examples/Campaign/Get.php | 20 +- api/v3/examples/Case/Create.php | 20 +- api/v3/examples/CaseContact/Get.php | 20 +- api/v3/examples/Constant/Get.php | 16 +- api/v3/examples/Contact/APIChainedArray.php | 62 +- .../Contact/APIChainedArrayFormats.php | 40 +- .../Contact/APIChainedArrayMultipleCustom.php | 62 +- ...IChainedArrayValuesFromSiblingFunction.php | 32 +- api/v3/examples/Contact/ChainTwoWebsites.php | 68 +- .../Contact/ChainTwoWebsitesSyntax2.php | 76 +- .../ContactIDOfLoggedInUserContactAPI.php | 20 +- api/v3/examples/Contact/Create.php | 20 +- .../Contact/CreateParticipantPayment.php | 44 +- api/v3/examples/Contact/CustomFieldGet.php | 20 +- .../CustomFieldGetReturnSyntaxVariation.php | 20 +- api/v3/examples/Contact/Delete.php | 12 +- .../examples/Contact/FormatIsSuccess_Fail.php | 8 +- .../examples/Contact/FormatIsSuccess_True.php | 8 +- api/v3/examples/Contact/FormatOnlyID.php | 8 +- api/v3/examples/Contact/FormatSingleValue.php | 8 +- api/v3/examples/Contact/Get.php | 20 +- api/v3/examples/Contact/GetActions.php | 18 +- api/v3/examples/Contact/GetCountContact.php | 8 +- api/v3/examples/Contact/GetFieldsOptions.php | 480 ++++----- api/v3/examples/Contact/GetOptions.php | 16 +- api/v3/examples/Contact/GetSingleContact.php | 12 +- .../Contact/GroupFilterUsingContactAPI.php | 28 +- .../examples/Contact/NestedReplaceEmail.php | 76 +- .../ContributionCreateWithHonoreeContact.php | 20 +- .../ContributionCreateWithNote.php | 20 +- .../ContributionCreateWithSoftCredit.php | 28 +- ...ntributionCreateWithSoftCreditDefaults.php | 20 +- api/v3/examples/Contribution/Create.php | 20 +- .../CreateWithNestedLineItems.php | 60 +- api/v3/examples/Contribution/Delete.php | 16 +- api/v3/examples/Contribution/Get.php | 20 +- api/v3/examples/ContributionPage/Create.php | 20 +- api/v3/examples/ContributionPage/Delete.php | 12 +- api/v3/examples/ContributionPage/Get.php | 20 +- api/v3/examples/ContributionPage/Submit.php | 20 +- api/v3/examples/ContributionRecur/Create.php | 20 +- api/v3/examples/ContributionRecur/Delete.php | 12 +- api/v3/examples/ContributionRecur/Get.php | 20 +- api/v3/examples/ContributionSoft/Create.php | 20 +- api/v3/examples/ContributionSoft/Delete.php | 8 +- api/v3/examples/ContributionSoft/Get.php | 20 +- api/v3/examples/Country/Create.php | 20 +- api/v3/examples/Country/Delete.php | 12 +- api/v3/examples/Country/Get.php | 20 +- api/v3/examples/CustomField/Create.php | 20 +- api/v3/examples/CustomField/Delete.php | 12 +- api/v3/examples/CustomGroup/Create.php | 24 +- api/v3/examples/CustomGroup/Delete.php | 12 +- api/v3/examples/CustomGroup/Get.php | 18 +- api/v3/examples/CustomValue/Create.php | 12 +- .../examples/CustomValue/FormatFieldName.php | 44 +- api/v3/examples/CustomValue/Get.php | 44 +- api/v3/examples/Domain/Create.php | 20 +- api/v3/examples/Domain/Get.php | 40 +- api/v3/examples/Email/Create.php | 20 +- api/v3/examples/Email/Delete.php | 12 +- api/v3/examples/Email/Replace.php | 60 +- api/v3/examples/EntityBatch/Create.php | 20 +- api/v3/examples/EntityBatch/Delete.php | 12 +- api/v3/examples/EntityBatch/Get.php | 20 +- api/v3/examples/EntityTag/Create.php | 12 +- api/v3/examples/EntityTag/Delete.php | 12 +- api/v3/examples/EntityTag/Get.php | 20 +- .../examples/Event/ContactRefCustomField.php | 20 +- api/v3/examples/Event/Create.php | 20 +- api/v3/examples/Event/Delete.php | 12 +- api/v3/examples/Event/Get.php | 20 +- api/v3/examples/Event/IsCurrentOption.php | 20 +- api/v3/examples/Event/IsFullOption.php | 12 +- api/v3/examples/Grant/Create.php | 20 +- api/v3/examples/Grant/Delete.php | 12 +- api/v3/examples/Grant/Get.php | 20 +- api/v3/examples/Group/Get.php | 24 +- api/v3/examples/Group/GetFields.php | 116 +- api/v3/examples/GroupContact/Create.php | 12 +- api/v3/examples/GroupContact/Delete.php | 12 +- api/v3/examples/GroupContact/Get.php | 20 +- .../examples/GroupContact/GetWithGroupID.php | 36 +- api/v3/examples/GroupNesting/Create.php | 16 +- api/v3/examples/GroupNesting/Delete.php | 12 +- api/v3/examples/GroupNesting/Get.php | 20 +- api/v3/examples/GroupOrganization/Create.php | 16 +- api/v3/examples/GroupOrganization/Delete.php | 12 +- api/v3/examples/GroupOrganization/Get.php | 14 +- api/v3/examples/Im/Create.php | 20 +- api/v3/examples/Im/Delete.php | 12 +- api/v3/examples/Im/Get.php | 20 +- api/v3/examples/Job/Create.php | 20 +- api/v3/examples/Job/Delete.php | 8 +- api/v3/examples/LineItem/Create.php | 20 +- api/v3/examples/LineItem/Delete.php | 12 +- api/v3/examples/LineItem/Get.php | 20 +- api/v3/examples/LocBlock/Create.php | 20 +- api/v3/examples/LocBlock/CreateEntities.php | 52 +- api/v3/examples/LocBlock/Get.php | 36 +- api/v3/examples/Logging/Get.php | 84 +- api/v3/examples/Logging/Revert.php | 12 +- .../MailSettings/ChainedGetDelete.php | 32 +- api/v3/examples/MailSettings/Create.php | 20 +- api/v3/examples/MailSettings/Delete.php | 12 +- api/v3/examples/MailSettings/Get.php | 20 +- api/v3/examples/MailSettings/GetOptions.php | 16 +- api/v3/examples/Mailing/Clone.php | 20 +- api/v3/examples/Mailing/Create.php | 80 +- api/v3/examples/Mailing/Delete.php | 12 +- api/v3/examples/Mailing/GetTokens.php | 20 +- api/v3/examples/Mailing/Submit.php | 20 +- api/v3/examples/MailingAB/Create.php | 20 +- .../examples/MailingEventSubscribe/Create.php | 20 +- api/v3/examples/MailingGroup/Subscribe.php | 20 +- api/v3/examples/Mapping/Create.php | 20 +- api/v3/examples/Mapping/Delete.php | 12 +- api/v3/examples/Mapping/Get.php | 20 +- api/v3/examples/MappingField/Create.php | 20 +- api/v3/examples/MappingField/Delete.php | 12 +- api/v3/examples/MappingField/Get.php | 20 +- api/v3/examples/Membership/Create.php | 20 +- .../Membership/CreateWithCustomData.php | 20 +- api/v3/examples/Membership/Delete.php | 12 +- .../examples/Membership/FilterIsCurrent.php | 24 +- api/v3/examples/Membership/Get.php | 20 +- .../Membership/SearchWithCustomData.php | 20 +- .../examples/Membership/UpdateCustomData.php | 20 +- api/v3/examples/MembershipPayment/Create.php | 20 +- api/v3/examples/MembershipPayment/Get.php | 20 +- api/v3/examples/MembershipStatus/Create.php | 20 +- api/v3/examples/MembershipStatus/Get.php | 20 +- api/v3/examples/MembershipType/Create.php | 20 +- api/v3/examples/MembershipType/Delete.php | 12 +- api/v3/examples/MembershipType/Get.php | 20 +- api/v3/examples/MessageTemplate/Create.php | 20 +- api/v3/examples/MessageTemplate/Delete.php | 12 +- api/v3/examples/MessageTemplate/Get.php | 20 +- api/v3/examples/Note/Create.php | 20 +- api/v3/examples/Note/Delete.php | 12 +- api/v3/examples/Note/Get.php | 14 +- api/v3/examples/OpenID/Create.php | 20 +- api/v3/examples/OpenID/Delete.php | 12 +- api/v3/examples/OpenID/Get.php | 20 +- api/v3/examples/OptionGroup/Create.php | 24 +- api/v3/examples/OptionGroup/Delete.php | 12 +- api/v3/examples/OptionGroup/Get.php | 20 +- api/v3/examples/OptionValue/Get.php | 36 +- api/v3/examples/OptionValue/SortOption.php | 16 +- api/v3/examples/Order/Cancel.php | 20 +- api/v3/examples/Order/Create.php | 40 +- .../examples/Order/CreateOrderParticipant.php | 44 +- api/v3/examples/Order/Delete.php | 16 +- api/v3/examples/Order/Get.php | 28 +- api/v3/examples/Participant/Create.php | 20 +- api/v3/examples/Participant/Get.php | 20 +- api/v3/examples/Participant/NestedDelete.php | 32 +- .../examples/Participant/NestedEventGet.php | 32 +- api/v3/examples/ParticipantPayment/Create.php | 20 +- api/v3/examples/ParticipantPayment/Delete.php | 12 +- api/v3/examples/ParticipantPayment/Get.php | 20 +- .../examples/ParticipantStatusType/Create.php | 20 +- .../examples/ParticipantStatusType/Delete.php | 12 +- api/v3/examples/ParticipantStatusType/Get.php | 20 +- api/v3/examples/Payment/Cancel.php | 20 +- api/v3/examples/Payment/Create.php | 20 +- .../Payment/CreatePaymentWithLineItems.php | 32 +- api/v3/examples/Payment/Delete.php | 12 +- api/v3/examples/Payment/Get.php | 20 +- api/v3/examples/Payment/UpdatePayment.php | 20 +- api/v3/examples/PaymentProcessor/Create.php | 20 +- api/v3/examples/PaymentProcessor/Delete.php | 12 +- .../examples/PaymentProcessorType/Create.php | 20 +- .../examples/PaymentProcessorType/Delete.php | 12 +- api/v3/examples/PaymentToken/Create.php | 20 +- api/v3/examples/PaymentToken/Delete.php | 12 +- api/v3/examples/PaymentToken/Get.php | 20 +- api/v3/examples/Pcp/Create.php | 20 +- api/v3/examples/Phone/Create.php | 20 +- api/v3/examples/Phone/Delete.php | 12 +- api/v3/examples/Phone/Get.php | 20 +- api/v3/examples/Phone/GetOptions.php | 16 +- api/v3/examples/Pledge/Create.php | 20 +- api/v3/examples/Pledge/Delete.php | 16 +- api/v3/examples/Pledge/Get.php | 20 +- api/v3/examples/Pledge/GetFilterHighDate.php | 20 +- api/v3/examples/PledgePayment/Create.php | 20 +- api/v3/examples/PledgePayment/Delete.php | 16 +- api/v3/examples/PledgePayment/Get.php | 34 +- api/v3/examples/PledgePayment/Update.php | 20 +- api/v3/examples/PriceField/Create.php | 20 +- api/v3/examples/PriceField/Delete.php | 12 +- api/v3/examples/PriceField/Get.php | 20 +- api/v3/examples/PriceFieldValue/Create.php | 20 +- api/v3/examples/PriceFieldValue/Delete.php | 12 +- api/v3/examples/PriceFieldValue/Get.php | 20 +- api/v3/examples/PriceSet/Create.php | 20 +- api/v3/examples/PriceSet/Delete.php | 12 +- api/v3/examples/PriceSet/Get.php | 22 +- api/v3/examples/Profile/Apply.php | 40 +- api/v3/examples/Profile/Get.php | 32 +- api/v3/examples/Profile/GetFields.php | 106 +- api/v3/examples/Profile/Submit.php | 20 +- .../Relationship/BetweenRelationshipType.php | 36 +- api/v3/examples/Relationship/Create.php | 20 +- api/v3/examples/Relationship/Delete.php | 12 +- api/v3/examples/Relationship/Get.php | 20 +- .../Relationship/INRelationshipType.php | 32 +- .../NotBetweenRelationshipType.php | 28 +- .../Relationship/NotInRelationshipType.php | 32 +- .../examples/Relationship/filterIsCurrent.php | 24 +- api/v3/examples/RelationshipType/Create.php | 20 +- api/v3/examples/RelationshipType/Delete.php | 12 +- api/v3/examples/ReportTemplate/Getrows.php | 40 +- .../examples/ReportTemplate/Getstatistics.php | 12 +- api/v3/examples/SavedSearch/Create.php | 44 +- api/v3/examples/SavedSearch/Delete.php | 12 +- api/v3/examples/SavedSearch/Get.php | 24 +- api/v3/examples/Setting/Create.php | 20 +- api/v3/examples/Setting/CreateAllDomains.php | 28 +- .../Setting/CreateSettingCurrentDomain.php | 20 +- .../Setting/CreateSpecifiedDomains.php | 28 +- api/v3/examples/Setting/Get.php | 20 +- api/v3/examples/Setting/GetAllDomains.php | 28 +- api/v3/examples/Setting/GetDefaults.php | 20 +- api/v3/examples/Setting/GetFields.php | 996 +++++++++--------- .../Setting/GetSettingCurrentDomain.php | 20 +- .../examples/Setting/GetSpecifiedDomains.php | 32 +- api/v3/examples/Setting/GetValue.php | 8 +- api/v3/examples/Setting/Revert.php | 24 +- api/v3/examples/StateProvince/Create.php | 20 +- api/v3/examples/StateProvince/Delete.php | 12 +- api/v3/examples/StateProvince/Get.php | 20 +- api/v3/examples/StatusPreference/Create.php | 20 +- api/v3/examples/StatusPreference/Delete.php | 12 +- api/v3/examples/StatusPreference/Get.php | 20 +- api/v3/examples/Survey/ChainedGetDelete.php | 24 +- api/v3/examples/Survey/Create.php | 20 +- api/v3/examples/Survey/Delete.php | 12 +- api/v3/examples/Survey/Get.php | 20 +- api/v3/examples/SurveyRespondant/Get.php | 14 +- api/v3/examples/System/Flush.php | 10 +- api/v3/examples/Tag/Create.php | 20 +- api/v3/examples/Tag/Delete.php | 12 +- api/v3/examples/Tag/Get.php | 20 +- api/v3/examples/Tag/GetFields.php | 72 +- api/v3/examples/Tag/GetList.php | 32 +- api/v3/examples/Tag/GetReturnArray.php | 24 +- .../examples/TaxContributionPage/Create.php | 20 +- .../CreateWithNestedLineItems.php | 76 +- .../examples/TaxContributionPage/Delete.php | 16 +- api/v3/examples/UFField/Create.php | 20 +- api/v3/examples/UFField/Delete.php | 12 +- api/v3/examples/UFField/Get.php | 18 +- api/v3/examples/UFField/Replace.php | 44 +- api/v3/examples/UFGroup/Create.php | 20 +- api/v3/examples/UFGroup/Delete.php | 12 +- api/v3/examples/UFGroup/Get.php | 20 +- api/v3/examples/UFJoin/Create.php | 20 +- api/v3/examples/UFJoin/Get.php | 20 +- api/v3/examples/UFMatch/Get.php | 20 +- api/v3/examples/Website/Create.php | 20 +- api/v3/examples/Website/Delete.php | 12 +- api/v3/examples/Website/Get.php | 20 +- api/v3/examples/Website/GetFields.php | 48 +- api/v3/examples/Website/GetWithMetadata.php | 62 +- api/v3/utils.php | 204 ++-- 378 files changed, 5457 insertions(+), 5457 deletions(-) diff --git a/api/Exception.php b/api/Exception.php index 1db0ae564f..6e968b3071 100644 --- a/api/Exception.php +++ b/api/Exception.php @@ -20,7 +20,7 @@ class API_Exception extends Exception { const UNAUTHORIZED = 'unauthorized'; const NOT_IMPLEMENTED = 'not-found'; - private $extraParams = array(); + private $extraParams = []; /** * Class constructor. @@ -37,7 +37,7 @@ class API_Exception extends Exception { * @param Exception|NULL $previous * A previous exception which caused this new exception. */ - public function __construct($message, $error_code = 0, $extraParams = array(), Exception $previous = NULL) { + public function __construct($message, $error_code = 0, $extraParams = [], Exception $previous = NULL) { // Using int for error code "old way") ? if (is_numeric($error_code)) { $code = $error_code; @@ -46,7 +46,7 @@ class API_Exception extends Exception { $code = 0; } parent::__construct(ts($message), $code, $previous); - $this->extraParams = $extraParams + array('error_code' => $error_code); + $this->extraParams = $extraParams + ['error_code' => $error_code]; } /** @@ -73,13 +73,13 @@ class API_Exception extends Exception { * @return array */ public function getErrorCodes() { - return array( + return [ 2000 => '$params was not an array', 2001 => 'Invalid Value for Date field', 2100 => 'String value is longer than permitted length', self::UNAUTHORIZED => 'Unauthorized', self::NOT_IMPLEMENTED => 'Entity or method is not implemented', - ); + ]; } } @@ -89,7 +89,7 @@ class API_Exception extends Exception { * API_Exception from the api wrapper as the namespace is more generic */ class CiviCRM_API3_Exception extends Exception { - private $extraParams = array(); + private $extraParams = []; /** * Class constructor. @@ -106,9 +106,9 @@ class CiviCRM_API3_Exception extends Exception { * @param Exception|NULL $previous * A previous exception which caused this new exception. */ - public function __construct($message, $error_code = 0, $extraParams = array(), Exception $previous = NULL) { + public function __construct($message, $error_code = 0, $extraParams = [], Exception $previous = NULL) { parent::__construct(ts($message)); - $this->extraParams = $extraParams + array('error_code' => $error_code); + $this->extraParams = $extraParams + ['error_code' => $error_code]; } /** diff --git a/api/api.php b/api/api.php index 04b0421bcb..9b1a00941d 100644 --- a/api/api.php +++ b/api/api.php @@ -38,7 +38,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { * @throws CiviCRM_API3_Exception * @return array */ -function civicrm_api3($entity, $action, $params = array()) { +function civicrm_api3($entity, $action, $params = []) { $params['version'] = 3; $result = \Civi::service('civi_api_kernel')->runSafe($entity, $action, $params); if (is_array($result) && !empty($result['is_error'])) { @@ -73,9 +73,9 @@ function _civicrm_api3_api_getfields(&$apiRequest) { // $apiRequest['params']['action'] = $apiRequest['params']['api_action']; // unset($apiRequest['params']['api_action']); } - return array('action' => array('api.aliases' => array('api_action'))); + return ['action' => ['api.aliases' => ['api_action']]]; } - $getFieldsParams = array('action' => $apiRequest['action']); + $getFieldsParams = ['action' => $apiRequest['action']]; $entity = $apiRequest['entity']; if ($entity == 'Profile' && array_key_exists('profile_id', $apiRequest['params'])) { $getFieldsParams['profile_id'] = $apiRequest['params']['profile_id']; diff --git a/api/class.api.php b/api/class.api.php index 88d9b21165..3e93b97a58 100644 --- a/api/class.api.php +++ b/api/class.api.php @@ -85,8 +85,8 @@ class civicrm_api3 { */ public function __construct($config = NULL) { $this->local = TRUE; - $this->input = array(); - $this->lastResult = array(); + $this->input = []; + $this->lastResult = []; if (isset($config) && isset($config['server'])) { // we are calling a remote server via REST $this->local = FALSE; @@ -164,13 +164,13 @@ class civicrm_api3 { * * @return \stdClass */ - private function remoteCall($entity, $action, $params = array()) { + private function remoteCall($entity, $action, $params = []) { $query = $this->uri . "?entity=$entity&action=$action"; - $fields = http_build_query(array( + $fields = http_build_query([ 'key' => $this->key, 'api_key' => $this->api_key, 'json' => json_encode($params), - )); + ]); if (function_exists('curl_init')) { // To facilitate debugging without leaking info, entity & action @@ -187,7 +187,7 @@ class civicrm_api3 { $res->is_error = 1; $res->error_message = curl_error($ch); $res->level = "cURL"; - $res->error = array('cURL error' => curl_error($ch)); + $res->error = ['cURL error' => curl_error($ch)]; return $res; } curl_close($ch); @@ -202,7 +202,7 @@ class civicrm_api3 { $res->is_error = 1; $res->error_message = 'Unable to parse returned JSON'; $res->level = 'json_decode'; - $res->error = array('Unable to parse returned JSON' => $result); + $res->error = ['Unable to parse returned JSON' => $result]; $res->row_result = $result; } return $res; @@ -217,9 +217,9 @@ class civicrm_api3 { * * @return bool */ - private function call($entity, $action = 'Get', $params = array()) { + private function call($entity, $action = 'Get', $params = []) { if (is_int($params)) { - $params = array('id' => $params); + $params = ['id' => $params]; } elseif (is_string($params)) { $params = json_decode($params); @@ -240,7 +240,7 @@ class civicrm_api3 { $this->lastResult = json_decode(json_encode(civicrm_api($entity, $action, $params))); } // Reset the input to be ready for a new call. - $this->input = array(); + $this->input = []; if (property_exists($this->lastResult, 'is_error')) { return !$this->lastResult->is_error; } diff --git a/api/v3/ActionSchedule.php b/api/v3/ActionSchedule.php index 03b11a4290..d7f6e263f6 100644 --- a/api/v3/ActionSchedule.php +++ b/api/v3/ActionSchedule.php @@ -52,7 +52,7 @@ function civicrm_api3_action_schedule_get($params) { * @return array */ function civicrm_api3_action_schedule_create($params) { - civicrm_api3_verify_one_mandatory($params, NULL, array('start_action_date', 'absolute_date')); + civicrm_api3_verify_one_mandatory($params, NULL, ['start_action_date', 'absolute_date']); if (!array_key_exists('name', $params) && !array_key_exists('id', $params)) { $params['name'] = CRM_Utils_String::munge($params['title']); } diff --git a/api/v3/Activity.php b/api/v3/Activity.php index f7a8e492f1..5fa7492538 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -49,11 +49,11 @@ function civicrm_api3_activity_create($params) { // an update does not require any mandatory parameters civicrm_api3_verify_one_mandatory($params, NULL, - array( + [ 'activity_name', 'activity_type_id', 'activity_label', - ) + ] ); } @@ -69,7 +69,7 @@ function civicrm_api3_activity_create($params) { } // processing for custom data - $values = $activityArray = array(); + $values = $activityArray = []; _civicrm_api3_custom_format_params($params, $values, 'Activity'); if (!empty($values['custom'])) { @@ -85,7 +85,7 @@ function civicrm_api3_activity_create($params) { // this handling should all be moved to the BAO layer $case_id = ''; $createRevision = FALSE; - $oldActivityValues = array(); + $oldActivityValues = []; // Lookup case id if not supplied if (!isset($params['case_id']) && !empty($params['id'])) { $params['case_id'] = CRM_Core_DAO::singleValueQuery("SELECT case_id FROM civicrm_case_activity WHERE activity_id = " . (int) $params['id']); @@ -93,7 +93,7 @@ function civicrm_api3_activity_create($params) { if (!empty($params['case_id'])) { $case_id = $params['case_id']; if (!empty($params['id']) && Civi::settings()->get('civicaseActivityRevisions')) { - $oldActivityParams = array('id' => $params['id']); + $oldActivityParams = ['id' => $params['id']]; if (!$oldActivityValues) { CRM_Activity_BAO_Activity::retrieve($oldActivityParams, $oldActivityValues); } @@ -159,7 +159,7 @@ function civicrm_api3_activity_create($params) { if ($case_id && $isNew && !$createRevision) { // If this is a brand new case activity, add to case(s) foreach ((array) $case_id as $singleCaseId) { - $caseActivityParams = array('activity_id' => $activityBAO->id, 'case_id' => $singleCaseId); + $caseActivityParams = ['activity_id' => $activityBAO->id, 'case_id' => $singleCaseId]; CRM_Case_BAO_Case::processCaseActivity($caseActivityParams); } } @@ -180,26 +180,26 @@ function civicrm_api3_activity_create($params) { */ function _civicrm_api3_activity_create_spec(&$params) { - $params['status_id']['api.aliases'] = array('activity_status'); + $params['status_id']['api.aliases'] = ['activity_status']; - $params['assignee_contact_id'] = array( + $params['assignee_contact_id'] = [ 'name' => 'assignee_id', 'title' => 'Activity Assignee', 'description' => 'Contact(s) assigned to this activity.', 'type' => 1, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ); - $params['target_contact_id'] = array( + ]; + $params['target_contact_id'] = [ 'name' => 'target_id', 'title' => 'Activity Target', 'description' => 'Contact(s) participating in this activity.', 'type' => 1, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ); + ]; - $params['source_contact_id'] = array( + $params['source_contact_id'] = [ 'name' => 'source_contact_id', 'title' => 'Activity Source Contact', 'description' => 'Person who created this activity. Defaults to current user.', @@ -208,16 +208,16 @@ function _civicrm_api3_activity_create_spec(&$params) { 'api.default' => 'user_contact_id', 'FKApiName' => 'Contact', 'api.required' => TRUE, - ); + ]; - $params['case_id'] = array( + $params['case_id'] = [ 'name' => 'case_id', 'title' => 'Case ID', 'description' => 'For creating an activity as part of a case.', 'type' => 1, 'FKClassName' => 'CRM_Case_DAO_Case', 'FKApiName' => 'Case', - ); + ]; } @@ -227,62 +227,62 @@ function _civicrm_api3_activity_create_spec(&$params) { * @param array $params */ function _civicrm_api3_activity_get_spec(&$params) { - $params['tag_id'] = array( + $params['tag_id'] = [ 'title' => 'Tags', 'description' => 'Find activities with specified tags.', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Core_DAO_Tag', 'FKApiName' => 'Tag', 'supports_joins' => TRUE, - ); - $params['file_id'] = array( + ]; + $params['file_id'] = [ 'title' => 'Attached Files', 'description' => 'Find activities with attached files.', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Core_DAO_File', 'FKApiName' => 'File', - ); - $params['case_id'] = array( + ]; + $params['case_id'] = [ 'title' => 'Cases', 'description' => 'Find activities within specified cases.', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Case_DAO_Case', 'FKApiName' => 'Case', 'supports_joins' => TRUE, - ); - $params['contact_id'] = array( + ]; + $params['contact_id'] = [ 'title' => 'Activity Contact ID', 'description' => 'Find activities involving this contact (as target, source, OR assignee).', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ); - $params['target_contact_id'] = array( + ]; + $params['target_contact_id'] = [ 'title' => 'Target Contact ID', 'description' => 'Find activities with specified target contact.', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ); - $params['source_contact_id'] = array( + ]; + $params['source_contact_id'] = [ 'title' => 'Source Contact ID', 'description' => 'Find activities with specified source contact.', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ); - $params['assignee_contact_id'] = array( + ]; + $params['assignee_contact_id'] = [ 'title' => 'Assignee Contact ID', 'description' => 'Find activities with specified assignee contact.', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ); - $params['is_overdue'] = array( + ]; + $params['is_overdue'] = [ 'title' => 'Is Activity Overdue', 'description' => 'Incomplete activities with a past date.', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } /** @@ -347,21 +347,21 @@ function civicrm_api3_activity_get($params) { */ function _civicrm_api3_activity_get_extraFilters(&$params, &$sql) { // Filter by activity contacts - $activityContactOptions = array( + $activityContactOptions = [ 'contact_id' => NULL, 'target_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Targets'), 'source_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source'), 'assignee_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Assignees'), - ); + ]; foreach ($activityContactOptions as $activityContactName => $activityContactValue) { if (!empty($params[$activityContactName])) { if (!is_array($params[$activityContactName])) { - $params[$activityContactName] = array('=' => $params[$activityContactName]); + $params[$activityContactName] = ['=' => $params[$activityContactName]]; } $clause = \CRM_Core_DAO::createSQLFilter('contact_id', $params[$activityContactName]); $typeClause = $activityContactValue ? 'record_type_id = #typeId AND ' : ''; $sql->where("a.id IN (SELECT activity_id FROM civicrm_activity_contact WHERE $typeClause !clause)", - array('#typeId' => $activityContactValue, '!clause' => $clause) + ['#typeId' => $activityContactValue, '!clause' => $clause] ); } } @@ -383,41 +383,41 @@ function _civicrm_api3_activity_get_extraFilters(&$params, &$sql) { // Subqueries are nice in (a) avoiding duplicates and (b) when the result // list is expected to be bite-sized. Joins are nice (a) with larger // datasets and (b) checking for non-existent relations. - $rels = array( - 'tag_id' => array( + $rels = [ + 'tag_id' => [ 'subquery' => 'a.id IN (SELECT entity_id FROM civicrm_entity_tag WHERE entity_table = "civicrm_activity" AND !clause)', 'join' => '!joinType civicrm_entity_tag !alias ON (!alias.entity_table = "civicrm_activity" AND !alias.entity_id = a.id)', 'column' => 'tag_id', - ), - 'file_id' => array( + ], + 'file_id' => [ 'subquery' => 'a.id IN (SELECT entity_id FROM civicrm_entity_file WHERE entity_table = "civicrm_activity" AND !clause)', 'join' => '!joinType civicrm_entity_file !alias ON (!alias.entity_table = "civicrm_activity" AND !alias.entity_id = a.id)', 'column' => 'file_id', - ), - 'case_id' => array( + ], + 'case_id' => [ 'subquery' => 'a.id IN (SELECT activity_id FROM civicrm_case_activity WHERE !clause)', 'join' => '!joinType civicrm_case_activity !alias ON (!alias.activity_id = a.id)', 'column' => 'case_id', - ), - ); + ], + ]; foreach ($rels as $filter => $relSpec) { if (!empty($params[$filter])) { if (!is_array($params[$filter])) { - $params[$filter] = array('=' => $params[$filter]); + $params[$filter] = ['=' => $params[$filter]]; } // $mode is one of ('LEFT JOIN', 'INNER JOIN', 'SUBQUERY') $mode = isset($params[$filter]['IS NULL']) ? 'LEFT JOIN' : 'SUBQUERY'; if ($mode === 'SUBQUERY') { $clause = \CRM_Core_DAO::createSQLFilter($relSpec['column'], $params[$filter]); if ($clause) { - $sql->where($relSpec['subquery'], array('!clause' => $clause)); + $sql->where($relSpec['subquery'], ['!clause' => $clause]); } } else { $alias = 'actjoin_' . $filter; $clause = \CRM_Core_DAO::createSQLFilter($alias . "." . $relSpec['column'], $params[$filter]); if ($clause) { - $sql->join($alias, $relSpec['join'], array('!alias' => $alias, 'joinType' => $mode)); + $sql->join($alias, $relSpec['join'], ['!alias' => $alias, 'joinType' => $mode]); $sql->where($clause); } } @@ -455,8 +455,8 @@ function _civicrm_api3_activity_get_formatResult($params, $activities, $options) _civicrm_api3_activity_fill_activity_contact_names($activities, $params, $returns); - $tagGet = array('tag_id', 'entity_id'); - $caseGet = $caseIds = array(); + $tagGet = ['tag_id', 'entity_id']; + $caseGet = $caseIds = []; foreach (array_keys($returns) as $key) { if (strpos($key, 'tag_id.') === 0) { $tagGet[] = $key; @@ -482,12 +482,12 @@ function _civicrm_api3_activity_get_formatResult($params, $activities, $options) break; case 'tag_id': - $tags = civicrm_api3('EntityTag', 'get', array( + $tags = civicrm_api3('EntityTag', 'get', [ 'entity_table' => 'civicrm_activity', - 'entity_id' => array('IN' => array_keys($activities)), + 'entity_id' => ['IN' => array_keys($activities)], 'return' => $tagGet, - 'options' => array('limit' => 0), - )); + 'options' => ['limit' => 0], + ]); foreach ($tags['values'] as $tag) { $key = (int) $tag['entity_id']; unset($tag['entity_id'], $tag['id']); @@ -497,7 +497,7 @@ function _civicrm_api3_activity_get_formatResult($params, $activities, $options) case 'file_id': $dao = CRM_Core_DAO::executeQuery("SELECT entity_id, file_id FROM civicrm_entity_file WHERE entity_table = 'civicrm_activity' AND entity_id IN (%1)", - array(1 => array(implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES))); + [1 => [implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES]]); while ($dao->fetch()) { $activities[$dao->entity_id]['file_id'][] = $dao->file_id; } @@ -505,7 +505,7 @@ function _civicrm_api3_activity_get_formatResult($params, $activities, $options) case 'case_id': $dao = CRM_Core_DAO::executeQuery("SELECT activity_id, case_id FROM civicrm_case_activity WHERE activity_id IN (%1)", - array(1 => array(implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES))); + [1 => [implode(',', array_keys($activities)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES]]); while ($dao->fetch()) { $activities[$dao->activity_id]['case_id'][] = $dao->case_id; $caseIds[$dao->case_id] = $dao->case_id; @@ -528,12 +528,12 @@ function _civicrm_api3_activity_get_formatResult($params, $activities, $options) // Fetch case fields via the join syntax // Note this is limited to the first case if the activity belongs to more than one if ($caseGet && $caseIds) { - $cases = civicrm_api3('Case', 'get', array( - 'id' => array('IN' => $caseIds), - 'options' => array('limit' => 0), + $cases = civicrm_api3('Case', 'get', [ + 'id' => ['IN' => $caseIds], + 'options' => ['limit' => 0], 'check_permissions' => !empty($params['check_permissions']), 'return' => $caseGet, - )); + ]); foreach ($activities as &$activity) { if (!empty($activity['case_id'])) { $case = CRM_Utils_Array::value($activity['case_id'][0], $cases['values']); @@ -665,11 +665,11 @@ function civicrm_api3_activity_delete($params) { * array with errors */ function _civicrm_api3_activity_check_params(&$params) { - $activityIds = array( + $activityIds = [ 'activity' => CRM_Utils_Array::value('id', $params), 'parent' => CRM_Utils_Array::value('parent_id', $params), 'original' => CRM_Utils_Array::value('original_id', $params), - ); + ]; foreach ($activityIds as $id => $value) { if ($value && @@ -735,18 +735,18 @@ function _civicrm_api3_activity_check_params(&$params) { * API request. */ function _civicrm_api3_activity_getlist_params(&$request) { - $fieldsToReturn = array( + $fieldsToReturn = [ 'activity_date_time', 'activity_type_id', 'subject', 'source_contact_id', - ); + ]; $request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra'])); $request['params']['options']['sort'] = 'activity_date_time DESC'; - $request['params'] += array( + $request['params'] += [ 'is_current_revision' => 1, 'is_deleted' => 0, - ); + ]; } /** @@ -760,29 +760,29 @@ function _civicrm_api3_activity_getlist_params(&$request) { * @return array */ function _civicrm_api3_activity_getlist_output($result, $request) { - $output = array(); + $output = []; if (!empty($result['values'])) { foreach ($result['values'] as $row) { - $data = array( + $data = [ 'id' => $row[$request['id_field']], 'label' => $row[$request['label_field']] ? $row[$request['label_field']] : ts('(no subject)'), - 'description' => array( + 'description' => [ CRM_Core_Pseudoconstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $row['activity_type_id']), - ), - ); + ], + ]; if (!empty($row['activity_date_time'])) { $data['description'][0] .= ': ' . CRM_Utils_Date::customFormat($row['activity_date_time']); } if (!empty($row['source_contact_id'])) { - $data['description'][] = ts('By %1', array( + $data['description'][] = ts('By %1', [ 1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['source_contact_id'], 'display_name'), - )); + ]); } // Add repeating info $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($row['id'], 'civicrm_activity'); $data['extra']['is_recur'] = FALSE; if ($repeat) { - $data['suffix'] = ts('(%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1])); + $data['suffix'] = ts('(%1 of %2)', [1 => $repeat[0], 2 => $repeat[1]]); $data['extra']['is_recur'] = TRUE; } $output[] = $data; diff --git a/api/v3/ActivityType.php b/api/v3/ActivityType.php index 48e6c5ed7c..fcbfa30a5a 100644 --- a/api/v3/ActivityType.php +++ b/api/v3/ActivityType.php @@ -78,7 +78,7 @@ function civicrm_api3_activity_type_create($params) { } $activityObject = CRM_Core_OptionValue::addOptionValue($params, 'activity_type', $action, $optionValueID); - $activityType = array(); + $activityType = []; _civicrm_api3_object_to_array($activityObject, $activityType[$activityObject->id]); return civicrm_api3_create_success($activityType, $params, 'activity_type', 'create'); } @@ -92,16 +92,16 @@ function civicrm_api3_activity_type_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_activity_type_create_spec(&$params) { - $params['label'] = array( + $params['label'] = [ 'api.required' => 1, 'title' => 'Label', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['weight'] = array( + ]; + $params['weight'] = [ 'api.required' => 1, 'title' => 'Weight', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; } /** diff --git a/api/v3/Address.php b/api/v3/Address.php index ac1cb25e07..c480aee939 100644 --- a/api/v3/Address.php +++ b/api/v3/Address.php @@ -103,28 +103,28 @@ function civicrm_api3_address_create(&$params) { function _civicrm_api3_address_create_spec(&$params) { $params['location_type_id']['api.required'] = 1; $params['contact_id']['api.required'] = 1; - $params['street_parsing'] = array( + $params['street_parsing'] = [ 'title' => 'Street Address Parsing', 'description' => 'Optional param to indicate you want the street_address field parsed into individual params', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['skip_geocode'] = array( + ]; + $params['skip_geocode'] = [ 'title' => 'Skip geocode', 'description' => 'Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses at once, the job \'Geocode and Parse Addresses\' can execute this task after the import)', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['fix_address'] = array( + ]; + $params['fix_address'] = [ 'title' => ts('Fix address'), 'description' => ts('When true, apply various fixes to the address before insert. Default true.'), 'type' => CRM_Utils_Type::T_BOOLEAN, 'api.default' => TRUE, - ); - $params['world_region'] = array( + ]; + $params['world_region'] = [ 'title' => ts('World Region'), 'name' => 'world_region', 'type' => CRM_Utils_Type::T_TEXT, - ); + ]; } /** @@ -134,11 +134,11 @@ function _civicrm_api3_address_create_spec(&$params) { * Array of parameters determined by getfields. */ function _civicrm_api3_address_get_spec(&$params) { - $params['world_region'] = array( + $params['world_region'] = [ 'title' => ts('World Region'), 'name' => 'world_region', 'type' => CRM_Utils_Type::T_TEXT, - ); + ]; } /** diff --git a/api/v3/Attachment.php b/api/v3/Attachment.php index a96a35886d..ea4c42e4da 100644 --- a/api/v3/Attachment.php +++ b/api/v3/Attachment.php @@ -107,7 +107,7 @@ function _civicrm_api3_attachment_create_spec(&$spec) { function civicrm_api3_attachment_create($params) { if (empty($params['id'])) { // When creating we need either entity_table or field_name. - civicrm_api3_verify_one_mandatory($params, NULL, array('entity_table', 'field_name')); + civicrm_api3_verify_one_mandatory($params, NULL, ['entity_table', 'field_name']); } $config = CRM_Core_Config::singleton(); @@ -139,7 +139,7 @@ function civicrm_api3_attachment_create($params) { throw new API_Exception("'content' and 'options.move-file' are mutually exclusive"); } if ($id && !$isTrusted && isset($file['upload_date']) && $file['upload_date'] != CRM_Utils_Date::isoToMysql($fileDao->upload_date)) { - throw new API_Exception("Cannot modify upload_date" . var_export(array($file['upload_date'], $fileDao->upload_date, CRM_Utils_Date::isoToMysql($fileDao->upload_date)), TRUE)); + throw new API_Exception("Cannot modify upload_date" . var_export([$file['upload_date'], $fileDao->upload_date, CRM_Utils_Date::isoToMysql($fileDao->upload_date)], TRUE)); } if ($id && $name && $name != CRM_Utils_File::cleanFileName($fileDao->uri)) { throw new API_Exception("Cannot modify name"); @@ -168,15 +168,15 @@ function civicrm_api3_attachment_create($params) { // Save custom field to entity if (!$id && empty($params['entity_table']) && isset($params['field_name'])) { - civicrm_api3('custom_value', 'create', array( + civicrm_api3('custom_value', 'create', [ 'entity_id' => $params['entity_id'], $params['field_name'] => $fileDao->id, - )); + ]); } - $result = array( + $result = [ $fileDao->id => _civicrm_api3_attachment_format_result($fileDao, $entityFileDao, $returnContent, $isTrusted), - ); + ]; return civicrm_api3_create_success($result, $params, 'Attachment', 'create'); } @@ -203,7 +203,7 @@ function civicrm_api3_attachment_get($params) { list($id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent) = _civicrm_api3_attachment_parse_params($params); $dao = __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTrusted); - $result = array(); + $result = []; while ($dao->fetch()) { $result[$dao->id] = _civicrm_api3_attachment_format_result($dao, $dao, $returnContent, $isTrusted); } @@ -247,8 +247,8 @@ function civicrm_api3_attachment_delete($params) { list($id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent) = _civicrm_api3_attachment_parse_params($params); $dao = __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTrusted); - $filePaths = array(); - $fileIds = array(); + $filePaths = []; + $fileIds = []; while ($dao->fetch()) { $filePaths[] = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $dao->uri; $fileIds[] = $dao->id; @@ -267,7 +267,7 @@ function civicrm_api3_attachment_delete($params) { } } - $result = array(); + $result = []; return civicrm_api3_create_success($result, $params, 'Attachment', 'create'); } @@ -286,7 +286,7 @@ function civicrm_api3_attachment_delete($params) { * @throws API_Exception */ function __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTrusted) { - foreach (array('name', 'content', 'path', 'url') as $unsupportedFilter) { + foreach (['name', 'content', 'path', 'url'] as $unsupportedFilter) { if (!empty($params[$unsupportedFilter])) { throw new API_Exception("Get by $unsupportedFilter is not currently supported"); } @@ -294,7 +294,7 @@ function __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTru $select = CRM_Utils_SQL_Select::from('civicrm_file cf') ->join('cef', 'INNER JOIN civicrm_entity_file cef ON cf.id = cef.file_id') - ->select(array( + ->select([ 'cf.id', 'cf.uri', 'cf.mime_type', @@ -303,24 +303,24 @@ function __civicrm_api3_attachment_find($params, $id, $file, $entityFile, $isTru 'cf.created_id', 'cef.entity_table', 'cef.entity_id', - )); + ]); if ($id) { - $select->where('cf.id = #id', array('#id' => $id)); + $select->where('cf.id = #id', ['#id' => $id]); } // Recall: $file is filtered by parse_params. foreach ($file as $key => $value) { - $select->where('cf.!field = @value', array( + $select->where('cf.!field = @value', [ '!field' => $key, '@value' => $value, - )); + ]); } // Recall: $entityFile is filtered by parse_params. foreach ($entityFile as $key => $value) { - $select->where('cef.!field = @value', array( + $select->where('cef.!field = @value', [ '!field' => $key, '@value' => $value, - )); + ]); } if (!$isTrusted) { // FIXME ACLs: Add any JOIN or WHERE clauses needed to enforce access-controls for the target entity. @@ -357,15 +357,15 @@ function _civicrm_api3_attachment_parse_params($params) { throw new API_Exception("Malformed id"); } - $file = array(); - foreach (array('mime_type', 'description', 'upload_date') as $field) { + $file = []; + foreach (['mime_type', 'description', 'upload_date'] as $field) { if (array_key_exists($field, $params)) { $file[$field] = $params[$field]; } } - $entityFile = array(); - foreach (array('entity_table', 'entity_id') as $field) { + $entityFile = []; + foreach (['entity_table', 'entity_id'] as $field) { if (array_key_exists($field, $params)) { $entityFile[$field] = $params[$field]; } @@ -399,11 +399,11 @@ function _civicrm_api3_attachment_parse_params($params) { $isTrusted = empty($params['check_permissions']); - $returns = isset($params['return']) ? $params['return'] : array(); - $returns = is_array($returns) ? $returns : array($returns); + $returns = isset($params['return']) ? $params['return'] : []; + $returns = is_array($returns) ? $returns : [$returns]; $returnContent = in_array('content', $returns); - return array($id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent); + return [$id, $file, $entityFile, $name, $content, $moveFile, $isTrusted, $returnContent]; } /** @@ -424,7 +424,7 @@ function _civicrm_api3_attachment_format_result($fileDao, $entityFileDao, $retur $config = CRM_Core_Config::singleton(); $path = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $fileDao->uri; - $result = array( + $result = [ 'id' => $fileDao->id, 'name' => CRM_Utils_File::cleanFileName($fileDao->uri), 'mime_type' => $fileDao->mime_type, @@ -434,7 +434,7 @@ function _civicrm_api3_attachment_format_result($fileDao, $entityFileDao, $retur 'entity_id' => $entityFileDao->entity_id, 'icon' => CRM_Utils_File::getIconFromMimeType($fileDao->mime_type), 'created_id' => $fileDao->created_id, - ); + ]; $fileHash = CRM_Core_BAO_File::generateFileHash($result['entity_id'], $result['id']); $result['url'] = CRM_Utils_System::url( 'civicrm/file', 'reset=1&id=' . $result['id'] . '&eid=' . $result['entity_id'] . '&fcs=' . $fileHash, @@ -462,18 +462,18 @@ function _civicrm_api3_attachment_getfields() { $fileFields = CRM_Core_DAO_File::fields(); $entityFileFields = CRM_Core_DAO_EntityFile::fields(); - $spec = array(); + $spec = []; $spec['id'] = $fileFields['id']; - $spec['name'] = array( + $spec['name'] = [ 'title' => 'Name (write-once)', 'description' => 'The logical file name (not searchable)', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['field_name'] = array( + ]; + $spec['field_name'] = [ 'title' => 'Field Name (write-once)', 'description' => 'Alternative to "entity_table" param - sets custom field value.', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; $spec['mime_type'] = $fileFields['mime_type']; $spec['description'] = $fileFields['description']; $spec['upload_date'] = $fileFields['upload_date']; @@ -482,26 +482,26 @@ function _civicrm_api3_attachment_getfields() { $spec['entity_table']['title'] = CRM_Utils_Array::value('title', $spec['entity_table'], 'Entity Table') . ' (write-once)'; $spec['entity_id'] = $entityFileFields['entity_id']; $spec['entity_id']['title'] = CRM_Utils_Array::value('title', $spec['entity_id'], 'Entity ID') . ' (write-once)'; // would be hard to securely handle changes - $spec['url'] = array( + $spec['url'] = [ 'title' => 'URL (read-only)', 'description' => 'URL for downloading the file (not searchable, expire-able)', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['path'] = array( + ]; + $spec['path'] = [ 'title' => 'Path (read-only)', 'description' => 'Local file path (not searchable, local-only)', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['content'] = array( + ]; + $spec['content'] = [ 'title' => 'Content', 'description' => 'File content (not searchable, not returned by default)', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['created_id'] = array( + ]; + $spec['created_id'] = [ 'title' => 'Created By Contact ID', 'type' => CRM_Utils_Type::T_INT, 'description' => 'FK to civicrm_contact, who uploaded this file', - ); + ]; return $spec; } diff --git a/api/v3/Case.php b/api/v3/Case.php index bbfeeb2b0c..312c8ba642 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -66,11 +66,11 @@ function civicrm_api3_case_create($params) { if (empty($params['id'])) { // Creating a new case, so make sure we have the necessary parameters - civicrm_api3_verify_mandatory($params, NULL, array( + civicrm_api3_verify_mandatory($params, NULL, [ 'contact_id', 'subject', - array('case_type', 'case_type_id'), - ) + ['case_type', 'case_type_id'], + ] ); } else { @@ -82,7 +82,7 @@ function civicrm_api3_case_create($params) { throw new API_Exception('You cannot update creator id'); } - $mergedCaseIds = $origContactIds = array(); + $mergedCaseIds = $origContactIds = []; // If a contact ID is specified we need to make sure this is the main contact ID for the case (and update if necessary) if (!empty($params['contact_id'])) { @@ -127,7 +127,7 @@ function civicrm_api3_case_create($params) { if (isset($params['contact_id']) && !isset($params['id'])) { foreach ((array) $params['contact_id'] as $cid) { - $contactParams = array('case_id' => $caseBAO->id, 'contact_id' => $cid); + $contactParams = ['case_id' => $caseBAO->id, 'contact_id' => $cid]; CRM_Case_BAO_CaseContact::create($contactParams); } } @@ -139,7 +139,7 @@ function civicrm_api3_case_create($params) { } // return case - $values = array(); + $values = []; _civicrm_api3_object_to_array($caseBAO, $values[$caseBAO->id]); return civicrm_api3_create_success($values, $params, 'Case', 'create', $caseBAO); @@ -162,7 +162,7 @@ function _civicrm_api3_case_create_xmlProcessor($params, $caseBAO) { // Initialize XML processor with $params $xmlProcessor = new CRM_Case_XMLProcessor_Process(); - $xmlProcessorParams = array( + $xmlProcessorParams = [ 'clientID' => CRM_Utils_Array::value('contact_id', $params), 'creatorID' => CRM_Utils_Array::value('creator_id', $params), 'standardTimeline' => 1, @@ -174,9 +174,9 @@ function _civicrm_api3_case_create_xmlProcessor($params, $caseBAO) { 'duration' => CRM_Utils_Array::value('duration', $params), 'medium_id' => CRM_Utils_Array::value('medium_id', $params), 'details' => CRM_Utils_Array::value('details', $params), - 'custom' => array(), + 'custom' => [], 'relationship_end_date' => CRM_Utils_Array::value('end_date', $params), - ); + ]; // Do it! :-D $xmlProcessor->run($params['case_type'], $xmlProcessorParams); @@ -189,25 +189,25 @@ function _civicrm_api3_case_create_xmlProcessor($params, $caseBAO) { * Parameters determined by getfields. */ function _civicrm_api3_case_get_spec(&$params) { - $params['contact_id'] = array( - 'api.aliases' => array('client_id'), + $params['contact_id'] = [ + 'api.aliases' => ['client_id'], 'title' => 'Case Client', 'description' => 'Contact id of one or more clients to retrieve cases for', 'type' => CRM_Utils_Type::T_INT, - ); - $params['activity_id'] = array( + ]; + $params['activity_id'] = [ 'title' => 'Case Activity', 'description' => 'Id of an activity in the case', 'type' => CRM_Utils_Type::T_INT, - ); - $params['tag_id'] = array( + ]; + $params['tag_id'] = [ 'title' => 'Tags', 'description' => 'Find cases with specified tags.', 'type' => 1, 'FKClassName' => 'CRM_Core_DAO_Tag', 'FKApiName' => 'Tag', 'supports_joins' => TRUE, - ); + ]; } /** @@ -217,25 +217,25 @@ function _civicrm_api3_case_get_spec(&$params) { * Array of parameters determined by getfields. */ function _civicrm_api3_case_create_spec(&$params) { - $params['contact_id'] = array( - 'api.aliases' => array('client_id'), + $params['contact_id'] = [ + 'api.aliases' => ['client_id'], 'title' => 'Case Client', 'description' => 'Contact id of case client(s)', 'api.required' => 1, 'type' => CRM_Utils_Type::T_INT, 'FKApiName' => 'Contact', - ); + ]; $params['status_id']['api.default'] = 1; - $params['status_id']['api.aliases'] = array('case_status'); + $params['status_id']['api.aliases'] = ['case_status']; $params['creator_id']['api.default'] = 'user_contact_id'; $params['creator_id']['type'] = CRM_Utils_Type::T_INT; $params['creator_id']['title'] = 'Case Created By'; $params['start_date']['api.default'] = 'now'; - $params['medium_id'] = array( + $params['medium_id'] = [ 'name' => 'medium_id', 'title' => 'Activity Medium', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } /** @@ -289,11 +289,11 @@ function civicrm_api3_case_get($params, $sql = NULL) { if (is_array($params['contact_id'])) { $operator = CRM_Utils_Array::first(array_keys($params['contact_id'])); if (!in_array($operator, \CRM_Core_DAO::acceptedSQLOperators(), TRUE)) { - $params['contact_id'] = array('IN' => $params['contact_id']); + $params['contact_id'] = ['IN' => $params['contact_id']]; } } else { - $params['contact_id'] = array('=' => $params['contact_id']); + $params['contact_id'] = ['=' => $params['contact_id']]; } $clause = CRM_Core_DAO::createSQLFilter('contact_id', $params['contact_id']); $sql->where("a.id IN (SELECT case_id FROM civicrm_case_contact WHERE $clause)"); @@ -345,27 +345,27 @@ function civicrm_api3_case_get($params, $sql = NULL) { // Clause to search by tag if (!empty($params['tag_id'])) { - $dummySpec = array(); + $dummySpec = []; _civicrm_api3_validate_integer($params, 'tag_id', $dummySpec, 'Case'); if (!is_array($params['tag_id'])) { - $params['tag_id'] = array('=' => $params['tag_id']); + $params['tag_id'] = ['=' => $params['tag_id']]; } $clause = \CRM_Core_DAO::createSQLFilter('tag_id', $params['tag_id']); if ($clause) { - $sql->where('a.id IN (SELECT entity_id FROM civicrm_entity_tag WHERE entity_table = "civicrm_case" AND !clause)', array('!clause' => $clause)); + $sql->where('a.id IN (SELECT entity_id FROM civicrm_entity_tag WHERE entity_table = "civicrm_case" AND !clause)', ['!clause' => $clause]); } } - $cases = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), array('sequential' => 0) + $params, TRUE, 'Case', $sql); + $cases = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), ['sequential' => 0] + $params, TRUE, 'Case', $sql); if (empty($options['is_count']) && !empty($cases['values'])) { // For historic reasons we return these by default only when fetching a case by id if (!empty($params['id']) && is_numeric($params['id']) && empty($options['return'])) { - $options['return'] = array( + $options['return'] = [ 'contacts' => 1, 'activities' => 1, 'contact_id' => 1, - ); + ]; } _civicrm_api3_case_read($cases['values'], $options); @@ -391,9 +391,9 @@ function civicrm_api3_case_get($params, $sql = NULL) { */ function civicrm_api3_case_activity_create($params) { require_once "api/v3/Activity.php"; - return civicrm_api3_activity_create($params) + array( + return civicrm_api3_activity_create($params) + [ 'deprecated' => CRM_Utils_Array::value('activity_create', _civicrm_api3_case_deprecation()), - ); + ]; } /** @@ -407,7 +407,7 @@ function civicrm_api3_case_activity_create($params) { function civicrm_api3_case_addtimeline($params) { $caseType = CRM_Case_BAO_Case::getCaseType($params['case_id'], 'name'); $xmlProcessor = new CRM_Case_XMLProcessor_Process(); - $xmlProcessorParams = array( + $xmlProcessorParams = [ 'clientID' => CRM_Case_BAO_Case::getCaseClients($params['case_id']), 'creatorID' => $params['creator_id'], 'standardTimeline' => 0, @@ -415,7 +415,7 @@ function civicrm_api3_case_addtimeline($params) { 'caseID' => $params['case_id'], 'caseType' => $caseType, 'activitySetName' => $params['timeline'], - ); + ]; $xmlProcessor->run($caseType, $xmlProcessorParams); return civicrm_api3_create_success(); } @@ -427,30 +427,30 @@ function civicrm_api3_case_addtimeline($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_case_addtimeline_spec(&$params) { - $params['case_id'] = array( + $params['case_id'] = [ 'title' => 'Case ID', 'description' => 'Id of case to update', 'type' => CRM_Utils_Type::T_INT, 'api.required' => 1, - ); - $params['timeline'] = array( + ]; + $params['timeline'] = [ 'title' => 'Timeline', 'description' => 'Name of activity set', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => 1, - ); - $params['activity_date_time'] = array( + ]; + $params['activity_date_time'] = [ 'api.default' => 'now', 'title' => 'Activity date time', 'description' => 'Timeline start date', 'type' => CRM_Utils_Type::T_DATE, - ); - $params['creator_id'] = array( + ]; + $params['creator_id'] = [ 'api.default' => 'user_contact_id', 'title' => 'Activity creator', 'description' => 'Contact id of timeline creator', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } /** @@ -475,18 +475,18 @@ function civicrm_api3_case_merge($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_case_merge_spec(&$params) { - $params['case_id_1'] = array( + $params['case_id_1'] = [ 'title' => 'Case ID 1', 'description' => 'Id of main case', 'type' => CRM_Utils_Type::T_INT, 'api.required' => 1, - ); - $params['case_id_2'] = array( + ]; + $params['case_id_2'] = [ 'title' => 'Case ID 2', 'description' => 'Id of second case', 'type' => CRM_Utils_Type::T_INT, 'api.required' => 1, - ); + ]; } /** @@ -497,7 +497,7 @@ function _civicrm_api3_case_merge_spec(&$params) { * Array of deprecated actions */ function _civicrm_api3_case_deprecation() { - return array('activity_create' => 'Case api "activity_create" action is deprecated. Use the activity api instead.'); + return ['activity_create' => 'Case api "activity_create" action is deprecated. Use the activity api instead.']; } /** @@ -522,14 +522,14 @@ function civicrm_api3_case_update($params) { } //check parameters - civicrm_api3_verify_mandatory($params, NULL, array('id')); + civicrm_api3_verify_mandatory($params, NULL, ['id']); // return error if modifying creator id if (array_key_exists('creator_id', $params)) { throw new API_Exception(ts('You cannot update creator id')); } - $mCaseId = $origContactIds = array(); + $mCaseId = $origContactIds = []; // get original contact id and creator id of case if (!empty($params['contact_id'])) { @@ -563,10 +563,10 @@ function civicrm_api3_case_update($params) { $dao->copyValues($params); $dao->save(); - $case = array(); + $case = []; _civicrm_api3_object_to_array($dao, $case); - return civicrm_api3_create_success(array($dao->id => $case), $params, 'Case', 'update', $dao); + return civicrm_api3_create_success([$dao->id => $case], $params, 'Case', 'update', $dao); } /** @@ -587,7 +587,7 @@ function civicrm_api3_case_update($params) { */ function civicrm_api3_case_delete($params) { //check parameters - civicrm_api3_verify_mandatory($params, NULL, array('id')); + civicrm_api3_verify_mandatory($params, NULL, ['id']); if (CRM_Case_BAO_Case::deleteCase($params['id'], CRM_Utils_Array::value('move_to_trash', $params, FALSE))) { return civicrm_api3_create_success($params, $params, 'Case', 'delete'); @@ -604,8 +604,8 @@ function civicrm_api3_case_delete($params) { * @return void */ function _civicrm_api3_case_restore_spec(&$spec) { - $result = civicrm_api3('Case', 'getfields', array('api_action' => 'delete')); - $spec = array('id' => $result['values']['id']); + $result = civicrm_api3('Case', 'getfields', ['api_action' => 'delete']); + $spec = ['id' => $result['values']['id']]; } /** @@ -646,7 +646,7 @@ function _civicrm_api3_case_read(&$cases, $options) { } if (!empty($options['return']['activities'])) { // add case activities array - we'll populate them in bulk below - $case['activities'] = array(); + $case['activities'] = []; } // Properly render this joined field if (!empty($options['return']['case_type_id.definition'])) { @@ -658,7 +658,7 @@ function _civicrm_api3_case_read(&$cases, $options) { $caseTypeName = !empty($case['case_type_id.name']) ? $case['case_type_id.name'] : CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseTypeId, 'name'); $xml = CRM_Case_XMLRepository::singleton()->retrieve($caseTypeName); } - $case['case_type_id.definition'] = array(); + $case['case_type_id.definition'] = []; if ($xml) { $case['case_type_id.definition'] = CRM_Case_BAO_CaseType::convertXmlToDefinition($xml); } @@ -667,14 +667,14 @@ function _civicrm_api3_case_read(&$cases, $options) { // Bulk-load activities if (!empty($options['return']['activities'])) { $query = "SELECT case_id, activity_id FROM civicrm_case_activity WHERE case_id IN (%1)"; - $params = array(1 => array(implode(',', array_keys($cases)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES)); + $params = [1 => [implode(',', array_keys($cases)), 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES]]; $dao = CRM_Core_DAO::executeQuery($query, $params); while ($dao->fetch()) { $cases[$dao->case_id]['activities'][] = $dao->activity_id; } } // Bulk-load tags. Supports joins onto the tag entity. - $tagGet = array('tag_id', 'entity_id'); + $tagGet = ['tag_id', 'entity_id']; foreach (array_keys($options['return']) as $key) { if (strpos($key, 'tag_id.') === 0) { $tagGet[] = $key; @@ -682,12 +682,12 @@ function _civicrm_api3_case_read(&$cases, $options) { } } if (!empty($options['return']['tag_id'])) { - $tags = civicrm_api3('EntityTag', 'get', array( + $tags = civicrm_api3('EntityTag', 'get', [ 'entity_table' => 'civicrm_case', - 'entity_id' => array('IN' => array_keys($cases)), + 'entity_id' => ['IN' => array_keys($cases)], 'return' => $tagGet, - 'options' => array('limit' => 0), - )); + 'options' => ['limit' => 0], + ]); foreach ($tags['values'] as $tag) { $key = (int) $tag['entity_id']; unset($tag['entity_id'], $tag['id']); @@ -703,7 +703,7 @@ function _civicrm_api3_case_read(&$cases, $options) { */ function _civicrm_api3_case_format_params(&$params) { // Format/include custom params - $values = array(); + $values = []; _civicrm_api3_custom_format_params($params, $values, 'Case'); $params = array_merge($params, $values); @@ -711,7 +711,7 @@ function _civicrm_api3_case_format_params(&$params) { // Convert single value to array here to simplify processing in later functions which expect an array. if (isset($params['contact_id'])) { if (!is_array($params['contact_id'])) { - $params['contact_id'] = array($params['contact_id']); + $params['contact_id'] = [$params['contact_id']]; } } @@ -758,24 +758,24 @@ function civicrm_api3_case_getList($params) { require_once 'api/v3/CaseContact.php'; //CRM:19956 - Assign case_id param if both id and case_id is passed to retrieve the case if (!empty($params['id']) && !empty($params['params']) && !empty($params['params']['case_id'])) { - $params['params']['case_id'] = array('IN' => $params['id']); + $params['params']['case_id'] = ['IN' => $params['id']]; unset($params['id']); } $params['id_field'] = 'case_id'; $params['label_field'] = $params['search_field'] = 'contact_id.sort_name'; - $params['description_field'] = array( + $params['description_field'] = [ 'case_id', 'case_id.case_type_id.title', 'case_id.subject', 'case_id.status_id', 'case_id.start_date', - ); - $apiRequest = array( + ]; + $apiRequest = [ 'version' => 3, 'entity' => 'CaseContact', 'action' => 'getlist', 'params' => $params, - ); + ]; return civicrm_api3_generic_getList($apiRequest); } diff --git a/api/v3/CaseContact.php b/api/v3/CaseContact.php index 1d2cbbb856..7cd9ecf669 100644 --- a/api/v3/CaseContact.php +++ b/api/v3/CaseContact.php @@ -84,19 +84,19 @@ function civicrm_api3_case_contact_delete($params) { * @return array */ function _civicrm_api3_case_contact_getlist_output($result, $request, $entity, $fields) { - $output = array(); + $output = []; if (!empty($result['values'])) { foreach ($result['values'] as $row) { - $data = array( + $data = [ 'id' => $row[$request['id_field']], 'label' => $row[$request['label_field']] . ' - ' . $row['case_id.case_type_id.title'], - ); + ]; $status = CRM_Core_PseudoConstant::getLabel('CRM_Case_BAO_Case', 'status_id', $row['case_id.status_id']); $date = CRM_Utils_Date::customFormat($row['case_id.start_date']); - $data['description'] = array( - "#{$row['case_id']}: $status " . ts('(opened %1)', array(1 => $date)), + $data['description'] = [ + "#{$row['case_id']}: $status " . ts('(opened %1)', [1 => $date]), $row['case_id.subject'], - ); + ]; if (!empty($request['image_field'])) { $data['image'] = isset($row[$request['image_field']]) ? $row[$request['image_field']] : ''; } diff --git a/api/v3/CaseType.php b/api/v3/CaseType.php index 68505fb754..155caba2a5 100644 --- a/api/v3/CaseType.php +++ b/api/v3/CaseType.php @@ -88,17 +88,17 @@ function civicrm_api3_case_type_get($params) { * @return array * @throws \CRM_Core_Exception */ -function _civicrm_api3_case_type_get_formatResult(&$result, $options = array()) { +function _civicrm_api3_case_type_get_formatResult(&$result, $options = []) { foreach ($result['values'] as $key => &$caseType) { if (!empty($caseType['definition'])) { list($xml) = CRM_Utils_XML::parseString($caseType['definition']); - $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : array(); + $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : []; } else { if (empty($options['return']) || !empty($options['return']['definition'])) { $caseTypeName = (isset($caseType['name'])) ? $caseType['name'] : CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $caseType['id'], 'name', 'id', TRUE); $xml = CRM_Case_XMLRepository::singleton()->retrieve($caseTypeName); - $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : array(); + $caseType['definition'] = $xml ? CRM_Case_BAO_CaseType::convertXmlToDefinition($xml) : []; } } $caseType['is_forkable'] = CRM_Case_BAO_CaseType::isForkable($caseType['id']); diff --git a/api/v3/Constant.php b/api/v3/Constant.php index 5675c62249..c507dda83a 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -104,12 +104,12 @@ function civicrm_api3_constant_get($params) { // once tests are 100% can try removing the first block & a similar block from Generic:getoptions // Whitelist approach is safer - $allowedClasses = array( + $allowedClasses = [ 'CRM_Core_PseudoConstant', 'CRM_Event_PseudoConstant', 'CRM_Contribute_PseudoConstant', 'CRM_Member_PseudoConstant', - ); + ]; $className = $allowedClasses[0]; if (!empty($params['class']) && in_array($params['class'], $allowedClasses)) { $className = $params['class']; @@ -117,17 +117,17 @@ function civicrm_api3_constant_get($params) { $callable = "$className::$name"; if (is_callable($callable)) { if (empty($params)) { - $values = call_user_func(array($className, $name)); + $values = call_user_func([$className, $name]); } else { - $values = call_user_func(array($className, $name)); + $values = call_user_func([$className, $name]); //@TODO XAV take out the param the COOKIE, Entity, Action and so there are only the "real param" in it //$values = call_user_func_array( array( $className, $name ), $params ); } return civicrm_api3_create_success($values, $params, 'Constant'); } else { - $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name); + $values = call_user_func(['CRM_Utils_PseudoConstant', 'getConstant'], $name); if (!empty($values)) { return civicrm_api3_create_success($values, $params, 'Constant'); } @@ -141,7 +141,7 @@ function civicrm_api3_constant_get($params) { * @param array $params */ function _civicrm_api3_constant_get_spec(&$params) { - $options = array( + $options = [ 'activityStatus', 'activityType', 'addressee', @@ -182,14 +182,14 @@ function _civicrm_api3_constant_get_spec(&$params) { 'visibility', 'worldRegion', 'wysiwygEditor', - ); - $params = array( - 'name' => array( + ]; + $params = [ + 'name' => [ 'title' => 'Constant Name', 'name' => 'name', 'api.required' => 1, 'options' => array_combine($options, $options), 'type' => CRM_Utils_Type::T_STRING, - ), - ); + ], + ]; } diff --git a/api/v3/ContactType.php b/api/v3/ContactType.php index 4c67674d3d..709bb9e2fa 100644 --- a/api/v3/ContactType.php +++ b/api/v3/ContactType.php @@ -49,7 +49,7 @@ * ContactType array */ function civicrm_api3_contact_type_create($params) { - civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__), array('name', 'parent_id')); + civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__), ['name', 'parent_id']); if (empty($params['id'])) { if (!array_key_exists('label', $params)) { diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 73918f8825..870ee7b17a 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -42,7 +42,7 @@ * Api result array */ function civicrm_api3_contribution_create(&$params) { - $values = array(); + $values = []; _civicrm_api3_custom_format_params($params, $values, 'Contribution'); $params = array_merge($params, $values); // The BAO should not clean money - it should be done in the form layer & api wrapper @@ -72,7 +72,7 @@ function civicrm_api3_contribution_create(&$params) { } } if (!empty($params['id']) && !empty($params['contribution_status_id'])) { - $error = array(); + $error = []; //throw error for invalid status change such as setting completed back to pending //@todo this sort of validation belongs in the BAO not the API - if it is not an OK // action it needs to be blocked there. If it is Ok through a form it needs to be OK through the api @@ -82,7 +82,7 @@ function civicrm_api3_contribution_create(&$params) { } } if (!empty($params['id']) && !empty($params['financial_type_id'])) { - $error = array(); + $error = []; CRM_Contribute_BAO_Contribution::checkFinancialTypeChange($params['financial_type_id'], $params['id'], $error); if (array_key_exists('financial_type_id', $error)) { throw new API_Exception($error['financial_type_id']); @@ -104,81 +104,81 @@ function civicrm_api3_contribution_create(&$params) { function _civicrm_api3_contribution_create_spec(&$params) { $params['contact_id']['api.required'] = 1; $params['total_amount']['api.required'] = 1; - $params['payment_instrument_id']['api.aliases'] = array('payment_instrument'); + $params['payment_instrument_id']['api.aliases'] = ['payment_instrument']; $params['receive_date']['api.default'] = 'now'; $params['receive_date']['api.required'] = TRUE; - $params['payment_processor'] = array( + $params['payment_processor'] = [ 'name' => 'payment_processor', 'title' => 'Payment Processor ID', 'description' => 'ID of payment processor used for this contribution', // field is called payment processor - not payment processor id but can only be one id so // it seems likely someone will fix it up one day to be more consistent - lets alias it from the start - 'api.aliases' => array('payment_processor_id'), + 'api.aliases' => ['payment_processor_id'], 'type' => CRM_Utils_Type::T_INT, - ); - $params['financial_type_id']['api.aliases'] = array('contribution_type_id', 'contribution_type'); + ]; + $params['financial_type_id']['api.aliases'] = ['contribution_type_id', 'contribution_type']; $params['financial_type_id']['api.required'] = 1; - $params['note'] = array( + $params['note'] = [ 'name' => 'note', 'uniqueName' => 'contribution_note', 'title' => 'note', 'type' => 2, 'description' => 'Associated Note in the notes table', - ); - $params['soft_credit_to'] = array( + ]; + $params['soft_credit_to'] = [ 'name' => 'soft_credit_to', 'title' => 'Soft Credit contact ID (legacy)', 'type' => CRM_Utils_Type::T_INT, 'description' => 'ID of Contact to be Soft credited to (deprecated - use contribution_soft api)', 'FKClassName' => 'CRM_Contact_DAO_Contact', - ); - $params['honor_contact_id'] = array( + ]; + $params['honor_contact_id'] = [ 'name' => 'honor_contact_id', 'title' => 'Honoree contact ID (legacy)', 'type' => CRM_Utils_Type::T_INT, 'description' => 'ID of honoree contact (deprecated - use contribution_soft api)', 'FKClassName' => 'CRM_Contact_DAO_Contact', - ); - $params['honor_type_id'] = array( + ]; + $params['honor_type_id'] = [ 'name' => 'honor_type_id', 'title' => 'Honoree Type (legacy)', 'type' => CRM_Utils_Type::T_INT, 'description' => 'Type of honoree contact (deprecated - use contribution_soft api)', 'pseudoconstant' => TRUE, - ); + ]; // note this is a recommended option but not adding as a default to avoid // creating unnecessary changes for the dev - $params['skipRecentView'] = array( + $params['skipRecentView'] = [ 'name' => 'skipRecentView', 'title' => 'Skip adding to recent view', 'type' => CRM_Utils_Type::T_BOOLEAN, 'description' => 'Do not add to recent view (setting this improves performance)', - ); - $params['skipLineItem'] = array( + ]; + $params['skipLineItem'] = [ 'name' => 'skipLineItem', 'title' => 'Skip adding line items', 'type' => CRM_Utils_Type::T_BOOLEAN, 'api.default' => 0, 'description' => 'Do not add line items by default (if you wish to add your own)', - ); - $params['batch_id'] = array( + ]; + $params['batch_id'] = [ 'title' => 'Batch', 'type' => CRM_Utils_Type::T_INT, 'description' => 'Batch which relevant transactions should be added to', - ); - $params['refund_trxn_id'] = array( + ]; + $params['refund_trxn_id'] = [ 'title' => 'Refund Transaction ID', 'type' => CRM_Utils_Type::T_STRING, 'description' => 'Transaction ID specific to the refund taking place', - ); - $params['card_type_id'] = array( + ]; + $params['card_type_id'] = [ 'title' => 'Card Type ID', 'description' => 'Providing Credit Card Type ID', 'type' => CRM_Utils_Type::T_INT, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'accept_creditcard', - ), - ); + ], + ]; } /** @@ -193,18 +193,18 @@ function _civicrm_api3_contribution_create_spec(&$params) { function _civicrm_api3_contribution_create_legacy_support_45(&$params) { //legacy soft credit handling - recommended approach is chaining if (!empty($params['soft_credit_to'])) { - $params['soft_credit'][] = array( + $params['soft_credit'][] = [ 'contact_id' => $params['soft_credit_to'], 'amount' => $params['total_amount'], 'soft_credit_type_id' => CRM_Core_OptionGroup::getDefaultValue("soft_credit_type"), - ); + ]; } if (!empty($params['honor_contact_id'])) { - $params['soft_credit'][] = array( + $params['soft_credit'][] = [ 'contact_id' => $params['honor_contact_id'], 'amount' => $params['total_amount'], 'soft_credit_type_id' => CRM_Utils_Array::value('honor_type_id', $params, CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', 'in_honor_of')), - ); + ]; } } @@ -232,7 +232,7 @@ function civicrm_api3_contribution_delete($params) { throw new API_Exception('You do not have permission to delete this contribution'); } if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionID)) { - return civicrm_api3_create_success(array($contributionID => 1)); + return civicrm_api3_create_success([$contributionID => 1]); } else { throw new API_Exception('Could not delete contribution'); @@ -247,7 +247,7 @@ function civicrm_api3_contribution_delete($params) { * @param array $params */ function _civicrm_api3_contribution_delete_spec(&$params) { - $params['id']['api.aliases'] = array('contribution_id'); + $params['id']['api.aliases'] = ['contribution_id']; } /** @@ -292,9 +292,9 @@ function civicrm_api3_contribution_get($params) { * @throws \API_Exception */ function _civicrm_api3_contribution_get_support_nonunique_returns($params) { - $additionalOptions = array(); + $additionalOptions = []; $options = _civicrm_api3_get_options_from_params($params, TRUE); - foreach (array('check_number', 'address_id') as $changedVariable) { + foreach (['check_number', 'address_id'] as $changedVariable) { if (isset($options['return']) && !empty($options['return'][$changedVariable])) { $additionalOptions['return']['contribution_' . $changedVariable] = 1; } @@ -312,11 +312,11 @@ function _civicrm_api3_contribution_add_supported_fields(&$contribution) { // Arguably we should also do the same with 'campaign_id' & // 'source' - which are also fields being rendered with unique names. // That seems more consistent with other api where we output the actual field names. - $outputAliases = array( + $outputAliases = [ 'contribution_check_number' => 'check_number', 'contribution_address_id' => 'address_id', 'payment_instrument_id' => 'instrument_id', - ); + ]; foreach ($outputAliases as $returnName => $copyTo) { if (array_key_exists($returnName, $contribution)) { $contribution[$copyTo] = $contribution[$returnName]; @@ -333,7 +333,7 @@ function _civicrm_api3_contribution_add_supported_fields(&$contribution) { * @return int */ function civicrm_api3_contribution_getcount($params) { - $count = _civicrm_api3_get_using_query_object('Contribution', $params, array(), TRUE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE); + $count = _civicrm_api3_get_using_query_object('Contribution', $params, [], TRUE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE); return (int) $count; } @@ -361,17 +361,17 @@ function _civicrm_api3_format_soft_credit(&$contribution) { * Array of parameters determined by getfields. */ function _civicrm_api3_contribution_get_spec(&$params) { - $params['contribution_test'] = array( + $params['contribution_test'] = [ 'api.default' => 0, 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => 'Get Test Contributions?', - 'api.aliases' => array('is_test'), - ); + 'api.aliases' => ['is_test'], + ]; - $params['financial_type_id']['api.aliases'] = array('contribution_type_id'); - $params['payment_instrument_id']['api.aliases'] = array('contribution_payment_instrument', 'payment_instrument'); + $params['financial_type_id']['api.aliases'] = ['contribution_type_id']; + $params['payment_instrument_id']['api.aliases'] = ['contribution_payment_instrument', 'payment_instrument']; $params['contact_id'] = CRM_Utils_Array::value('contribution_contact_id', $params); - $params['contact_id']['api.aliases'] = array('contribution_contact_id'); + $params['contact_id']['api.aliases'] = ['contribution_contact_id']; unset($params['contribution_contact_id']); } @@ -391,7 +391,7 @@ function _civicrm_api3_contribution_get_spec(&$params) { function _civicrm_api3_contribute_format_params($params, &$values) { //legacy way of formatting from v2 api - v3 way is to define metadata & do it in the api layer _civicrm_api3_filter_fields_for_bao('Contribution', $params, $values); - return array(); + return []; } /** @@ -403,7 +403,7 @@ function _civicrm_api3_contribute_format_params($params, &$values) { * Array of parameters determined by getfields. */ function _civicrm_api3_contribution_transact_spec(&$params) { - $fields = civicrm_api3('Contribution', 'getfields', array('action' => 'create')); + $fields = civicrm_api3('Contribution', 'getfields', ['action' => 'create']); $params = array_merge($params, $fields['values']); $params['receive_date']['api.default'] = 'now'; } @@ -455,8 +455,8 @@ function civicrm_api3_contribution_transact($params) { * @throws Exception */ function civicrm_api3_contribution_sendconfirmation($params) { - $ids = $values = array(); - $allowedParams = array( + $ids = $values = []; + $allowedParams = [ 'receipt_from_email', 'receipt_from_name', 'receipt_update', @@ -464,7 +464,7 @@ function civicrm_api3_contribution_sendconfirmation($params) { 'bcc_receipt', 'receipt_text', 'payment_processor_id', - ); + ]; $input = array_intersect_key($params, array_flip($allowedParams)); $input['is_email_receipt'] = TRUE; CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $params['id'], $values); @@ -479,40 +479,40 @@ function civicrm_api3_contribution_sendconfirmation($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_contribution_sendconfirmation_spec(&$params) { - $params['id'] = array( + $params['id'] = [ 'api.required' => 1, 'title' => ts('Contribution ID'), 'type' => CRM_Utils_Type::T_INT, - ); - $params['receipt_from_email'] = array( + ]; + $params['receipt_from_email'] = [ 'title' => ts('From Email address (string)'), 'type' => CRM_Utils_Type::T_STRING, - ); - $params['receipt_from_name'] = array( + ]; + $params['receipt_from_name'] = [ 'title' => ts('From Name (string)'), 'type' => CRM_Utils_Type::T_STRING, - ); - $params['cc_receipt'] = array( + ]; + $params['cc_receipt'] = [ 'title' => ts('CC Email address (string)'), 'type' => CRM_Utils_Type::T_STRING, - ); - $params['bcc_receipt'] = array( + ]; + $params['bcc_receipt'] = [ 'title' => ts('BCC Email address (string)'), 'type' => CRM_Utils_Type::T_STRING, - ); - $params['receipt_text'] = array( + ]; + $params['receipt_text'] = [ 'title' => ts('Message (string)'), 'type' => CRM_Utils_Type::T_STRING, - ); - $params['receipt_update'] = array( + ]; + $params['receipt_update'] = [ 'title' => ts('Update the Receipt Date'), 'type' => CRM_Utils_Type::T_BOOLEAN, 'api.default' => TRUE, - ); - $params['payment_processor_id'] = array( + ]; + $params['payment_processor_id'] = [ 'title' => ts('Payment processor Id (avoids mis-guesses)'), 'type' => CRM_Utils_Type::T_INT, - ); + ]; } /** @@ -534,7 +534,7 @@ function _civicrm_api3_contribution_sendconfirmation_spec(&$params) { * @throws \Exception */ function civicrm_api3_contribution_completetransaction(&$params) { - $input = $ids = array(); + $input = $ids = []; if (isset($params['payment_processor_id'])) { $input['payment_processor_id'] = $params['payment_processor_id']; } @@ -564,52 +564,52 @@ function civicrm_api3_contribution_completetransaction(&$params) { * @param array $params */ function _civicrm_api3_contribution_completetransaction_spec(&$params) { - $params['id'] = array( + $params['id'] = [ 'title' => 'Contribution ID', 'type' => CRM_Utils_Type::T_INT, 'api.required' => TRUE, - ); - $params['trxn_id'] = array( + ]; + $params['trxn_id'] = [ 'title' => 'Transaction ID', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['is_email_receipt'] = array( + ]; + $params['is_email_receipt'] = [ 'title' => 'Send email Receipt?', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['receipt_from_email'] = array( + ]; + $params['receipt_from_email'] = [ 'title' => 'Email to send receipt from.', 'description' => 'If not provided this will default to being based on domain mail or contribution page', 'type' => CRM_Utils_Type::T_EMAIL, - ); - $params['receipt_from_name'] = array( + ]; + $params['receipt_from_name'] = [ 'title' => 'Name to send receipt from', 'description' => '. If not provided this will default to domain mail or contribution page', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['payment_processor_id'] = array( + ]; + $params['payment_processor_id'] = [ 'title' => 'Payment processor ID', 'description' => 'Providing this is strongly recommended, as not possible to calculate it accurately always', 'type' => CRM_Utils_Type::T_INT, - ); - $params['fee_amount'] = array( + ]; + $params['fee_amount'] = [ 'title' => 'Fee charged on transaction', 'description' => 'If a fee has been charged then the amount', 'type' => CRM_Utils_Type::T_FLOAT, - ); - $params['trxn_date'] = array( + ]; + $params['trxn_date'] = [ 'title' => 'Transaction Date', 'description' => 'Date this transaction occurred', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - ); - $params['card_type_id'] = array( + ]; + $params['card_type_id'] = [ 'title' => 'Card Type ID', 'description' => 'Providing Credit Card Type ID', 'type' => CRM_Utils_Type::T_INT, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'accept_creditcard', - ), - ); + ], + ]; } /** @@ -629,17 +629,17 @@ function _civicrm_api3_contribution_completetransaction_spec(&$params) { * @throws API_Exception */ function civicrm_api3_contribution_repeattransaction(&$params) { - $input = $ids = array(); - civicrm_api3_verify_one_mandatory($params, NULL, array('contribution_recur_id', 'original_contribution_id')); + $input = $ids = []; + civicrm_api3_verify_one_mandatory($params, NULL, ['contribution_recur_id', 'original_contribution_id']); if (empty($params['original_contribution_id'])) { // CRM-19873 call with test mode. - $params['original_contribution_id'] = civicrm_api3('contribution', 'getvalue', array( + $params['original_contribution_id'] = civicrm_api3('contribution', 'getvalue', [ 'return' => 'id', - 'contribution_status_id' => array('IN' => array('Completed')), + 'contribution_status_id' => ['IN' => ['Completed']], 'contribution_recur_id' => $params['contribution_recur_id'], 'contribution_test' => CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $params['contribution_recur_id'], 'is_test'), - 'options' => array('limit' => 1, 'sort' => 'id DESC'), - )); + 'options' => ['limit' => 1, 'sort' => 'id DESC'], + ]); } $contribution = new CRM_Contribute_BAO_Contribution(); $contribution->id = $params['original_contribution_id']; @@ -648,10 +648,10 @@ function civicrm_api3_contribution_repeattransaction(&$params) { 'A valid original contribution ID is required', 'invalid_data'); } $original_contribution = clone $contribution; - $input['payment_processor_id'] = civicrm_api3('contributionRecur', 'getvalue', array( + $input['payment_processor_id'] = civicrm_api3('contributionRecur', 'getvalue', [ 'return' => 'payment_processor_id', 'id' => $contribution->contribution_recur_id, - )); + ]); try { if (!$contribution->loadRelatedObjects($input, $ids, TRUE)) { throw new API_Exception('failed to load related objects'); @@ -660,14 +660,14 @@ function civicrm_api3_contribution_repeattransaction(&$params) { unset($contribution->id, $contribution->receive_date, $contribution->invoice_id); $contribution->receive_date = $params['receive_date']; - $passThroughParams = array( + $passThroughParams = [ 'trxn_id', 'total_amount', 'campaign_id', 'fee_amount', 'financial_type_id', 'contribution_status_id', - ); + ]; $input = array_intersect_key($params, array_fill_keys($passThroughParams, NULL)); return _ipn_process_transaction($params, $contribution, $input, $ids, $original_contribution); @@ -735,67 +735,67 @@ function _ipn_process_transaction(&$params, $contribution, $input, $ids, $firstC * @param array $params */ function _civicrm_api3_contribution_repeattransaction_spec(&$params) { - $params['original_contribution_id'] = array( + $params['original_contribution_id'] = [ 'title' => 'Original Contribution ID', 'description' => 'Contribution ID to copy (will be calculated from recurring contribution if not provided)', 'type' => CRM_Utils_Type::T_INT, - ); - $params['contribution_recur_id'] = array( + ]; + $params['contribution_recur_id'] = [ 'title' => 'Recurring contribution ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['trxn_id'] = array( + ]; + $params['trxn_id'] = [ 'title' => 'Transaction ID', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['is_email_receipt'] = array( + ]; + $params['is_email_receipt'] = [ 'title' => 'Send email Receipt?', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['contribution_status_id'] = array( + ]; + $params['contribution_status_id'] = [ 'title' => 'Contribution Status ID', 'name' => 'contribution_status_id', 'type' => CRM_Utils_Type::T_INT, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', - ), + ], 'api.required' => TRUE, - ); - $params['receive_date'] = array( + ]; + $params['receive_date'] = [ 'title' => 'Contribution Receive Date', 'name' => 'receive_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, 'api.default' => 'now', - ); - $params['trxn_id'] = array( + ]; + $params['trxn_id'] = [ 'title' => 'Transaction ID', 'name' => 'trxn_id', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['campaign_id'] = array( + ]; + $params['campaign_id'] = [ 'title' => 'Campaign ID', 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ), - ); - $params['financial_type_id'] = array( + ], + ]; + $params['financial_type_id'] = [ 'title' => 'Financial ID (ignored if more than one line item)', 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ), - ); - $params['payment_processor_id'] = array( + ], + ]; + $params['payment_processor_id'] = [ 'description' => ts('Payment processor ID, will be loaded from contribution_recur if not provided'), 'title' => 'Payment processor ID', 'name' => 'payment_processor_id', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } diff --git a/api/v3/ContributionPage.php b/api/v3/ContributionPage.php index 9ffbd59edb..42385d0506 100644 --- a/api/v3/ContributionPage.php +++ b/api/v3/ContributionPage.php @@ -58,7 +58,7 @@ function civicrm_api3_contribution_page_create($params) { */ function _civicrm_api3_contribution_page_create_spec(&$params) { $params['financial_type_id']['api.required'] = 1; - $params['payment_processor']['api.aliases'] = array('payment_processor_id'); + $params['payment_processor']['api.aliases'] = ['payment_processor_id']; $params['is_active']['api.default'] = 1; } @@ -157,12 +157,12 @@ function _civicrm_api3_contribution_page_validate_spec(&$params) { * @return array */ function _civicrm_api3_contribution_page_getlist_defaults(&$request) { - return array( - 'description_field' => array( + return [ + 'description_field' => [ 'intro_text', - ), - 'params' => array( + ], + 'params' => [ 'is_active' => 1, - ), - ); + ], + ]; } diff --git a/api/v3/ContributionRecur.php b/api/v3/ContributionRecur.php index 4160e19faf..2ccb955596 100644 --- a/api/v3/ContributionRecur.php +++ b/api/v3/ContributionRecur.php @@ -84,7 +84,7 @@ function civicrm_api3_contribution_recur_get($params) { * returns true is successfully cancelled */ function civicrm_api3_contribution_recur_cancel($params) { - civicrm_api3_verify_one_mandatory($params, NULL, array('id')); + civicrm_api3_verify_one_mandatory($params, NULL, ['id']); return CRM_Contribute_BAO_ContributionRecur::cancelRecurContribution($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error(ts('Error while cancelling recurring contribution')); } diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index b6af835e13..0ac81d5e94 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -52,12 +52,12 @@ function civicrm_api3_custom_field_create($params) { foreach ($params['option_values'] as $key => $value) { // Translate simple key/value pairs into full-blown option values if (!is_array($value)) { - $value = array( + $value = [ 'label' => $value, 'value' => $key, 'is_active' => 1, 'weight' => $weight, - ); + ]; $key = $weight++; } $params['option_label'][$key] = $value['label']; @@ -66,7 +66,7 @@ function civicrm_api3_custom_field_create($params) { $params['option_weight'][$key] = $value['weight']; } } - $values = array(); + $values = []; $customField = CRM_Core_BAO_CustomField::create($params); _civicrm_api3_object_to_array_unique_fields($customField, $values[$customField->id]); _civicrm_api3_custom_field_flush_static_caches(); @@ -77,7 +77,7 @@ function civicrm_api3_custom_field_create($params) { * Flush static caches in functions that might have stored available custom fields. */ function _civicrm_api3_custom_field_flush_static_caches() { - civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1)); + civicrm_api('CustomField', 'getfields', ['version' => 3, 'cache_clear' => 1]); CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE); } @@ -91,17 +91,17 @@ function _civicrm_api3_custom_field_create_spec(&$params) { $params['label']['api.required'] = 1; $params['custom_group_id']['api.required'] = 1; $params['is_active']['api.default'] = 1; - $params['option_values'] = array( + $params['option_values'] = [ 'title' => 'Option Values', 'description' => "Pass an array of options (value => label) to create this field's option values", - ); + ]; // TODO: Why expose this to the api at all? - $params['option_type'] = array( + $params['option_type'] = [ 'title' => 'Option Type', 'description' => 'This (boolean) field tells the BAO to create an option group for the field if the field type is appropriate', 'api.default' => 1, 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; $params['data_type']['api.default'] = 'String'; $params['is_active']['api.default'] = 1; } @@ -119,7 +119,7 @@ function civicrm_api3_custom_field_delete($params) { $field->id = $params['id']; $field->find(TRUE); $customFieldDelete = CRM_Core_BAO_CustomField::deleteField($field); - civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1)); + civicrm_api('CustomField', 'getfields', ['version' => 3, 'cache_clear' => 1]); return $customFieldDelete ? civicrm_api3_create_error('Error while deleting custom field') : civicrm_api3_create_success(); } @@ -154,7 +154,7 @@ function civicrm_api3_custom_field_get($params) { * @todo remove this function - not in use but need to review functionality before * removing as it might be useful in wrapper layer */ -function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = array()) { +function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = []) { return NULL; //see comment block if (!$value) { @@ -205,7 +205,7 @@ function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDet } if (!is_array($value)) { - $value = array($value); + $value = [$value]; } $query = "SELECT count(*) FROM civicrm_country WHERE id IN (" . implode(',', $value) . ")"; @@ -225,7 +225,7 @@ function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDet } if (!is_array($value)) { - $value = array($value); + $value = [$value]; } $query = " @@ -242,13 +242,13 @@ SELECT count(*) break; } - if (in_array($htmlType, array( - 'Select', 'Multi-Select', 'CheckBox', 'Radio')) && + if (in_array($htmlType, [ + 'Select', 'Multi-Select', 'CheckBox', 'Radio']) && !isset($errors[$fieldName]) ) { $options = CRM_Core_OptionGroup::valuesByID($fieldDetails['option_group_id']); if (!is_array($value)) { - $value = array($value); + $value = [$value]; } $invalidOptions = array_diff($value, array_keys($options)); @@ -270,7 +270,7 @@ SELECT count(*) */ function civicrm_api3_custom_field_setvalue($params) { require_once 'api/v3/Generic/Setvalue.php'; - $result = civicrm_api3_generic_setValue(array("entity" => 'CustomField', 'params' => $params)); + $result = civicrm_api3_generic_setValue(["entity" => 'CustomField', 'params' => $params]); if (empty($result['is_error'])) { CRM_Utils_System::flushCache(); } diff --git a/api/v3/CustomGroup.php b/api/v3/CustomGroup.php index f2dc5ca7fd..a06d5d9342 100644 --- a/api/v3/CustomGroup.php +++ b/api/v3/CustomGroup.php @@ -115,7 +115,7 @@ function civicrm_api3_custom_group_get($params) { */ function civicrm_api3_custom_group_setvalue($params) { require_once 'api/v3/Generic/Setvalue.php'; - $result = civicrm_api3_generic_setValue(array("entity" => 'CustomGroup', 'params' => $params)); + $result = civicrm_api3_generic_setValue(["entity" => 'CustomGroup', 'params' => $params]); if (empty($result['is_error'])) { CRM_Utils_System::flushCache(); } diff --git a/api/v3/CustomSearch.php b/api/v3/CustomSearch.php index 359466d9ea..0623e51a94 100644 --- a/api/v3/CustomSearch.php +++ b/api/v3/CustomSearch.php @@ -81,7 +81,7 @@ function _civicrm_api3_custom_search_create_spec(&$params) { $params['option_group_id']['api.default'] = CRM_Core_DAO::getFieldValue( 'CRM_Core_DAO_OptionGroup', 'custom_search', 'id', 'name' ); - $params['name']['api.aliases'] = array('class_name'); + $params['name']['api.aliases'] = ['class_name']; } /** diff --git a/api/v3/CustomValue.php b/api/v3/CustomValue.php index 60005bdb19..7ada45ac29 100644 --- a/api/v3/CustomValue.php +++ b/api/v3/CustomValue.php @@ -69,7 +69,7 @@ function civicrm_api3_custom_value_create($params) { if (!empty($params['entity_table']) && substr($params['entity_table'], 0, 7) == 'civicrm') { $params['entity_table'] = substr($params['entity_table'], 8, 7); } - $create = array('entityID' => $params['entity_id']); + $create = ['entityID' => $params['entity_id']]; // Translate names and //Convert arrays to multi-value strings $sp = CRM_Core_DAO::VALUE_SEPARATOR; @@ -135,10 +135,10 @@ function _civicrm_api3_custom_value_create_spec(&$params) { */ function civicrm_api3_custom_value_get($params) { - $getParams = array( + $getParams = [ 'entityID' => $params['entity_id'], 'entityType' => CRM_Utils_Array::value('entity_table', $params, ''), - ); + ]; if (strstr($getParams['entityType'], 'civicrm_')) { $getParams['entityType'] = ucfirst(substr($getParams['entityType'], 8)); } @@ -176,7 +176,7 @@ function civicrm_api3_custom_value_get($params) { if ($result['is_error']) { if ($result['error_message'] == "No values found for the specified entity ID and custom field(s).") { - $values = array(); + $values = []; return civicrm_api3_create_success($values, $params, 'CustomValue'); } else { @@ -250,45 +250,45 @@ function _civicrm_api3_custom_value_get_spec(&$params) { * @throws \CiviCRM_API3_Exception */ function _civicrm_api3_custom_value_gettree_spec(&$spec) { - $spec['entity_id'] = array( + $spec['entity_id'] = [ 'title' => 'Entity Id', 'description' => 'Id of entity', 'type' => CRM_Utils_Type::T_INT, 'api.required' => 1, - ); + ]; $entities = civicrm_api3('Entity', 'get'); $entities = array_diff($entities['values'], $entities['deprecated']); - $spec['entity_type'] = array( + $spec['entity_type'] = [ 'title' => 'Entity Type', 'description' => 'API name of entity type, e.g. "Contact"', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => 1, 'options' => array_combine($entities, $entities), - ); + ]; // Return params for custom group, field & value foreach (CRM_Core_DAO_CustomGroup::fields() as $field) { $name = 'custom_group.' . $field['name']; - $spec[$name] = array('name' => $name) + $field; + $spec[$name] = ['name' => $name] + $field; } foreach (CRM_Core_DAO_CustomField::fields() as $field) { $name = 'custom_field.' . $field['name']; - $spec[$name] = array('name' => $name) + $field; + $spec[$name] = ['name' => $name] + $field; } - $spec['custom_value.id'] = array( + $spec['custom_value.id'] = [ 'title' => 'Custom Value Id', 'description' => 'Id of record in custom value table', 'type' => CRM_Utils_Type::T_INT, - ); - $spec['custom_value.data'] = array( + ]; + $spec['custom_value.data'] = [ 'title' => 'Custom Value (Raw)', 'description' => 'Raw value as stored in the database', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['custom_value.display'] = array( + ]; + $spec['custom_value.display'] = [ 'title' => 'Custom Value (Formatted)', 'description' => 'Custom value formatted for display', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; } /** @@ -302,13 +302,13 @@ function _civicrm_api3_custom_value_gettree_spec(&$spec) { * @throws \CiviCRM_API3_Exception */ function civicrm_api3_custom_value_gettree($params) { - $ret = array(); + $ret = []; $options = _civicrm_api3_get_options_from_params($params); - $toReturn = array( - 'custom_group' => array(), - 'custom_field' => array(), - 'custom_value' => array(), - ); + $toReturn = [ + 'custom_group' => [], + 'custom_field' => [], + 'custom_value' => [], + ]; foreach (array_keys($options['return']) as $r) { list($type, $field) = explode('.', $r); if (isset($toReturn[$type])) { @@ -321,7 +321,7 @@ function civicrm_api3_custom_value_gettree($params) { } switch ($params['entity_type']) { case 'Contact': - $ret = array('entityType' => 'contact_type', 'subTypes' => 'contact_sub_type'); + $ret = ['entityType' => 'contact_type', 'subTypes' => 'contact_sub_type']; break; case 'Activity': @@ -332,25 +332,25 @@ function civicrm_api3_custom_value_gettree($params) { case 'Grant': case 'Membership': case 'Relationship': - $ret = array('subTypes' => strtolower($params['entity_type']) . '_type_id'); + $ret = ['subTypes' => strtolower($params['entity_type']) . '_type_id']; break; case 'Participant': // todo } - $treeParams = array( + $treeParams = [ 'entityType' => $params['entity_type'], - 'subTypes' => array(), + 'subTypes' => [], 'subName' => NULL, - ); + ]; // Fetch entity data for custom group type/sub-type // Also verify access permissions (api3 will throw an exception if permission denied) if ($ret || !empty($params['check_permissions'])) { - $entityData = civicrm_api3($params['entity_type'], 'getsingle', array( + $entityData = civicrm_api3($params['entity_type'], 'getsingle', [ 'id' => $params['entity_id'], 'check_permissions' => !empty($params['check_permissions']), - 'return' => array_merge(array('id'), array_values($ret)), - )); + 'return' => array_merge(['id'], array_values($ret)), + ]); foreach ($ret as $param => $key) { if (isset($entityData[$key])) { $treeParams[$param] = $entityData[$key]; @@ -359,16 +359,16 @@ function civicrm_api3_custom_value_gettree($params) { } $tree = CRM_Core_BAO_CustomGroup::getTree($treeParams['entityType'], $toReturn, $params['entity_id'], NULL, $treeParams['subTypes'], $treeParams['subName'], TRUE, NULL, FALSE, CRM_Utils_Array::value('check_permissions', $params, TRUE)); unset($tree['info']); - $result = array(); + $result = []; foreach ($tree as $group) { - $result[$group['name']] = array(); + $result[$group['name']] = []; $groupToReturn = $toReturn['custom_group'] ? $toReturn['custom_group'] : array_keys($group); foreach ($groupToReturn as $item) { $result[$group['name']][$item] = CRM_Utils_Array::value($item, $group); } - $result[$group['name']]['fields'] = array(); + $result[$group['name']]['fields'] = []; foreach ($group['fields'] as $fieldInfo) { - $field = array('value' => NULL); + $field = ['value' => NULL]; $fieldToReturn = $toReturn['custom_field'] ? $toReturn['custom_field'] : array_keys($fieldInfo); foreach ($fieldToReturn as $item) { $field[$item] = CRM_Utils_Array::value($item, $fieldInfo); diff --git a/api/v3/Cxn.php b/api/v3/Cxn.php index eb63ed35a5..6f12beb094 100644 --- a/api/v3/Cxn.php +++ b/api/v3/Cxn.php @@ -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); } diff --git a/api/v3/CxnApp.php b/api/v3/CxnApp.php index d3f6585f43..9e289c8d8a 100644 --- a/api/v3/CxnApp.php +++ b/api/v3/CxnApp.php @@ -48,34 +48,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 +104,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"); diff --git a/api/v3/Dashboard.php b/api/v3/Dashboard.php index 3dd06ea0f5..1cd9bd98f4 100644 --- a/api/v3/Dashboard.php +++ b/api/v3/Dashboard.php @@ -41,12 +41,12 @@ * Array containing 'is_error' to denote success or failure and details of the created activity */ function civicrm_api3_dashboard_create($params) { - civicrm_api3_verify_one_mandatory($params, NULL, array( + civicrm_api3_verify_one_mandatory($params, NULL, [ 'name', 'label', 'url', 'fullscreen_url', - ) + ] ); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Dashboard'); } diff --git a/api/v3/DashboardContact.php b/api/v3/DashboardContact.php index c6b7b4bb1c..2c84ebed8b 100644 --- a/api/v3/DashboardContact.php +++ b/api/v3/DashboardContact.php @@ -42,9 +42,9 @@ function civicrm_api3_dashboard_contact_create($params) { if (empty($params['id'])) { civicrm_api3_verify_one_mandatory($params, NULL, - array( + [ 'dashboard_id', - ) + ] ); } $errors = _civicrm_api3_dashboard_contact_check_params($params); diff --git a/api/v3/Domain.php b/api/v3/Domain.php index 2139fa0e87..94e5c52a97 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -58,23 +58,23 @@ function civicrm_api3_domain_get($params) { foreach ($domains as $domain) { if (!empty($domain['contact_id'])) { - $values = array(); - $locparams = array( + $values = []; + $locparams = [ 'contact_id' => $domain['contact_id'], - ); + ]; $values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE); - $address_array = array( + $address_array = [ 'street_address', 'supplemental_address_1', 'supplemental_address_2', 'supplemental_address_3', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2', - ); + ]; if (!empty($values['location']['email'])) { $domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]); } if (!empty($values['location']['phone'])) { - $domain['domain_phone'] = array( + $domain['domain_phone'] = [ 'phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', CRM_Utils_Array::value( 'phone_type_id', @@ -85,7 +85,7 @@ function civicrm_api3_domain_get($params) { 'phone', $values['location']['phone'][1] ), - ); + ]; } if (!empty($values['location']['address'])) { @@ -119,10 +119,10 @@ function civicrm_api3_domain_get($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_domain_get_spec(&$params) { - $params['current_domain'] = array( + $params['current_domain'] = [ 'title' => "Current Domain", 'description' => "get loaded domain", - ); + ]; } /** @@ -160,11 +160,11 @@ function civicrm_api3_domain_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_domain_create_spec(&$params) { - $params['domain_version'] = array( + $params['domain_version'] = [ 'title' => "CiviCRM Version", 'description' => "The civicrm version this instance is running", 'type' => CRM_Utils_Type::T_STRING, - ); + ]; $params['domain_version']['api.required'] = 1; unset($params['version']); $params['name']['api.required'] = 1; diff --git a/api/v3/Entity.php b/api/v3/Entity.php index 5113466851..4bab9fe893 100644 --- a/api/v3/Entity.php +++ b/api/v3/Entity.php @@ -11,7 +11,7 @@ * Array of deprecated api entities */ function _civicrm_api3_entity_deprecation($entities) { - $deprecated = array(); + $deprecated = []; if (!empty($entities['values'])) { foreach ($entities['values'] as $entity) { if (is_string(_civicrm_api3_deprecation_check($entity))) { @@ -60,5 +60,5 @@ function civicrm_api3_entity_delete($params) { function civicrm_api3_entity_getfields($params) { // we return an empty array so it makes it easier to write generic getdefaults / required tests // without putting an exception in for entity - return civicrm_api3_create_success(array()); + return civicrm_api3_create_success([]); } diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index c363275e9c..6ed334f781 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -54,7 +54,7 @@ function civicrm_api3_entity_tag_get($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_entity_tag_get_spec(&$params) { - $params['entity_id']['api.aliases'] = array('contact_id'); + $params['entity_id']['api.aliases'] = ['contact_id']; $params['entity_table']['api.default'] = 'civicrm_contact'; } @@ -101,7 +101,7 @@ function _civicrm_api3_entity_tag_delete_spec(&$params) { */ function _civicrm_api3_entity_tag_common($params, $op = 'add') { - $entityIDs = $tagIDs = array(); + $entityIDs = $tagIDs = []; $entityTable = 'civicrm_contact'; if (is_array($params)) { foreach ($params as $n => $v) { @@ -135,7 +135,7 @@ function _civicrm_api3_entity_tag_common($params, $op = 'add') { } } - $values = array('is_error' => 0); + $values = ['is_error' => 0]; if ($op == 'add') { $values['total_count'] = $values['added'] = $values['not_added'] = 0; foreach ($tagIDs as $tagID) { diff --git a/api/v3/Event.php b/api/v3/Event.php index 7ebe392850..5bbb7dc7a3 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -44,17 +44,17 @@ function civicrm_api3_event_create($params) { // Required fields for creating an event if (empty($params['id']) && empty($params['is_template'])) { - civicrm_api3_verify_mandatory($params, NULL, array( + civicrm_api3_verify_mandatory($params, NULL, [ 'start_date', 'title', - array('event_type_id', 'template_id'), - )); + ['event_type_id', 'template_id'], + ]); } // Required fields for creating an event template elseif (empty($params['id']) && !empty($params['is_template'])) { - civicrm_api3_verify_mandatory($params, NULL, array( + civicrm_api3_verify_mandatory($params, NULL, [ 'template_title', - )); + ]); } // Clone event from template @@ -78,7 +78,7 @@ function civicrm_api3_event_create($params) { */ function _civicrm_api3_event_create_spec(&$params) { $params['is_active']['api.default'] = 1; - $params['financial_type_id']['api.aliases'] = array('contribution_type_id'); + $params['financial_type_id']['api.aliases'] = ['contribution_type_id']; $params['is_template']['api.default'] = 0; } @@ -157,7 +157,7 @@ function civicrm_api3_event_get($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_event_get_spec(&$params) { - $params['financial_type_id']['api.aliases'] = array('contribution_type_id'); + $params['financial_type_id']['api.aliases'] = ['contribution_type_id']; } /** @@ -226,14 +226,14 @@ function _civicrm_api3_event_getisfull(&$event, $event_id) { * @param array $request */ function _civicrm_api3_event_getlist_params(&$request) { - $fieldsToReturn = array('start_date', 'event_type_id', 'title', 'summary'); + $fieldsToReturn = ['start_date', 'event_type_id', 'title', 'summary']; $request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra'])); $request['params']['options']['sort'] = 'start_date DESC'; if (empty($request['params']['id'])) { - $request['params'] += array( + $request['params'] += [ 'is_template' => 0, 'is_active' => 1, - ); + ]; } } @@ -248,20 +248,20 @@ function _civicrm_api3_event_getlist_params(&$request) { * @return array */ function _civicrm_api3_event_getlist_output($result, $request) { - $output = array(); + $output = []; if (!empty($result['values'])) { foreach ($result['values'] as $row) { - $data = array( + $data = [ 'id' => $row[$request['id_field']], 'label' => $row[$request['label_field']], - 'description' => array( + 'description' => [ CRM_Core_Pseudoconstant::getLabel( 'CRM_Event_BAO_Event', 'event_type_id', $row['event_type_id'] ), - ), - ); + ], + ]; if (!empty($row['start_date'])) { $data['description'][0] .= ': ' . CRM_Utils_Date::customFormat($row['start_date']); } @@ -272,7 +272,7 @@ function _civicrm_api3_event_getlist_output($result, $request) { $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($row['id'], 'civicrm_event'); $data['extra']['is_recur'] = FALSE; if ($repeat) { - $data['suffix'] = ts('(%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1])); + $data['suffix'] = ts('(%1 of %2)', [1 => $repeat[0], 2 => $repeat[1]]); $data['extra']['is_recur'] = TRUE; } $output[] = $data; diff --git a/api/v3/Extension.php b/api/v3/Extension.php index 3dddb762d0..f079acaee7 100644 --- a/api/v3/Extension.php +++ b/api/v3/Extension.php @@ -69,17 +69,17 @@ function civicrm_api3_extension_install($params) { * @param $fields */ function _civicrm_api3_extension_install_spec(&$fields) { - $fields['keys'] = array( + $fields['keys'] = [ 'title' => 'Extension Key(s)', - 'api.aliases' => array('key'), + 'api.aliases' => ['key'], 'type' => CRM_Utils_Type::T_STRING, 'description' => 'Fully qualified name of one or more extensions', - ); - $fields['path'] = array( + ]; + $fields['path'] = [ 'title' => 'Extension Path', 'type' => CRM_Utils_Type::T_STRING, 'description' => 'The path to the extension. May use wildcard ("*").', - ); + ]; } /** @@ -91,11 +91,11 @@ function _civicrm_api3_extension_install_spec(&$fields) { function civicrm_api3_extension_upgrade() { CRM_Core_Invoke::rebuildMenuAndCaches(TRUE); $queue = CRM_Extension_Upgrades::createQueue(); - $runner = new CRM_Queue_Runner(array( + $runner = new CRM_Queue_Runner([ 'title' => 'Extension Upgrades', 'queue' => $queue, 'errorMode' => CRM_Queue_Runner::ERROR_ABORT, - )); + ]); try { $result = $runner->runAll(); @@ -255,7 +255,7 @@ function civicrm_api3_extension_download($params) { CRM_Extension_System::singleton()->getCache()->flush(); CRM_Extension_System::singleton(TRUE); if (CRM_Utils_Array::value('install', $params, TRUE)) { - CRM_Extension_System::singleton()->getManager()->install(array($params['key'])); + CRM_Extension_System::singleton()->getManager()->install([$params['key']]); } return civicrm_api3_create_success(); @@ -266,23 +266,23 @@ function civicrm_api3_extension_download($params) { * @param $fields */ function _civicrm_api3_extension_download_spec(&$fields) { - $fields['key'] = array( + $fields['key'] = [ 'title' => 'Extension Key', 'api.required' => 1, 'type' => CRM_Utils_Type::T_STRING, 'description' => 'Fully qualified name of the extension', - ); - $fields['url'] = array( + ]; + $fields['url'] = [ 'title' => 'Download URL', 'type' => CRM_Utils_Type::T_STRING, 'description' => 'Optional as the system can determine the url automatically for public extensions', - ); - $fields['install'] = array( + ]; + $fields['install'] = [ 'title' => 'Auto-install', 'type' => CRM_Utils_Type::T_STRING, 'description' => 'Automatically install the downloaded extension', 'api.default' => TRUE, - ); + ]; } /** @@ -319,18 +319,18 @@ function civicrm_api3_extension_refresh($params) { * @param $fields */ function _civicrm_api3_extension_refresh_spec(&$fields) { - $fields['local'] = array( + $fields['local'] = [ 'title' => 'Rescan Local', 'api.default' => 1, 'type' => CRM_Utils_Type::T_BOOLEAN, 'description' => 'Whether to rescan the local filesystem (default TRUE)', - ); - $fields['remote'] = array( + ]; + $fields['remote'] = [ 'title' => 'Rescan Remote', 'api.default' => 1, 'type' => CRM_Utils_Type::T_BOOLEAN, 'description' => 'Whether to rescan the remote repository (default TRUE)', - ); + ]; } /** @@ -347,14 +347,14 @@ function civicrm_api3_extension_get($params) { $keys = array_merge($full_names, $keys); $statuses = CRM_Extension_System::singleton()->getManager()->getStatuses(); $mapper = CRM_Extension_System::singleton()->getMapper(); - $result = array(); + $result = []; $id = 0; foreach ($statuses as $key => $status) { try { $obj = $mapper->keyToInfo($key); } catch (CRM_Extension_Exception $ex) { - CRM_Core_Session::setStatus(ts('Failed to read extension (%1). Please refresh the extension list.', array(1 => $key))); + CRM_Core_Session::setStatus(ts('Failed to read extension (%1). Please refresh the extension list.', [1 => $key])); continue; } $info = CRM_Extension_System::createExtendedInfo($obj); @@ -374,7 +374,7 @@ function civicrm_api3_extension_get($params) { unset($params['keys']); unset($params['full_name']); - $filterableFields = array('id', 'type', 'status', 'path'); + $filterableFields = ['id', 'type', 'status', 'path']; return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', $filterableFields); } @@ -388,15 +388,15 @@ function civicrm_api3_extension_get($params) { */ function civicrm_api3_extension_getremote($params) { $extensions = CRM_Extension_System::singleton()->getBrowser()->getExtensions(); - $result = array(); + $result = []; $id = 0; foreach ($extensions as $key => $obj) { - $info = array(); + $info = []; $info['id'] = $id++; // backward compatibility with indexing scheme $info = array_merge($info, (array) $obj); $result[] = $info; } - return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', CRM_Utils_Array::value('return', $params, array())); + return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', CRM_Utils_Array::value('return', $params, [])); } /** @@ -419,11 +419,11 @@ function _civicrm_api3_getKeys($params, $key = 'keys') { return $params[$key]; } if ($params[$key] == '') { - return array(); + return []; } return explode(API_V3_EXTENSION_DELIMITER, $params[$key]); } else { - return array(); + return []; } } diff --git a/api/v3/File.php b/api/v3/File.php index 583d41e582..cfa56b8f70 100644 --- a/api/v3/File.php +++ b/api/v3/File.php @@ -47,14 +47,14 @@ */ function civicrm_api3_file_create($params) { - civicrm_api3_verify_mandatory($params, 'CRM_Core_DAO_File', array('uri')); + civicrm_api3_verify_mandatory($params, 'CRM_Core_DAO_File', ['uri']); if (!isset($params['upload_date'])) { $params['upload_date'] = date("Ymd"); } $fileDAO = new CRM_Core_DAO_File(); - $properties = array( + $properties = [ 'id', 'file_type_id', 'mime_type', @@ -62,7 +62,7 @@ function civicrm_api3_file_create($params) { 'document', 'description', 'upload_date', - ); + ]; foreach ($properties as $name) { if (array_key_exists($name, $params)) { @@ -72,7 +72,7 @@ function civicrm_api3_file_create($params) { $fileDAO->save(); - $file = array(); + $file = []; _civicrm_api3_object_to_array($fileDAO, $file); return civicrm_api3_create_success($file, $params, 'File', 'create', $fileDAO); @@ -114,7 +114,7 @@ function civicrm_api3_file_update($params) { } $fileDAO->save(); } - $file = array(); + $file = []; $cloneDAO = clone($fileDAO); _civicrm_api3_object_to_array($cloneDAO, $file); return $file; @@ -130,7 +130,7 @@ function civicrm_api3_file_update($params) { */ function civicrm_api3_file_delete($params) { - civicrm_api3_verify_mandatory($params, NULL, array('id')); + civicrm_api3_verify_mandatory($params, NULL, ['id']); if (CRM_Core_BAO_File::deleteEntityFile('*', $params['id'])) { return civicrm_api3_create_success(); } diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 2200d258a5..bbc58bfbd1 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -55,20 +55,20 @@ * API success object */ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) { - static $results = array(); + static $results = []; if ((CRM_Utils_Array::value('cache_clear', $apiRequest['params']))) { - $results = array(); + $results = []; // we will also clear pseudoconstants here - should potentially be moved to relevant BAO classes CRM_Core_PseudoConstant::flush(); if (!empty($apiRequest['params']['fieldname'])) { CRM_Utils_PseudoConstant::flushConstant($apiRequest['params']['fieldname']); } if (!empty($apiRequest['params']['option_group_id'])) { - $optionGroupName = civicrm_api('option_group', 'getvalue', array( + $optionGroupName = civicrm_api('option_group', 'getvalue', [ 'version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name', - )); + ]); if (is_string($optionGroupName)) { CRM_Utils_PseudoConstant::flushConstant(_civicrm_api_get_camel_name($optionGroupName)); } @@ -79,8 +79,8 @@ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) { $subentity = CRM_Utils_Array::value('contact_type', $apiRequest['params']); $action = CRM_Utils_Array::value('action', $apiRequest['params']); $sequential = empty($apiRequest['params']['sequential']) ? 0 : 1; - $apiRequest['params']['options'] = CRM_Utils_Array::value('options', $apiRequest['params'], array()); - $optionsToResolve = (array) CRM_Utils_Array::value('get_options', $apiRequest['params']['options'], array()); + $apiRequest['params']['options'] = CRM_Utils_Array::value('options', $apiRequest['params'], []); + $optionsToResolve = (array) CRM_Utils_Array::value('get_options', $apiRequest['params']['options'], []); if (!$action || $action == 'getvalue' || $action == 'getcount') { $action = 'get'; @@ -110,7 +110,7 @@ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) { if (!empty($metadata[strtolower($apiRequest['entity']) . '_id'])) { $metadata['id'] = $metadata[$lowercase_entity . '_id']; unset($metadata[$lowercase_entity . '_id']); - $metadata['id']['api.aliases'] = array($lowercase_entity . '_id'); + $metadata['id']['api.aliases'] = [$lowercase_entity . '_id']; } } else { @@ -119,49 +119,49 @@ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) { // (note) or setting for all api where fields is returning 'id' & we want to accept 'note_id' @ the api layer // nb we don't officially accept note_id anyway - rationale here is more about centralising a now-tested // inconsistency - $metadata['id']['api.aliases'] = array($lowercase_entity . '_id'); + $metadata['id']['api.aliases'] = [$lowercase_entity . '_id']; } break; case 'delete': - $metadata = array( - 'id' => array( + $metadata = [ + 'id' => [ 'title' => $entity . ' ID', 'api.required' => 1, - 'api.aliases' => array($lowercase_entity . '_id'), + 'api.aliases' => [$lowercase_entity . '_id'], 'type' => CRM_Utils_Type::T_INT, - )); + ]]; break; // Note: adding setvalue case here instead of in a generic spec function because // some APIs override the generic setvalue fn which causes the generic spec to be overlooked. case 'setvalue': - $metadata = array( - 'field' => array( + $metadata = [ + 'field' => [ 'title' => 'Field name', 'api.required' => 1, 'type' => CRM_Utils_Type::T_STRING, - ), - 'id' => array( + ], + 'id' => [ 'title' => $entity . ' ID', 'api.required' => 1, 'type' => CRM_Utils_Type::T_INT, - ), - 'value' => array( + ], + 'value' => [ 'title' => 'Value', 'description' => "Field value to set", 'api.required' => 1, - ), - ); - if (array_intersect(array('all', 'field'), $optionsToResolve)) { - $options = civicrm_api3_generic_getfields(array('entity' => $entity, array('params' => array('action' => 'create')))); + ], + ]; + if (array_intersect(['all', 'field'], $optionsToResolve)) { + $options = civicrm_api3_generic_getfields(['entity' => $entity, ['params' => ['action' => 'create']]]); $metadata['field']['options'] = CRM_Utils_Array::collect('title', $options['values']); } break; default: // oddballs are on their own - $metadata = array(); + $metadata = []; } // Hack for product api to pass tests. @@ -171,7 +171,7 @@ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) { } // find any supplemental information - $hypApiRequest = array('entity' => $apiRequest['entity'], 'action' => $action, 'version' => $apiRequest['version']); + $hypApiRequest = ['entity' => $apiRequest['entity'], 'action' => $action, 'version' => $apiRequest['version']]; if ($action == 'getsingle') { $hypApiRequest['action'] = 'get'; } @@ -250,29 +250,29 @@ function civicrm_api3_generic_getfield($apiRequest) { * @throws \Exception */ function _civicrm_api3_generic_getfield_spec(&$params, $apiRequest) { - $params = array( - 'name' => array( + $params = [ + 'name' => [ 'title' => 'Field name', 'description' => 'Name or alias of field to lookup', 'api.required' => 1, 'type' => CRM_Utils_Type::T_STRING, - ), - 'action' => array( + ], + 'action' => [ 'title' => 'API Action', 'api.required' => 1, 'type' => CRM_Utils_Type::T_STRING, - 'api.aliases' => array('api_action'), - ), - 'get_options' => array( + 'api.aliases' => ['api_action'], + ], + 'get_options' => [ 'title' => 'Get Options', 'description' => 'Context for which to get field options, or null to skip fetching options.', 'type' => CRM_Utils_Type::T_STRING, 'options' => CRM_Core_DAO::buildOptionsContext(), - 'api.aliases' => array('context'), - ), - ); + 'api.aliases' => ['context'], + ], + ]; // Add available options to these params if requested - if (array_intersect(array('all', 'action'), $apiRequest['params']['options']['get_options'])) { + if (array_intersect(['all', 'action'], $apiRequest['params']['options']['get_options'])) { $actions = civicrm_api3($apiRequest['entity'], 'getactions'); $actions = array_combine($actions['values'], $actions['values']); // Let's not go meta-crazy @@ -323,7 +323,7 @@ function civicrm_api3_generic_getsingle($apiRequest) { return $result['values'][0]; } if ($result['count'] !== 1) { - return civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], array('count' => $result['count'])); + return civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], ['count' => $result['count']]); } return civicrm_api3_create_error("Undefined behavior"); } @@ -344,20 +344,20 @@ function civicrm_api3_generic_getvalue($apiRequest) { return $result; } if ($result['count'] !== 1) { - $result = civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], array('count' => $result['count'])); + $result = civicrm_api3_create_error("Expected one " . $apiRequest['entity'] . " but found " . $result['count'], ['count' => $result['count']]); return $result; } // we only take "return=" as valid options if (!empty($apiRequest['params']['return'])) { if (!isset($result['values'][0][$apiRequest['params']['return']])) { - return civicrm_api3_create_error("field " . $apiRequest['params']['return'] . " unset or not existing", array('invalid_field' => $apiRequest['params']['return'])); + return civicrm_api3_create_error("field " . $apiRequest['params']['return'] . " unset or not existing", ['invalid_field' => $apiRequest['params']['return']]); } return $result['values'][0][$apiRequest['params']['return']]; } - return civicrm_api3_create_error("missing param return=field you want to read the value of", array('error_type' => 'mandatory_missing', 'missing_param' => 'return')); + return civicrm_api3_create_error("missing param return=field you want to read the value of", ['error_type' => 'mandatory_missing', 'missing_param' => 'return']); } /** @@ -396,7 +396,7 @@ function civicrm_api3_generic_getrefcount($apiRequest) { return civicrm_api3_create_success($dao->getReferenceCounts()); } else { - return civicrm_api3_create_success(array()); + return civicrm_api3_create_success([]); } } @@ -452,23 +452,23 @@ function civicrm_api3_generic_getoptions($apiRequest) { * @param $apiRequest */ function _civicrm_api3_generic_getoptions_spec(&$params, $apiRequest) { - $params += array( - 'field' => array( + $params += [ + 'field' => [ 'title' => 'Field name', 'api.required' => 1, 'type' => CRM_Utils_Type::T_STRING, - ), - 'context' => array( + ], + 'context' => [ 'title' => 'Context', 'type' => CRM_Utils_Type::T_STRING, 'options' => CRM_Core_DAO::buildOptionsContext(), - ), - ); + ], + ]; // Add available fields if requested - if (array_intersect(array('all', 'field'), $apiRequest['params']['options']['get_options'])) { - $fields = civicrm_api3_generic_getfields(array('entity' => $apiRequest['entity'], array('params' => array('action' => 'create')))); - $params['field']['options'] = array(); + if (array_intersect(['all', 'field'], $apiRequest['params']['options']['get_options'])) { + $fields = civicrm_api3_generic_getfields(['entity' => $apiRequest['entity'], ['params' => ['action' => 'create']]]); + $params['field']['options'] = []; foreach ($fields['values'] as $name => $field) { if (isset($field['pseudoconstant']) || CRM_Utils_Array::value('type', $field) == CRM_Utils_Type::T_BOOLEAN) { $params['field']['options'][$name] = CRM_Utils_Array::value('title', $field, $name); @@ -527,7 +527,7 @@ function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fi } } - $options = civicrm_api($apiRequest['entity'], 'getoptions', array('version' => 3, 'field' => $fieldname, 'context' => $context)); + $options = civicrm_api($apiRequest['entity'], 'getoptions', ['version' => 3, 'field' => $fieldname, 'context' => $context]); if (is_array(CRM_Utils_Array::value('values', $options))) { $metadata[$fieldname]['options'] = $options['values']; } diff --git a/api/v3/Generic/Getactions.php b/api/v3/Generic/Getactions.php index 9502561c20..084f3365d5 100644 --- a/api/v3/Generic/Getactions.php +++ b/api/v3/Generic/Getactions.php @@ -38,7 +38,7 @@ * @throws API_Exception */ function civicrm_api3_generic_getActions($apiRequest) { - civicrm_api3_verify_mandatory($apiRequest, NULL, array('entity')); + civicrm_api3_verify_mandatory($apiRequest, NULL, ['entity']); $mfp = \Civi::service('magic_function_provider'); $actions = $mfp->getActionNames($apiRequest['version'], $apiRequest['entity']); return civicrm_api3_create_success($actions, $apiRequest['params'], $apiRequest['entity'], 'getactions'); diff --git a/api/v3/Generic/Getlist.php b/api/v3/Generic/Getlist.php index 1c9bd08af7..332438f44f 100644 --- a/api/v3/Generic/Getlist.php +++ b/api/v3/Generic/Getlist.php @@ -39,11 +39,11 @@ function civicrm_api3_generic_getList($apiRequest) { $entity = _civicrm_api_get_entity_name_from_camel($apiRequest['entity']); $request = $apiRequest['params']; - $meta = civicrm_api3_generic_getfields(array('action' => 'get') + $apiRequest, FALSE); + $meta = civicrm_api3_generic_getfields(['action' => 'get'] + $apiRequest, FALSE); // Hey api, would you like to provide default values? $fnName = "_civicrm_api3_{$entity}_getlist_defaults"; - $defaults = function_exists($fnName) ? $fnName($request) : array(); + $defaults = function_exists($fnName) ? $fnName($request) : []; _civicrm_api3_generic_getList_defaults($entity, $request, $defaults, $meta['values']); // Hey api, would you like to format the search params? @@ -61,7 +61,7 @@ function civicrm_api3_generic_getList($apiRequest) { _civicrm_api3_generic_getlist_postprocess($result, $request, $values); - $output = array('page_num' => $request['page_num']); + $output = ['page_num' => $request['page_num']]; // Limit is set for searching but not fetching by id if (!empty($request['params']['options']['limit'])) { @@ -83,26 +83,26 @@ function civicrm_api3_generic_getList($apiRequest) { * @param array $fields */ function _civicrm_api3_generic_getList_defaults($entity, &$request, $apiDefaults, $fields) { - $defaults = array( + $defaults = [ 'page_num' => 1, 'input' => '', 'image_field' => NULL, 'color_field' => isset($fields['color']) ? 'color' : NULL, 'id_field' => $entity == 'option_value' ? 'value' : 'id', - 'description_field' => array(), + 'description_field' => [], 'add_wildcard' => Civi::settings()->get('includeWildCardInName'), - 'params' => array(), - 'extra' => array(), - ); + 'params' => [], + 'extra' => [], + ]; // Find main field from meta - foreach (array('sort_name', 'title', 'label', 'name', 'subject') as $field) { + foreach (['sort_name', 'title', 'label', 'name', 'subject'] as $field) { if (isset($fields[$field])) { $defaults['label_field'] = $defaults['search_field'] = $field; break; } } // Find fields to be used for the description - foreach (array('description') as $field) { + foreach (['description'] as $field) { if (isset($fields[$field])) { $defaults['description_field'][] = $field; } @@ -113,13 +113,13 @@ function _civicrm_api3_generic_getList_defaults($entity, &$request, $apiDefaults } $request += $apiDefaults + $defaults; // Default api params - $params = array( + $params = [ 'sequential' => 1, - 'options' => array(), - ); + 'options' => [], + ]; // When searching e.g. autocomplete if ($request['input']) { - $params[$request['search_field']] = array('LIKE' => ($request['add_wildcard'] ? '%' : '') . $request['input'] . '%'); + $params[$request['search_field']] = ['LIKE' => ($request['add_wildcard'] ? '%' : '') . $request['input'] . '%']; } // When looking up a field e.g. displaying existing record if (!empty($request['id'])) { @@ -129,18 +129,18 @@ function _civicrm_api3_generic_getList_defaults($entity, &$request, $apiDefaults // Don't run into search limits when prefilling selection $params['options']['limit'] = NULL; unset($params['options']['offset'], $request['params']['options']['limit'], $request['params']['options']['offset']); - $params[$request['id_field']] = is_array($request['id']) ? array('IN' => $request['id']) : $request['id']; + $params[$request['id_field']] = is_array($request['id']) ? ['IN' => $request['id']] : $request['id']; } $request['params'] += $params; - $request['params']['options'] += array( + $request['params']['options'] += [ // Add pagination parameters 'sort' => $request['label_field'], // Adding one extra result allows us to see if there are any more 'limit' => $resultsPerPage + 1, // Because sql is zero-based 'offset' => ($request['page_num'] - 1) * $resultsPerPage, - ); + ]; } /** @@ -149,7 +149,7 @@ function _civicrm_api3_generic_getList_defaults($entity, &$request, $apiDefaults * @param array $request */ function _civicrm_api3_generic_getlist_params(&$request) { - $fieldsToReturn = array($request['id_field'], $request['label_field']); + $fieldsToReturn = [$request['id_field'], $request['label_field']]; if (!empty($request['image_field'])) { $fieldsToReturn[] = $request['image_field']; } @@ -173,15 +173,15 @@ function _civicrm_api3_generic_getlist_params(&$request) { * @return array */ function _civicrm_api3_generic_getlist_output($result, $request, $entity, $fields) { - $output = array(); + $output = []; if (!empty($result['values'])) { foreach ($result['values'] as $row) { - $data = array( + $data = [ 'id' => $row[$request['id_field']], 'label' => $row[$request['label_field']], - ); + ]; if (!empty($request['description_field'])) { - $data['description'] = array(); + $data['description'] = []; foreach ((array) $request['description_field'] as $field) { if (!empty($row[$field])) { if (!isset($fields[$field]['pseudoconstant'])) { @@ -217,7 +217,7 @@ function _civicrm_api3_generic_getlist_output($result, $request, $entity, $field * @param $values */ function _civicrm_api3_generic_getlist_postprocess($result, $request, &$values) { - $chains = array(); + $chains = []; foreach ($request['params'] as $field => $param) { if (substr($field, 0, 4) === 'api.') { $chains[] = $field; @@ -242,49 +242,49 @@ function _civicrm_api3_generic_getlist_postprocess($result, $request, &$values) * @param array $apiRequest */ function _civicrm_api3_generic_getlist_spec(&$params, $apiRequest) { - $params += array( - 'page_num' => array( + $params += [ + 'page_num' => [ 'title' => 'Page Number', 'description' => "Current page of a multi-page lookup", 'type' => CRM_Utils_Type::T_INT, - ), - 'input' => array( + ], + 'input' => [ 'title' => 'Search Input', 'description' => "String to search on", 'type' => CRM_Utils_Type::T_TEXT, - ), - 'params' => array( + ], + 'params' => [ 'title' => 'API Params', 'description' => "Additional filters to send to the {$apiRequest['entity']} API.", - ), - 'extra' => array( + ], + 'extra' => [ 'title' => 'Extra', 'description' => 'Array of additional fields to return.', - ), - 'image_field' => array( + ], + 'image_field' => [ 'title' => 'Image Field', 'description' => "Field that this entity uses to store icons (usually automatic)", 'type' => CRM_Utils_Type::T_TEXT, - ), - 'id_field' => array( + ], + 'id_field' => [ 'title' => 'ID Field', 'description' => "Field that uniquely identifies this entity (usually automatic)", 'type' => CRM_Utils_Type::T_TEXT, - ), - 'description_field' => array( + ], + 'description_field' => [ 'title' => 'Description Field', 'description' => "Field that this entity uses to store summary text (usually automatic)", 'type' => CRM_Utils_Type::T_TEXT, - ), - 'label_field' => array( + ], + 'label_field' => [ 'title' => 'Label Field', 'description' => "Field to display as title of results (usually automatic)", 'type' => CRM_Utils_Type::T_TEXT, - ), - 'search_field' => array( + ], + 'search_field' => [ 'title' => 'Search Field', 'description' => "Field to search on (assumed to be the same as label field unless otherwise specified)", 'type' => CRM_Utils_Type::T_TEXT, - ), - ); + ], + ]; } diff --git a/api/v3/Generic/Getunique.php b/api/v3/Generic/Getunique.php index 23eed7dfce..56c83a89e7 100644 --- a/api/v3/Generic/Getunique.php +++ b/api/v3/Generic/Getunique.php @@ -38,7 +38,7 @@ */ function civicrm_api3_generic_getunique($apiRequest) { $entity = _civicrm_api_get_entity_name_from_camel($apiRequest['entity']); - $uniqueFields = array(); + $uniqueFields = []; $dao = _civicrm_api3_get_DAO($entity); $uFields = $dao::indices(); diff --git a/api/v3/Generic/Setvalue.php b/api/v3/Generic/Setvalue.php index d6aecd798e..b04b1242e3 100644 --- a/api/v3/Generic/Setvalue.php +++ b/api/v3/Generic/Setvalue.php @@ -45,19 +45,19 @@ function civicrm_api3_generic_setValue($apiRequest) { $params = $apiRequest['params']; $id = $params['id']; if (!is_numeric($id)) { - return civicrm_api3_create_error(ts('Please enter a number'), array( + return civicrm_api3_create_error(ts('Please enter a number'), [ 'error_code' => 'NaN', 'field' => "id", - )); + ]); } $field = CRM_Utils_String::munge($params['field']); $value = $params['value']; - $fields = civicrm_api($entity, 'getFields', array( + $fields = civicrm_api($entity, 'getFields', [ 'version' => 3, 'action' => 'create', - "sequential") + "sequential"] ); // getfields error, shouldn't happen. if ($fields['is_error']) { @@ -69,7 +69,7 @@ function civicrm_api3_generic_setValue($apiRequest) { // Trim off the id portion of a multivalued custom field name $fieldKey = $isCustom && substr_count($field, '_') > 1 ? rtrim(rtrim($field, '1234567890'), '_') : $field; if (!array_key_exists($fieldKey, $fields)) { - return civicrm_api3_create_error("Param 'field' ($field) is invalid. must be an existing field", array("error_code" => "invalid_field", "fields" => array_keys($fields))); + return civicrm_api3_create_error("Param 'field' ($field) is invalid. must be an existing field", ["error_code" => "invalid_field", "fields" => array_keys($fields)]); } $def = $fields[$fieldKey]; @@ -78,27 +78,27 @@ function civicrm_api3_generic_setValue($apiRequest) { // TODO: create a utility for this since it's needed in many places if (!empty($def['required']) || !empty($def['is_required'])) { if ((empty($value) || $value === 'null') && $value !== '0' && $value !== 0) { - return civicrm_api3_create_error(ts('%1 is a required field.', array(1 => $title)), array("error_code" => "required", "field" => $field)); + return civicrm_api3_create_error(ts('%1 is a required field.', [1 => $title]), ["error_code" => "required", "field" => $field]); } } switch ($def['type']) { case CRM_Utils_Type::T_FLOAT: if (!is_numeric($value) && !empty($value) && $value !== 'null') { - return civicrm_api3_create_error(ts('%1 must be a number.', array(1 => $title)), array('error_code' => 'NaN')); + return civicrm_api3_create_error(ts('%1 must be a number.', [1 => $title]), ['error_code' => 'NaN']); } break; case CRM_Utils_Type::T_INT: if (!CRM_Utils_Rule::integer($value) && !empty($value) && $value !== 'null') { - return civicrm_api3_create_error(ts('%1 must be a number.', array(1 => $title)), array('error_code' => 'NaN')); + return civicrm_api3_create_error(ts('%1 must be a number.', [1 => $title]), ['error_code' => 'NaN']); } break; case CRM_Utils_Type::T_STRING: case CRM_Utils_Type::T_TEXT: if (!CRM_Utils_Rule::xssString($value)) { - return civicrm_api3_create_error(ts('Illegal characters in input (potential scripting attack)'), array('error_code' => 'XSS')); + return civicrm_api3_create_error(ts('Illegal characters in input (potential scripting attack)'), ['error_code' => 'XSS']); } if (array_key_exists('maxlength', $def)) { $value = substr($value, 0, $def['maxlength']); @@ -123,11 +123,11 @@ function civicrm_api3_generic_setValue($apiRequest) { break; default: - return civicrm_api3_create_error("Param '$field' is of a type not managed yet (" . $def['type'] . "). Join the API team and help us implement it", array('error_code' => 'NOT_IMPLEMENTED')); + return civicrm_api3_create_error("Param '$field' is of a type not managed yet (" . $def['type'] . "). Join the API team and help us implement it", ['error_code' => 'NOT_IMPLEMENTED']); } $dao_name = _civicrm_api3_get_DAO($entity); - $params = array('id' => $id, $field => $value); + $params = ['id' => $id, $field => $value]; if ((!empty($def['pseudoconstant']) || !empty($def['option_group_id'])) && $value !== '' && $value !== 'null') { _civicrm_api3_api_match_pseudoconstant($params[$field], $entity, $field, $def); diff --git a/api/v3/Generic/Update.php b/api/v3/Generic/Update.php index 0ba2aafb29..0fea3ac472 100644 --- a/api/v3/Generic/Update.php +++ b/api/v3/Generic/Update.php @@ -64,7 +64,7 @@ function civicrm_api3_generic_update($apiRequest) { if (strtolower($apiRequest['entity']) == 'contribution') { return civicrm_api($apiRequest['entity'], 'create', $apiRequest['params']); } - $seek = array($key_id => $apiRequest['params'][$key_id], 'version' => $apiRequest['version']); + $seek = [$key_id => $apiRequest['params'][$key_id], 'version' => $apiRequest['version']]; $existing = civicrm_api($apiRequest['entity'], 'get', $seek); if ($existing['is_error']) { return $existing; diff --git a/api/v3/Grant.php b/api/v3/Grant.php index 32a5fa4a97..ad000b7004 100644 --- a/api/v3/Grant.php +++ b/api/v3/Grant.php @@ -58,7 +58,7 @@ function _civicrm_api3_grant_create_spec(&$params) { $params['grant_type_id']['api.required'] = 1; $params['status_id']['api.required'] = 1; $params['amount_total']['api.required'] = 1; - $params['status_id']['api.aliases'] = array('grant_status'); + $params['status_id']['api.aliases'] = ['grant_status']; } /** diff --git a/api/v3/Group.php b/api/v3/Group.php index 8b97db785e..6b9dba3ea3 100644 --- a/api/v3/Group.php +++ b/api/v3/Group.php @@ -98,7 +98,7 @@ function civicrm_api3_group_get($params) { * @throws API_Exception */ function civicrm_api3_group_delete($params) { - $group = civicrm_api3_group_get(array('id' => $params['id'])); + $group = civicrm_api3_group_get(['id' => $params['id']]); if ($group['count'] == 0) { throw new API_Exception('Could not delete group ' . $params['id']); } diff --git a/api/v3/GroupContact.php b/api/v3/GroupContact.php index 3b8aba1492..e36fed2e5a 100644 --- a/api/v3/GroupContact.php +++ b/api/v3/GroupContact.php @@ -125,7 +125,7 @@ function _civicrm_api3_group_contact_create_spec(&$params) { function civicrm_api3_group_contact_create($params) { // Nonstandard bao - doesn't accept ID as a param, so convert id to group_id + contact_id if (!empty($params['id'])) { - $getParams = array('id' => $params['id']); + $getParams = ['id' => $params['id']]; $info = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $getParams); if (!empty($info['values'][$params['id']])) { $params['group_id'] = $info['values'][$params['id']]['group_id']; @@ -147,18 +147,18 @@ function civicrm_api3_group_contact_create($params) { */ function civicrm_api3_group_contact_delete($params) { $checkParams = $params; - if (!empty($checkParams['status']) && in_array($checkParams['status'], array('Removed', 'Deleted'))) { - $checkParams['status'] = array('IN' => array('Added', 'Pending')); + if (!empty($checkParams['status']) && in_array($checkParams['status'], ['Removed', 'Deleted'])) { + $checkParams['status'] = ['IN' => ['Added', 'Pending']]; } elseif (!empty($checkParams['status']) && $checkParams['status'] == 'Added') { - $checkParams['status'] = array('IN' => array('Pending', 'Removed')); + $checkParams['status'] = ['IN' => ['Pending', 'Removed']]; } elseif (!empty($checkParams['status'])) { unset($checkParams['status']); } $groupContact = civicrm_api3('GroupContact', 'get', $checkParams); if ($groupContact['count'] == 0 && !empty($params['skip_undelete'])) { - $checkParams['status'] = array('IN' => array('Removed', 'Pending')); + $checkParams['status'] = ['IN' => ['Removed', 'Pending']]; } $groupContact2 = civicrm_api3('GroupContact', 'get', $checkParams); if ($groupContact['count'] == 0 && $groupContact2['count'] == 0) { @@ -205,8 +205,8 @@ function civicrm_api3_group_contact_pending($params) { */ function _civicrm_api3_group_contact_common($params, $op = 'Added') { - $contactIDs = array(); - $groupIDs = array(); + $contactIDs = []; + $groupIDs = []; // CRM-16959: Handle multiple Contact IDs and Group IDs in legacy format // (contact_id.1, contact_id.2) or as an array @@ -238,11 +238,11 @@ function _civicrm_api3_group_contact_common($params, $op = 'Added') { $tracking = CRM_Utils_Array::value('tracking', $params); if ($op == 'Added' || $op == 'Pending') { - $extraReturnValues = array( + $extraReturnValues = [ 'total_count' => 0, 'added' => 0, 'not_added' => 0, - ); + ]; foreach ($groupIDs as $groupID) { list($tc, $a, $na) = CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIDs, $groupID, @@ -256,11 +256,11 @@ function _civicrm_api3_group_contact_common($params, $op = 'Added') { } } else { - $extraReturnValues = array( + $extraReturnValues = [ 'total_count' => 0, 'removed' => 0, 'not_removed' => 0, - ); + ]; foreach ($groupIDs as $groupID) { list($tc, $r, $nr) = CRM_Contact_BAO_GroupContact::removeContactsFromGroup($contactIDs, $groupID, $method, $status, $tracking); $extraReturnValues['total_count'] += $tc; @@ -285,10 +285,10 @@ function _civicrm_api3_group_contact_common($params, $op = 'Added') { */ function civicrm_api3_group_contact_update_status($params) { - civicrm_api3_verify_mandatory($params, NULL, array('contact_id', 'group_id')); + civicrm_api3_verify_mandatory($params, NULL, ['contact_id', 'group_id']); CRM_Contact_BAO_GroupContact::addContactsToGroup( - array($params['contact_id']), + [$params['contact_id']], $params['group_id'], CRM_Utils_Array::value('method', $params, 'API'), 'Added', @@ -306,9 +306,9 @@ function civicrm_api3_group_contact_update_status($params) { * Array of deprecated actions */ function _civicrm_api3_group_contact_deprecation() { - return array( + return [ 'delete' => 'GroupContact "delete" action is deprecated in favor of "create".', 'pending' => 'GroupContact "pending" action is deprecated in favor of "create".', 'update_status' => 'GroupContact "update_status" action is deprecated in favor of "create".', - ); + ]; } diff --git a/api/v3/Job.php b/api/v3/Job.php index dd4a4a5c26..0c28926fe3 100644 --- a/api/v3/Job.php +++ b/api/v3/Job.php @@ -93,7 +93,7 @@ function civicrm_api3_job_clone($params) { $params['last_run'] = 'null'; $params['scheduled_run_date'] = 'null'; $newJobDAO = CRM_Core_BAO_Job::copy($id, $params); - return civicrm_api3('Job', 'get', array('id' => $newJobDAO->id)); + return civicrm_api3('Job', 'get', ['id' => $newJobDAO->id]); } /** @@ -174,27 +174,27 @@ function civicrm_api3_job_geocode($params) { * @param array $params */ function _civicrm_api3_job_geocode_spec(&$params) { - $params['start'] = array( + $params['start'] = [ 'title' => 'Starting Contact ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['end'] = array( + ]; + $params['end'] = [ 'title' => 'Ending Contact ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['geocoding'] = array( + ]; + $params['geocoding'] = [ 'title' => 'Geocode address?', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['parse'] = array( + ]; + $params['parse'] = [ 'title' => 'Parse street address?', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['throttle'] = array( + ]; + $params['throttle'] = [ 'title' => 'Throttle?', 'description' => 'If enabled, geo-codes at a slow rate', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } /** @@ -239,10 +239,10 @@ function civicrm_api3_job_send_reminder($params) { function _civicrm_api3_job_send_reminder(&$params) { //@todo this function will now take all fields in action_schedule as params // as it is calling the api fn to set the filters - update getfields to reflect - $params['id'] = array( + $params['id'] = [ 'type' => CRM_Utils_Type::T_INT, 'title' => 'Action Schedule ID', - ); + ]; } /** * Execute a specific report instance and send the output via email. @@ -306,16 +306,16 @@ function civicrm_api3_job_update_greeting($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_job_update_greeting_spec(&$params) { - $params['ct'] = array( + $params['ct'] = [ 'api.required' => 1, 'title' => 'Contact Type', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['gt'] = array( + ]; + $params['gt'] = [ 'api.required' => 1, 'title' => 'Greeting Type', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; } /** @@ -360,9 +360,9 @@ function civicrm_api3_job_process_mailing($params) { return civicrm_api3_create_error('Process Queue failed'); } else { - $values = array( + $values = [ 'processed' => CRM_Mailing_BAO_MailingJob::$mailsProcessed - $mailsProcessedOrig, - ); + ]; return civicrm_api3_create_success($values, $params, 'Job', 'process_mailing'); } } @@ -381,9 +381,9 @@ function civicrm_api3_job_process_sms($params) { return civicrm_api3_create_error('Process Queue failed'); } else { - $values = array( + $values = [ 'processed' => CRM_Mailing_BAO_MailingJob::$mailsProcessed - $mailsProcessedOrig, - ); + ]; return civicrm_api3_create_success($values, $params, 'Job', 'process_sms'); } } @@ -412,11 +412,11 @@ function civicrm_api3_job_fetch_bounces($params) { * @param array $params */ function _civicrm_api3_job_fetch_bounces_spec(&$params) { - $params['is_create_activities'] = array( + $params['is_create_activities'] = [ 'api.default' => 0, 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Create activities for replies?'), - ); + ]; } /** @@ -434,7 +434,7 @@ function civicrm_api3_job_fetch_activities($params) { try { CRM_Utils_Mail_EmailProcessor::processActivities(); - $values = array(); + $values = []; $lock->release(); return civicrm_api3_create_success($values, $params, 'Job', 'fetch_activities'); } @@ -529,18 +529,18 @@ function civicrm_api3_job_process_respondent($params) { function civicrm_api3_job_process_batch_merge($params) { $rule_group_id = CRM_Utils_Array::value('rule_group_id', $params); if (!$rule_group_id) { - $rule_group_id = civicrm_api3('RuleGroup', 'getvalue', array( + $rule_group_id = civicrm_api3('RuleGroup', 'getvalue', [ 'contact_type' => 'Individual', 'used' => 'Unsupervised', 'return' => 'id', - 'options' => array('limit' => 1), - )); + 'options' => ['limit' => 1], + ]); } $rgid = CRM_Utils_Array::value('rgid', $params); $gid = CRM_Utils_Array::value('gid', $params); $mode = CRM_Utils_Array::value('mode', $params, 'safe'); - $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, array()), CRM_Utils_Array::value('check_permissions', $params)); + $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, []), CRM_Utils_Array::value('check_permissions', $params)); return civicrm_api3_create_success($result, $params); } @@ -551,25 +551,25 @@ function civicrm_api3_job_process_batch_merge($params) { * @param $params */ function _civicrm_api3_job_process_batch_merge_spec(&$params) { - $params['rule_group_id'] = array( + $params['rule_group_id'] = [ 'title' => 'Dedupe rule group id, defaults to Contact Unsupervised rule', 'type' => CRM_Utils_Type::T_INT, - 'api.aliases' => array('rgid'), - ); - $params['gid'] = array( + 'api.aliases' => ['rgid'], + ]; + $params['gid'] = [ 'title' => 'group id', 'type' => CRM_Utils_Type::T_INT, - ); - $params['mode'] = array( + ]; + $params['mode'] = [ 'title' => 'Mode', 'description' => 'helps decide how to behave when there are conflicts. A \'safe\' value skips the merge if there are no conflicts. Does a force merge otherwise.', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['auto_flip'] = array( + ]; + $params['auto_flip'] = [ 'title' => 'Auto Flip', 'description' => 'let the api decide which contact to retain and which to delete?', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } /** @@ -589,9 +589,9 @@ function civicrm_api3_job_run_payment_cron($params) { 'PaymentCron', array_merge( $params, - array( + [ 'caller' => 'api', - ) + ] ) ); @@ -600,9 +600,9 @@ function civicrm_api3_job_run_payment_cron($params) { 'PaymentCron', array_merge( $params, - array( + [ 'mode' => 'test', - ) + ] ) ); } diff --git a/api/v3/LocBlock.php b/api/v3/LocBlock.php index f1a64ad47b..5f9b1ce9e4 100644 --- a/api/v3/LocBlock.php +++ b/api/v3/LocBlock.php @@ -43,8 +43,8 @@ * @throws \API_Exception */ function civicrm_api3_loc_block_create($params) { - $entities = array(); - $any_mandatory = array( + $entities = []; + $any_mandatory = [ 'address', 'address_id', 'phone', @@ -53,14 +53,14 @@ function civicrm_api3_loc_block_create($params) { 'im_id', 'email', 'email_id', - ); + ]; civicrm_api3_verify_one_mandatory($params, NULL, $any_mandatory); // Call the appropriate api to create entities if any are passed in the params. // This is basically chaining but in reverse - we create the sub-entities first // because chaining does not work in reverse, or with keys like 'email_2'. - $items = array('address', 'email', 'phone', 'im'); + $items = ['address', 'email', 'phone', 'im']; foreach ($items as $item) { - foreach (array('', '_2') as $suf) { + foreach (['', '_2'] as $suf) { $key = $item . $suf; if (!empty($params[$key]) && is_array($params[$key])) { $info = $params[$key]; @@ -82,7 +82,7 @@ function civicrm_api3_loc_block_create($params) { $dao->copyValues($params); $dao->save(); if (!empty($dao->id)) { - $values = array($dao->id => $entities); + $values = [$dao->id => $entities]; _civicrm_api3_object_to_array($dao, $values[$dao->id]); return civicrm_api3_create_success($values, $params, 'LocBlock', 'create', $dao); } @@ -105,15 +105,15 @@ function civicrm_api3_loc_block_get($params) { // This is a helper because api chaining does not work with a key like 'email_2'. if (!empty($options['return'])) { unset($params['return']); - $values = array(); - $items = array('address', 'email', 'phone', 'im'); + $values = []; + $items = ['address', 'email', 'phone', 'im']; $returnAll = !empty($options['return']['all']); foreach (_civicrm_api3_basic_get('CRM_Core_DAO_LocBlock', $params, FALSE) as $val) { foreach ($items as $item) { - foreach (array('', '_2') as $suf) { + foreach (['', '_2'] as $suf) { $key = $item . $suf; if (!empty($val[$key . '_id']) && ($returnAll || !empty($options['return'][$key]))) { - $val[$key] = civicrm_api($item, 'getsingle', array('version' => 3, 'id' => $val[$key . '_id'])); + $val[$key] = civicrm_api($item, 'getsingle', ['version' => 3, 'id' => $val[$key . '_id']]); } } } diff --git a/api/v3/Logging.php b/api/v3/Logging.php index fb747abf40..22ebe9bd39 100644 --- a/api/v3/Logging.php +++ b/api/v3/Logging.php @@ -59,27 +59,27 @@ function civicrm_api3_logging_revert($params) { * @throws \Civi\API\Exception\UnauthorizedException */ function _civicrm_api3_logging_revert_spec(&$params) { - $params['log_conn_id'] = array( + $params['log_conn_id'] = [ 'title' => 'Logging Connection ID', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => TRUE, - ); - $params['log_date'] = array( + ]; + $params['log_date'] = [ 'title' => 'Logging Timestamp', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - ); - $params['interval'] = array( + ]; + $params['interval'] = [ 'title' => ts('Interval (required if date is included)'), 'type' => CRM_Utils_Type::T_STRING, 'api.default' => '10 SECOND', 'description' => ts('Used when log_date is passed in'), - ); + ]; - $params['tables'] = array( + $params['tables'] = [ 'title' => ts('Tables to revert'), 'type' => CRM_Utils_Type::T_STRING, 'description' => ts('Tables to revert, if not set all contact-referring entities will be reverted'), - ); + ]; } /** @@ -109,24 +109,24 @@ function civicrm_api3_logging_get($params) { * @throws \Civi\API\Exception\UnauthorizedException */ function _civicrm_api3_logging_get_spec(&$params) { - $params['log_conn_id'] = array( + $params['log_conn_id'] = [ 'title' => 'Logging Connection ID', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => TRUE, - ); - $params['log_date'] = array( + ]; + $params['log_date'] = [ 'title' => 'Logging Timestamp', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - ); - $params['interval'] = array( + ]; + $params['interval'] = [ 'title' => ts('Interval (required if date is included)'), 'type' => CRM_Utils_Type::T_STRING, 'api.default' => '10 SECOND', 'description' => ts('Used when log_date is passed in'), - ); - $params['tables'] = array( + ]; + $params['tables'] = [ 'title' => ts('Tables to query'), 'type' => CRM_Utils_Type::T_STRING, 'description' => ts('Tables to query, if not set all contact-referring entities will be queried'), - ); + ]; } diff --git a/api/v3/Mailing.php b/api/v3/Mailing.php index c0956ef13e..38ebc4161e 100644 --- a/api/v3/Mailing.php +++ b/api/v3/Mailing.php @@ -44,7 +44,7 @@ */ function civicrm_api3_mailing_create($params) { if (isset($params['template_options']) && is_array($params['template_options'])) { - $params['template_options'] = ($params['template_options'] === array()) ? '{}' : json_encode($params['template_options']); + $params['template_options'] = ($params['template_options'] === []) ? '{}' : json_encode($params['template_options']); } if (CRM_Mailing_Info::workflowEnabled()) { // Note: 'schedule mailings' and 'approve mailings' can update certain fields, but can't create. @@ -55,7 +55,7 @@ function civicrm_api3_mailing_create($params) { } } - $safeParams = array(); + $safeParams = []; $fieldPerms = CRM_Mailing_BAO_Mailing::getWorkflowFieldPerms(); foreach (array_keys($params) as $field) { if (CRM_Core_Permission::check($fieldPerms[$field])) { @@ -94,7 +94,7 @@ function civicrm_api3_mailing_create($params) { * @throws \API_Exception */ function civicrm_api3_mailing_gettokens($params) { - $tokens = array(); + $tokens = []; foreach ((array) $params['entity'] as $ent) { $func = lcfirst($ent) . 'Tokens'; if (!method_exists('CRM_Core_SelectValues', $func)) { @@ -117,13 +117,13 @@ function civicrm_api3_mailing_gettokens($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_mailing_gettokens_spec(&$params) { - $params['entity'] = array( - 'api.default' => array('contact'), + $params['entity'] = [ + 'api.default' => ['contact'], 'api.required' => 1, 'api.multiple' => 1, 'title' => 'Entity', - 'options' => array(), - ); + 'options' => [], + ]; // Fetch a list of token functions and format to look like entity names foreach (get_class_methods('CRM_Core_SelectValues') as $func) { if (strpos($func, 'Tokens')) { @@ -189,7 +189,7 @@ function _civicrm_api3_mailing_clone_spec(&$spec) { * @throws \CiviCRM_API3_Exception */ function civicrm_api3_mailing_clone($params) { - $BLACKLIST = array( + $BLACKLIST = [ 'id', 'is_completed', 'created_id', @@ -203,16 +203,16 @@ function civicrm_api3_mailing_clone($params) { 'is_archived', 'hash', 'mailing_type', - ); + ]; - $get = civicrm_api3('Mailing', 'getsingle', array('id' => $params['id'])); + $get = civicrm_api3('Mailing', 'getsingle', ['id' => $params['id']]); - $newParams = array(); + $newParams = []; $newParams['debug'] = CRM_Utils_Array::value('debug', $params); - $newParams['groups']['include'] = array(); - $newParams['groups']['exclude'] = array(); - $newParams['mailings']['include'] = array(); - $newParams['mailings']['exclude'] = array(); + $newParams['groups']['include'] = []; + $newParams['groups']['exclude'] = []; + $newParams['mailings']['include'] = []; + $newParams['mailings']['exclude'] = []; foreach ($get as $field => $value) { if (!in_array($field, $BLACKLIST)) { $newParams[$field] = $value; @@ -298,7 +298,7 @@ function _civicrm_api3_mailing_submit_spec(&$spec) { * @throws API_Exception */ function civicrm_api3_mailing_submit($params) { - civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_Mailing', array('id')); + civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_Mailing', ['id']); if (!isset($params['scheduled_date']) && !isset($updateParams['approval_date'])) { throw new API_Exception("Missing parameter scheduled_date and/or approval_date"); @@ -307,7 +307,7 @@ function civicrm_api3_mailing_submit($params) { throw new API_Exception("Failed to determine current user"); } - $updateParams = array(); + $updateParams = []; $updateParams['id'] = $params['id']; // Note: we'll pass along scheduling/approval fields, but they may get ignored @@ -394,7 +394,7 @@ function civicrm_api3_mailing_event_confirm($params) { * Array of deprecated actions */ function _civicrm_api3_mailing_deprecation() { - return array('event_confirm' => 'Mailing api "event_confirm" action is deprecated. Use the mailing_event_confirm api instead.'); + return ['event_confirm' => 'Mailing api "event_confirm" action is deprecated. Use the mailing_event_confirm api instead.']; } /** @@ -496,7 +496,7 @@ function _civicrm_api3_mailing_event_forward_spec(&$params) { function civicrm_api3_mailing_event_click($params) { civicrm_api3_verify_mandatory($params, 'CRM_Mailing_Event_DAO_TrackableURLOpen', - array('event_queue_id', 'url_id'), + ['event_queue_id', 'url_id'], FALSE ); @@ -505,7 +505,7 @@ function civicrm_api3_mailing_event_click($params) { $url = CRM_Mailing_Event_BAO_TrackableURLOpen::track($queue, $url_id); - $values = array(); + $values = []; $values['url'] = $url; $values['is_error'] = 0; @@ -523,7 +523,7 @@ function civicrm_api3_mailing_event_open($params) { civicrm_api3_verify_mandatory($params, 'CRM_Mailing_Event_DAO_Opened', - array('event_queue_id'), + ['event_queue_id'], FALSE ); @@ -574,7 +574,7 @@ function civicrm_api3_mailing_preview($params) { if (!$contactID) { $contactID = $session->get('userID'); } - $mailingParams = array('contact_id' => $contactID); + $mailingParams = ['contact_id' => $contactID]; $details = CRM_Utils_Token::getTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens()); @@ -582,13 +582,13 @@ function civicrm_api3_mailing_preview($params) { TRUE, $details[0][$contactID], $attachments ); - return civicrm_api3_create_success(array( + return civicrm_api3_create_success([ 'id' => $params['id'], 'contact_id' => $contactID, 'subject' => $mime->headers()['Subject'], 'body_html' => $mime->getHTMLBody(), 'body_text' => $mime->getTXTBody(), - )); + ]); } /** @@ -618,7 +618,7 @@ function civicrm_api3_mailing_send_test($params) { } civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingJob', - array('mailing_id'), + ['mailing_id'], FALSE ); @@ -635,25 +635,25 @@ function civicrm_api3_mailing_send_test($params) { $testEmailParams['emails'] = array_key_exists('test_email', $testEmailParams) ? explode(',', strtolower($testEmailParams['test_email'])) : NULL; if (!empty($params['test_email'])) { $query = CRM_Utils_SQL_Select::from('civicrm_email e') - ->select(array('e.id', 'e.contact_id', 'e.email')) + ->select(['e.id', 'e.contact_id', 'e.email']) ->join('c', 'INNER JOIN civicrm_contact c ON e.contact_id = c.id') - ->where('e.email IN (@emails)', array('@emails' => $testEmailParams['emails'])) + ->where('e.email IN (@emails)', ['@emails' => $testEmailParams['emails']]) ->where('e.on_hold = 0') ->where('c.is_opt_out = 0') ->where('c.do_not_email = 0') ->where('c.is_deceased = 0') ->where('c.is_deleted = 0') ->groupBy('e.id') - ->orderBy(array('e.is_bulkmail DESC', 'e.is_primary DESC')) + ->orderBy(['e.is_bulkmail DESC', 'e.is_primary DESC']) ->toSQL(); $dao = CRM_Core_DAO::executeQuery($query); - $emailDetail = array(); + $emailDetail = []; // fetch contact_id and email id for all existing emails while ($dao->fetch()) { - $emailDetail[strtolower($dao->email)] = array( + $emailDetail[strtolower($dao->email)] = [ 'contact_id' => $dao->contact_id, 'email_id' => $dao->id, - ); + ]; } foreach ($testEmailParams['emails'] as $key => $email) { $email = trim($email); @@ -665,21 +665,21 @@ function civicrm_api3_mailing_send_test($params) { if (!$contactId) { //create new contact. $contact = civicrm_api3('Contact', 'create', - array( + [ 'contact_type' => 'Individual', 'email' => $email, - 'api.Email.get' => array('return' => 'id'), - ) + 'api.Email.get' => ['return' => 'id'], + ] ); $contactId = $contact['id']; $emailId = $contact['values'][$contactId]['api.Email.get']['id']; } civicrm_api3('MailingEventQueue', 'create', - array( + [ 'job_id' => $job['id'], 'email_id' => $emailId, 'contact_id' => $contactId, - ) + ] ); } } @@ -726,7 +726,7 @@ function _civicrm_api3_mailing_stats_spec(&$params) { function civicrm_api3_mailing_stats($params) { civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingJob', - array('mailing_id'), + ['mailing_id'], FALSE ); @@ -737,40 +737,40 @@ function civicrm_api3_mailing_stats($params) { $params['date'] = CRM_Utils_Date::processDate($params['date'] . ' ' . $params['date_time']); } - $stats[$params['mailing_id']] = array(); + $stats[$params['mailing_id']] = []; if (empty($params['job_id'])) { $params['job_id'] = NULL; } - foreach (array('Delivered', 'Bounces', 'Unsubscribers', 'Unique Clicks', 'Opened') as $detail) { + foreach (['Delivered', 'Bounces', 'Unsubscribers', 'Unique Clicks', 'Opened'] as $detail) { switch ($detail) { case 'Delivered': - $stats[$params['mailing_id']] += array( + $stats[$params['mailing_id']] += [ $detail => CRM_Mailing_Event_BAO_Delivered::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], $params['date']), - ); + ]; break; case 'Bounces': - $stats[$params['mailing_id']] += array( + $stats[$params['mailing_id']] += [ $detail => CRM_Mailing_Event_BAO_Bounce::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], $params['date']), - ); + ]; break; case 'Unsubscribers': - $stats[$params['mailing_id']] += array( + $stats[$params['mailing_id']] += [ $detail => CRM_Mailing_Event_BAO_Unsubscribe::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], NULL, $params['date']), - ); + ]; break; case 'Unique Clicks': - $stats[$params['mailing_id']] += array( + $stats[$params['mailing_id']] += [ $detail => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], NULL, $params['date']), - ); + ]; break; case 'Opened': - $stats[$params['mailing_id']] += array( + $stats[$params['mailing_id']] += [ $detail => CRM_Mailing_Event_BAO_Opened::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], $params['date']), - ); + ]; break; } } diff --git a/api/v3/MailingAB.php b/api/v3/MailingAB.php index 2d0718d127..2ef7637d37 100644 --- a/api/v3/MailingAB.php +++ b/api/v3/MailingAB.php @@ -107,7 +107,7 @@ function _civicrm_api3_mailing_a_b_submit_spec(&$spec) { * @throws API_Exception */ function civicrm_api3_mailing_a_b_submit($params) { - civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingAB', array('id', 'status')); + civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingAB', ['id', 'status']); if (!isset($params['scheduled_date']) && !isset($updateParams['approval_date'])) { throw new API_Exception("Missing parameter scheduled_date and/or approval_date"); @@ -122,26 +122,26 @@ function civicrm_api3_mailing_a_b_submit($params) { throw new API_Exception("Missing mailing IDs for A/B test"); } - $submitParams = CRM_Utils_Array::subset($params, array( + $submitParams = CRM_Utils_Array::subset($params, [ 'scheduled_date', 'approval_date', 'approval_note', 'approval_status_id', - )); + ]); switch ($params['status']) { case 'Testing': if (!empty($dao->status) && $dao->status != 'Draft') { throw new API_Exception("Cannot transition to state 'Testing'"); } - civicrm_api3('Mailing', 'submit', $submitParams + array( + civicrm_api3('Mailing', 'submit', $submitParams + [ 'id' => $dao->mailing_id_a, '_skip_evil_bao_auto_recipients_' => 0, - )); - civicrm_api3('Mailing', 'submit', $submitParams + array( + ]); + civicrm_api3('Mailing', 'submit', $submitParams + [ 'id' => $dao->mailing_id_b, '_skip_evil_bao_auto_recipients_' => 1, - )); + ]); CRM_Mailing_BAO_MailingAB::distributeRecipients($dao); break; @@ -149,23 +149,23 @@ function civicrm_api3_mailing_a_b_submit($params) { if ($dao->status != 'Testing') { throw new API_Exception("Cannot transition to state 'Final'"); } - civicrm_api3('Mailing', 'submit', $submitParams + array( + civicrm_api3('Mailing', 'submit', $submitParams + [ 'id' => $dao->mailing_id_c, '_skip_evil_bao_auto_recipients_' => 1, - )); + ]); break; default: throw new API_Exception("Unrecognized submission status"); } - return civicrm_api3('MailingAB', 'create', array( + return civicrm_api3('MailingAB', 'create', [ 'id' => $dao->id, 'status' => $params['status'], - 'options' => array( + 'options' => [ 'reload' => 1, - ), - )); + ], + ]); } /** @@ -177,20 +177,20 @@ function civicrm_api3_mailing_a_b_submit($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_mailing_a_b_graph_stats_spec(&$params) { - $params['criteria'] = array( + $params['criteria'] = [ 'title' => 'Criteria', 'default' => 'Open', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; // mailing_ab_winner_criteria $params['target_date']['title'] = 'Target Date'; $params['target_date']['type'] = CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME; - $params['split_count'] = array( + $params['split_count'] = [ 'title' => 'Split Count', 'api.default' => 6, 'type' => CRM_Utils_Type::T_INT, - ); + ]; $params['split_count_select']['title'] = 'Split Count Select'; $params['split_count_select']['api.required'] = 1; $params['target_url']['title'] = 'Target URL'; @@ -207,21 +207,21 @@ function _civicrm_api3_mailing_a_b_graph_stats_spec(&$params) { function civicrm_api3_mailing_a_b_graph_stats($params) { civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingAB', - array('id'), + ['id'], FALSE ); - $defaults = array( + $defaults = [ 'criteria' => 'Open', 'target_date' => CRM_Utils_Time::getTime('YmdHis'), 'split_count' => 6, 'split_count_select' => 1, - ); + ]; $params = array_merge($defaults, $params); - $mailingAB = civicrm_api3('MailingAB', 'getsingle', array('id' => $params['id'])); - $graphStats = array(); - $ABFormat = array('A' => 'mailing_id_a', 'B' => 'mailing_id_b'); + $mailingAB = civicrm_api3('MailingAB', 'getsingle', ['id' => $params['id']]); + $graphStats = []; + $ABFormat = ['A' => 'mailing_id_a', 'B' => 'mailing_id_b']; foreach ($ABFormat as $name => $column) { switch (strtolower($params['criteria'])) { @@ -232,12 +232,12 @@ function civicrm_api3_mailing_a_b_graph_stats($params) { $dateDuration = round(round(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']); $toDate = strtotime($startDate) + ($dateDuration * $params['split_count_select']); $toDate = date('YmdHis', $toDate); - $graphStats[$name] = array( - $params['split_count_select'] => array( + $graphStats[$name] = [ + $params['split_count_select'] => [ 'count' => CRM_Mailing_Event_BAO_Opened::getTotalCount($mailingAB[$column], NULL, TRUE, $toDate), 'time' => CRM_Utils_Date::customFormat($toDate), - ), - ); + ], + ]; break; case 'total unique clicks': @@ -247,12 +247,12 @@ function civicrm_api3_mailing_a_b_graph_stats($params) { $dateDuration = round(abs(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']); $toDate = strtotime($startDate) + ($dateDuration * $params['split_count_select']); $toDate = date('YmdHis', $toDate); - $graphStats[$name] = array( - $params['split_count_select'] => array( + $graphStats[$name] = [ + $params['split_count_select'] => [ 'count' => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, NULL, $toDate), 'time' => CRM_Utils_Date::customFormat($toDate), - ), - ); + ], + ]; break; case 'total clicks on a particular link': @@ -267,12 +267,12 @@ function civicrm_api3_mailing_a_b_graph_stats($params) { $dateDuration = round(abs(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']); $toDate = strtotime($startDate) + ($dateDuration * $params['split_count_select']); $toDate = CRM_Utils_Date::processDate($toDate); - $graphStats[$name] = array( - $params['split_count_select'] => array( + $graphStats[$name] = [ + $params['split_count_select'] => [ 'count' => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, $url_id, $toDate), 'time' => CRM_Utils_Date::customFormat($toDate), - ), - ); + ], + ]; break; } } diff --git a/api/v3/MailingContact.php b/api/v3/MailingContact.php index c001039b1a..b4eedb52b1 100644 --- a/api/v3/MailingContact.php +++ b/api/v3/MailingContact.php @@ -75,21 +75,21 @@ function _civicrm_api3_mailing_contact_getresults($params, $count) { * Array of parameters determined by getfields. */ function _civicrm_api3_mailing_contact_get_spec(&$params) { - $params['contact_id'] = array( + $params['contact_id'] = [ 'api.required' => 1, 'title' => 'Contact ID', 'type' => CRM_Utils_Type::T_INT, - ); + ]; - $params['type'] = array( + $params['type'] = [ 'api.default' => 'Delivered', 'title' => 'Type', // doesn't really explain the field - but not sure I understand it to explain it better 'type' => CRM_Utils_Type::T_STRING, - 'options' => array( + 'options' => [ 'Delivered' => 'Delivered', 'Bounced' => 'Bounced', - ), - ); + ], + ]; } /** @@ -131,20 +131,20 @@ AND meq.contact_id = %1 GROUP BY m.id "; - $qParams = array( - 1 => array($contactID, 'Integer'), - ); + $qParams = [ + 1 => [$contactID, 'Integer'], + ]; $dao = CRM_Core_DAO::executeQuery($sql, $qParams); $results = $dao->N; } else { - $defaultFields = array( + $defaultFields = [ 'm.id' => 'mailing_id', 'm.subject' => 'subject', 'c.id' => 'creator_id', 'c.sort_name' => 'creator_name', - ); + ]; if ($selectFields) { $fields = array_merge($selectFields, $defaultFields); @@ -153,7 +153,7 @@ GROUP BY m.id $fields = $defaultFields; } - $select = array(); + $select = []; foreach ($fields as $n => $l) { $select[] = "$n as $l"; } @@ -186,14 +186,14 @@ LIMIT %2, %3 "; } - $qParams = array( - 1 => array($contactID, 'Integer'), - 2 => array($offset, 'Integer'), - 3 => array($limit, 'Integer'), - ); + $qParams = [ + 1 => [$contactID, 'Integer'], + 2 => [$offset, 'Integer'], + 3 => [$limit, 'Integer'], + ]; $dao = CRM_Core_DAO::executeQuery($sql, $qParams); - $results = array(); + $results = []; while ($dao->fetch()) { foreach ($fields as $n => $l) { $results[$dao->mailing_id][$l] = $dao->$l; @@ -222,7 +222,7 @@ function _civicrm_api3_mailing_contact_get_delivered( $sort, $getCount ) { - $selectFields = array('med.time_stamp' => 'start_date'); + $selectFields = ['med.time_stamp' => 'start_date']; $fromClause = " INNER JOIN civicrm_mailing_event_delivered med ON med.event_queue_id = meq.id diff --git a/api/v3/MailingEventConfirm.php b/api/v3/MailingEventConfirm.php index 27e28baa78..12ccad5a02 100644 --- a/api/v3/MailingEventConfirm.php +++ b/api/v3/MailingEventConfirm.php @@ -65,19 +65,19 @@ function civicrm_api3_mailing_event_confirm_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_mailing_event_confirm_create_spec(&$params) { - $params['contact_id'] = array( + $params['contact_id'] = [ 'api.required' => 1, 'title' => 'Contact ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['subscribe_id'] = array( + ]; + $params['subscribe_id'] = [ 'api.required' => 1, 'title' => 'Subscribe Event ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['hash'] = array( + ]; + $params['hash'] = [ 'api.required' => 1, 'title' => 'Hash', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; } diff --git a/api/v3/MailingEventQueue.php b/api/v3/MailingEventQueue.php index 7075aafd90..87e9b2ba9b 100644 --- a/api/v3/MailingEventQueue.php +++ b/api/v3/MailingEventQueue.php @@ -47,7 +47,7 @@ function civicrm_api3_mailing_event_queue_create($params) { } civicrm_api3_verify_mandatory($params, 'CRM_Mailing_DAO_MailingJob', - array('job_id', 'contact_id'), + ['job_id', 'contact_id'], FALSE ); return _civicrm_api3_basic_create('CRM_Mailing_Event_BAO_Queue', $params, 'Queue'); diff --git a/api/v3/MailingEventResubscribe.php b/api/v3/MailingEventResubscribe.php index 29a01035b0..367a077b14 100644 --- a/api/v3/MailingEventResubscribe.php +++ b/api/v3/MailingEventResubscribe.php @@ -68,19 +68,19 @@ function civicrm_api3_mailing_event_resubscribe_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_mailing_event_resubscribe_create_spec(&$params) { - $params['event_queue_id'] = array( + $params['event_queue_id'] = [ 'api.required' => 1, 'title' => 'Event Queue ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['job_id'] = array( + ]; + $params['job_id'] = [ 'api.required' => 1, 'title' => 'Job ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['hash'] = array( + ]; + $params['hash'] = [ 'api.required' => 1, 'title' => 'Hash', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; } diff --git a/api/v3/MailingEventSubscribe.php b/api/v3/MailingEventSubscribe.php index f5df8ef8f5..e4c8eaab9b 100644 --- a/api/v3/MailingEventSubscribe.php +++ b/api/v3/MailingEventSubscribe.php @@ -61,7 +61,7 @@ function civicrm_api3_mailing_event_subscribe_create($params) { $subscribe->send_confirm_request($email); - $values = array(); + $values = []; $values[$subscribe->id]['contact_id'] = $subscribe->contact_id; $values[$subscribe->id]['subscribe_id'] = $subscribe->id; $values[$subscribe->id]['hash'] = $subscribe->hash; @@ -80,14 +80,14 @@ function civicrm_api3_mailing_event_subscribe_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_mailing_event_subscribe_create_spec(&$params) { - $params['email'] = array( + $params['email'] = [ 'api.required' => 1, 'title' => 'Unsubscribe Email', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['group_id'] = array( + ]; + $params['group_id'] = [ 'api.required' => 1, 'title' => 'Unsubscribe From Group', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } diff --git a/api/v3/MailingEventUnsubscribe.php b/api/v3/MailingEventUnsubscribe.php index 4313c57d87..4d853924f9 100644 --- a/api/v3/MailingEventUnsubscribe.php +++ b/api/v3/MailingEventUnsubscribe.php @@ -75,19 +75,19 @@ function civicrm_api3_mailing_event_unsubscribe_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_mailing_event_unsubscribe_create_spec(&$params) { - $params['job_id'] = array( + $params['job_id'] = [ 'api.required' => 1, 'title' => 'Mailing Job ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['hash'] = array( + ]; + $params['hash'] = [ 'api.required' => 1, 'title' => 'Mailing Hash', 'type' => CRM_Utils_Type::T_STRING, - ); - $params['event_queue_id'] = array( + ]; + $params['event_queue_id'] = [ 'api.required' => 1, 'title' => 'Mailing Queue ID', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } diff --git a/api/v3/MailingGroup.php b/api/v3/MailingGroup.php index 9f3cb1e1eb..cc6ef0cf94 100644 --- a/api/v3/MailingGroup.php +++ b/api/v3/MailingGroup.php @@ -41,12 +41,12 @@ */ function _civicrm_api3_mailing_group_deprecation() { $message = 'This action is deprecated. Use the mailing_event API instead.'; - return array( + return [ 'event_unsubscribe' => $message, 'event_domain_unsubscribe' => $message, 'event_resubscribe' => $message, 'event_subscribe' => $message, - ); + ]; } /** diff --git a/api/v3/Membership.php b/api/v3/Membership.php index 052019ef6e..7d9b86ac49 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -41,12 +41,12 @@ * Array of parameters determined by getfields. */ function _civicrm_api3_membership_delete_spec(&$params) { - $params['preserve_contribution'] = array( + $params['preserve_contribution'] = [ 'api.required' => 0, 'title' => 'Preserve Contribution', 'description' => 'By default this is 0, or 0 if not set. Set to 1 to preserve the associated contribution record when membership is deleted.', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } /** @@ -97,7 +97,7 @@ function civicrm_api3_membership_create($params) { } } - $values = array(); + $values = []; _civicrm_api3_custom_format_params($params, $values, 'Membership'); $params = array_merge($params, $values); @@ -124,7 +124,7 @@ function civicrm_api3_membership_create($params) { $params['num_terms'] ); } - foreach (array('join_date', 'start_date', 'end_date') as $date) { + foreach (['join_date', 'start_date', 'end_date'] as $date) { if (empty($params[$date]) && isset($calcDates[$date])) { $params[$date] = $calcDates[$date]; } @@ -135,7 +135,7 @@ function civicrm_api3_membership_create($params) { if (empty($params['id'])) { $params['action'] = CRM_Core_Action::ADD; // we need user id during add mode - $ids = array(); + $ids = []; if (!empty($params['contact_id'])) { $ids['userId'] = $params['contact_id']; } @@ -155,7 +155,7 @@ function civicrm_api3_membership_create($params) { return civicrm_api3_create_error(ts('The membership can not be saved, no valid membership status for given dates')); } - $membership = array(); + $membership = []; _civicrm_api3_object_to_array($membershipBAO, $membership[$membershipBAO->id]); return civicrm_api3_create_success($membership, $params, 'Membership', 'create', $membershipBAO); @@ -174,18 +174,18 @@ function _civicrm_api3_membership_create_spec(&$params) { $params['contact_id']['api.required'] = 1; $params['membership_type_id']['api.required'] = 1; $params['is_test']['api.default'] = 0; - $params['membership_type_id']['api.aliases'] = array('membership_type'); - $params['status_id']['api.aliases'] = array('membership_status'); - $params['skipStatusCal'] = array( + $params['membership_type_id']['api.aliases'] = ['membership_type']; + $params['status_id']['api.aliases'] = ['membership_status']; + $params['skipStatusCal'] = [ 'title' => 'Skip status calculation', 'description' => 'By default this is 0 if id is not set and 1 if it is set.', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['num_terms'] = array( + ]; + $params['num_terms'] = [ 'title' => 'Number of terms', 'description' => 'Terms to add/renew. If this parameter is passed, dates will be calculated automatically. If no id is passed (new membership) and no dates are given, num_terms will be assumed to be 1.', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } /** @@ -197,12 +197,12 @@ function _civicrm_api3_membership_create_spec(&$params) { * Array of parameters determined by getfields. */ function _civicrm_api3_membership_get_spec(&$params) { - $params['membership_type_id']['api.aliases'] = array('membership_type'); - $params['active_only'] = array( + $params['membership_type_id']['api.aliases'] = ['membership_type']; + $params['active_only'] = [ 'title' => 'Active Only', 'description' => 'Only retrieve active memberships', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } /** @@ -229,7 +229,7 @@ function civicrm_api3_membership_get($params) { } $activeOnly = CRM_Utils_Array::value('active_only', $params, $activeOnly); if ($activeOnly && empty($params['status_id'])) { - $params['status_id'] = array('IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent()); + $params['status_id'] = ['IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent()]; } $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Membership', 'get'); @@ -271,11 +271,11 @@ function civicrm_api3_membership_get($params) { */ function _civicrm_api3_membership_get_customv2behaviour(&$params, $membershipTypeId, $activeOnly) { // get the membership for the given contact ID - $membershipParams = array('contact_id' => $params['contact_id']); + $membershipParams = ['contact_id' => $params['contact_id']]; if ($membershipTypeId) { $membershipParams['membership_type_id'] = $membershipTypeId; } - $membershipValues = array(); + $membershipValues = []; CRM_Member_BAO_Membership::getValues($membershipParams, $membershipValues, $activeOnly); return $membershipValues; } @@ -293,7 +293,7 @@ function _civicrm_api3_membership_get_customv2behaviour(&$params, $membershipTyp * result for calling function */ function _civicrm_api3_membership_relationsship_get_customv2behaviour(&$params, $membershipValues, $contactID) { - $relationships = array(); + $relationships = []; foreach ($membershipValues as $membershipId => $values) { // populate the membership type name for the membership type id $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($values['membership_type_id']); diff --git a/api/v3/MembershipPayment.php b/api/v3/MembershipPayment.php index ef78bd5f73..633db9681e 100644 --- a/api/v3/MembershipPayment.php +++ b/api/v3/MembershipPayment.php @@ -56,11 +56,11 @@ function civicrm_api3_membership_payment_create($params) { function _civicrm_api3_membership_payment_create_spec(&$params) { $params['membership_id']['api.required'] = 1; $params['contribution_id']['api.required'] = 1; - $params['membership_type_id'] = array( + $params['membership_type_id'] = [ 'title' => 'Membership type id', 'description' => 'The id of the membership type', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } /** diff --git a/api/v3/MembershipStatus.php b/api/v3/MembershipStatus.php index fabdd80368..cad70e9d58 100644 --- a/api/v3/MembershipStatus.php +++ b/api/v3/MembershipStatus.php @@ -86,7 +86,7 @@ function civicrm_api3_membership_status_get($params) { */ function civicrm_api3_membership_status_update($params) { - civicrm_api3_verify_mandatory($params, NULL, array('id')); + civicrm_api3_verify_mandatory($params, NULL, ['id']); //don't allow duplicate names. $name = CRM_Utils_Array::value('name', $params); if ($name) { @@ -108,7 +108,7 @@ function civicrm_api3_membership_status_update($params) { } $membershipStatusBAO->save(); } - $membershipStatus = array(); + $membershipStatus = []; $cloneBAO = clone($membershipStatusBAO); _civicrm_api3_object_to_array($cloneBAO, $membershipStatus); $membershipStatus['is_error'] = 0; @@ -162,7 +162,7 @@ SELECT start_date, end_date, join_date, membership_type_id WHERE id = %1 "; - $params = array(1 => array($membershipID, 'Integer')); + $params = [1 => [$membershipID, 'Integer']]; $dao = CRM_Core_DAO::executeQuery($query, $params); if ($dao->fetch()) { $membershipTypeID = empty($membershipParams['membership_type_id']) ? $dao->membership_type_id : $membershipParams['membership_type_id']; diff --git a/api/v3/MembershipType.php b/api/v3/MembershipType.php index d5e515e42b..386626c548 100644 --- a/api/v3/MembershipType.php +++ b/api/v3/MembershipType.php @@ -42,7 +42,7 @@ */ function civicrm_api3_membership_type_create($params) { // Workaround for fields using nonstandard serialization - foreach (array('relationship_type_id', 'relationship_direction') as $field) { + foreach (['relationship_type_id', 'relationship_direction'] as $field) { if (isset($params[$field]) && is_array($params[$field])) { $params[$field] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params[$field]); } @@ -85,7 +85,7 @@ function civicrm_api3_membership_type_get($params) { if (!empty($results['values']) && is_array($results['values'])) { foreach ($results['values'] as &$item) { // Workaround for fields using nonstandard serialization - foreach (array('relationship_type_id', 'relationship_direction') as $field) { + foreach (['relationship_type_id', 'relationship_direction'] as $field) { if (isset($item[$field]) && !is_array($item[$field])) { $item[$field] = (array) $item[$field]; } diff --git a/api/v3/MessageTemplate.php b/api/v3/MessageTemplate.php index a5b1d7df70..6c54249c1a 100644 --- a/api/v3/MessageTemplate.php +++ b/api/v3/MessageTemplate.php @@ -103,7 +103,7 @@ function civicrm_api3_message_template_get($params) { */ function civicrm_api3_message_template_send($params) { // Change external param names to internal ones - $fieldSpec = array(); + $fieldSpec = []; _civicrm_api3_message_template_send_spec($fieldSpec); foreach ($fieldSpec as $field => $spec) { @@ -118,7 +118,7 @@ function civicrm_api3_message_template_send($params) { throw new API_Exception( "Mandatory key(s) missing from params array: requires id or option_group_name + option_value_name", "mandatory_missing", - array("fields" => array('id', 'option_group_name', 'option_value_name')) + ["fields" => ['id', 'option_group_name', 'option_value_name']] ); } } @@ -137,27 +137,27 @@ function civicrm_api3_message_template_send($params) { function _civicrm_api3_message_template_send_spec(&$params) { $params['id']['description'] = 'ID of the template'; $params['id']['title'] = 'Message Template ID'; - $params['id']['api.aliases'] = array('messageTemplateID', 'message_template_id'); + $params['id']['api.aliases'] = ['messageTemplateID', 'message_template_id']; $params['id']['type'] = CRM_Utils_Type::T_INT; $params['option_group_name']['description'] = 'option group name of the template (required if no id supplied)'; $params['option_group_name']['title'] = 'Option Group Name'; - $params['option_group_name']['api.aliases'] = array('groupName'); + $params['option_group_name']['api.aliases'] = ['groupName']; $params['option_group_name']['type'] = CRM_Utils_Type::T_STRING; $params['option_value_name']['description'] = 'option value name of the template (required if no id supplied)'; $params['option_value_name']['title'] = 'Option Value Name'; - $params['option_value_name']['api.aliases'] = array('valueName'); + $params['option_value_name']['api.aliases'] = ['valueName']; $params['option_value_name']['type'] = CRM_Utils_Type::T_STRING; $params['contact_id']['description'] = 'contact id if contact tokens are to be replaced'; $params['contact_id']['title'] = 'Contact ID'; - $params['contact_id']['api.aliases'] = array('contactId'); + $params['contact_id']['api.aliases'] = ['contactId']; $params['contact_id']['type'] = CRM_Utils_Type::T_INT; $params['template_params']['description'] = 'additional template params (other than the ones already set in the template singleton)'; $params['template_params']['title'] = 'Template Params'; - $params['template_params']['api.aliases'] = array('tplParams'); + $params['template_params']['api.aliases'] = ['tplParams']; // FIXME: Type?? $params['from']['description'] = 'the From: header'; @@ -166,12 +166,12 @@ function _civicrm_api3_message_template_send_spec(&$params) { $params['to_name']['description'] = 'the recipient’s name'; $params['to_name']['title'] = 'Recipient Name'; - $params['to_name']['api.aliases'] = array('toName'); + $params['to_name']['api.aliases'] = ['toName']; $params['to_name']['type'] = CRM_Utils_Type::T_STRING; $params['to_email']['description'] = 'the recipient’s email - mail is sent only if set'; $params['to_email']['title'] = 'Recipient Email'; - $params['to_email']['api.aliases'] = array('toEmail'); + $params['to_email']['api.aliases'] = ['toEmail']; $params['to_email']['type'] = CRM_Utils_Type::T_STRING; $params['cc']['description'] = 'the Cc: header'; @@ -184,7 +184,7 @@ function _civicrm_api3_message_template_send_spec(&$params) { $params['reply_to']['description'] = 'the Reply-To: header'; $params['reply_to']['title'] = 'Reply To'; - $params['reply_to']['api.aliases'] = array('replyTo'); + $params['reply_to']['api.aliases'] = ['replyTo']; $params['reply_to']['type'] = CRM_Utils_Type::T_STRING; $params['attachments']['description'] = 'email attachments'; @@ -193,11 +193,11 @@ function _civicrm_api3_message_template_send_spec(&$params) { $params['is_test']['description'] = 'whether this is a test email (and hence should include the test banner)'; $params['is_test']['title'] = 'Is Test'; - $params['is_test']['api.aliases'] = array('isTest'); + $params['is_test']['api.aliases'] = ['isTest']; $params['is_test']['type'] = CRM_Utils_Type::T_BOOLEAN; $params['pdf_filename']['description'] = 'filename of optional PDF version to add as attachment (do not include path)'; $params['pdf_filename']['title'] = 'PDF Filename'; - $params['pdf_filename']['api.aliases'] = array('PDFFilename'); + $params['pdf_filename']['api.aliases'] = ['PDFFilename']; $params['pdf_filename']['type'] = CRM_Utils_Type::T_STRING; } diff --git a/api/v3/Navigation.php b/api/v3/Navigation.php index d21a1c4baf..fa4ff32a03 100644 --- a/api/v3/Navigation.php +++ b/api/v3/Navigation.php @@ -40,10 +40,10 @@ function _civicrm_api3_navigation_reset_spec(&$params) { $params['for']['api.required'] = TRUE; $params['for']['title'] = "Is this reset for all navigation or reports"; $params['for']['type'] = CRM_Utils_Type::T_STRING; - $params['for']['options'] = array( + $params['for']['options'] = [ 'all' => 'General Navigation rebuild from xml', 'report' => 'Reset report menu to default structure', - ); + ]; $params['domain_id']['api.default'] = CRM_Core_Config::domainID(); $params['domain_id']['type'] = CRM_Utils_Type::T_INT; $params['domain_id']['title'] = 'Domain ID'; @@ -97,7 +97,7 @@ function civicrm_api3_navigation_get($params) { * API result array. */ function civicrm_api3_navigation_create($params) { - civicrm_api3_verify_one_mandatory($params, NULL, array('name', 'label')); + civicrm_api3_verify_one_mandatory($params, NULL, ['name', 'label']); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Navigation'); } diff --git a/api/v3/Note.php b/api/v3/Note.php index c570446d1c..6c86037c90 100644 --- a/api/v3/Note.php +++ b/api/v3/Note.php @@ -113,7 +113,7 @@ function _civicrm_api3_note_get_spec(&$params) { * Nested associative array beginning with direct children of given note. */ function civicrm_api3_note_tree_get($params) { - civicrm_api3_verify_mandatory($params, NULL, array('id')); + civicrm_api3_verify_mandatory($params, NULL, ['id']); if (!is_numeric($params['id'])) { return civicrm_api3_create_error(ts("Invalid note ID")); diff --git a/api/v3/OptionGroup.php b/api/v3/OptionGroup.php index a1bec3d48f..d72d3469a2 100644 --- a/api/v3/OptionGroup.php +++ b/api/v3/OptionGroup.php @@ -54,7 +54,7 @@ function civicrm_api3_option_group_get($params) { */ function civicrm_api3_option_group_create($params) { $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'OptionGroup'); - civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1)); + civicrm_api('option_value', 'getfields', ['version' => 3, 'cache_clear' => 1]); return $result; } diff --git a/api/v3/OptionValue.php b/api/v3/OptionValue.php index 09fe94fcd2..9a83d26cbc 100644 --- a/api/v3/OptionValue.php +++ b/api/v3/OptionValue.php @@ -54,7 +54,7 @@ function civicrm_api3_option_value_get($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_option_value_get_spec(&$params) { - $params['option_group_id']['api.aliases'] = array('option_group_name'); + $params['option_group_id']['api.aliases'] = ['option_group_name']; } /** @@ -77,7 +77,7 @@ function civicrm_api3_option_value_create($params) { $groupId = $params['option_group_id']; } - civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $groupId)); + civicrm_api('option_value', 'getfields', ['version' => 3, 'cache_clear' => 1, 'option_group_id' => $groupId]); return $result; } @@ -92,7 +92,7 @@ function civicrm_api3_option_value_create($params) { function _civicrm_api3_option_value_create_spec(&$params) { $params['is_active']['api.default'] = 1; //continue to support component - $params['component_id']['api.aliases'] = array('component'); + $params['component_id']['api.aliases'] = ['component']; // $params['name']['api.aliases'] = array('label'); $params['option_group_id']['api.required'] = TRUE; } @@ -106,10 +106,10 @@ function _civicrm_api3_option_value_create_spec(&$params) { */ function civicrm_api3_option_value_delete($params) { // We will get the option group id before deleting so we can flush pseudoconstants. - $optionGroupID = civicrm_api('option_value', 'getvalue', array('version' => 3, 'id' => $params['id'], 'return' => 'option_group_id')); + $optionGroupID = civicrm_api('option_value', 'getvalue', ['version' => 3, 'id' => $params['id'], 'return' => 'option_group_id']); $result = CRM_Core_BAO_OptionValue::del($params['id']); if ($result) { - civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID)); + civicrm_api('option_value', 'getfields', ['version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID]); return civicrm_api3_create_success(); } else { diff --git a/api/v3/Order.php b/api/v3/Order.php index bc29312006..fff662a96a 100644 --- a/api/v3/Order.php +++ b/api/v3/Order.php @@ -42,8 +42,8 @@ * Array of Order, if error an array with an error id and error message */ function civicrm_api3_order_get($params) { - $contributions = array(); - $params['api.line_item.get'] = array('qty' => array('<>' => 0)); + $contributions = []; + $params['api.line_item.get'] = ['qty' => ['<>' => 0]]; $isSequential = FALSE; if (CRM_Utils_Array::value('sequential', $params)) { $params['sequential'] = 0; @@ -87,18 +87,18 @@ function _civicrm_api3_order_get_spec(&$params) { function civicrm_api3_order_create(&$params) { $entity = NULL; - $entityIds = array(); + $entityIds = []; if (CRM_Utils_Array::value('line_items', $params) && is_array($params['line_items'])) { $priceSetID = NULL; CRM_Contribute_BAO_Contribution::checkLineItems($params); foreach ($params['line_items'] as $lineItems) { - $entityParams = CRM_Utils_Array::value('params', $lineItems, array()); + $entityParams = CRM_Utils_Array::value('params', $lineItems, []); if (!empty($entityParams) && !empty($lineItems['line_item'])) { $item = reset($lineItems['line_item']); $entity = str_replace('civicrm_', '', $item['entity_table']); } if ($entityParams) { - if (in_array($entity, array('participant', 'membership'))) { + if (in_array($entity, ['participant', 'membership'])) { $entityParams['skipLineItem'] = TRUE; $entityResult = civicrm_api3($entity, 'create', $entityParams); $params['contribution_mode'] = $entity; @@ -113,11 +113,11 @@ function civicrm_api3_order_create(&$params) { } if (empty($priceSetID)) { $item = reset($lineItems['line_item']); - $priceSetID = civicrm_api3('PriceField', 'getvalue', array( + $priceSetID = civicrm_api3('PriceField', 'getvalue', [ 'return' => 'price_set_id', 'id' => $item['price_field_id'], - )); - $params['line_item'][$priceSetID] = array(); + ]); + $params['line_item'][$priceSetID] = []; } $params['line_item'][$priceSetID] = array_merge($params['line_item'][$priceSetID], $lineItems['line_item']); } @@ -126,10 +126,10 @@ function civicrm_api3_order_create(&$params) { // add payments if ($entity && CRM_Utils_Array::value('id', $contribution)) { foreach ($entityIds as $entityId) { - $paymentParams = array( + $paymentParams = [ 'contribution_id' => $contribution['id'], $entity . '_id' => $entityId, - ); + ]; // if entity is pledge then build pledge param if ($entity == 'pledge') { $paymentParams += $entityParams; @@ -150,10 +150,10 @@ function civicrm_api3_order_create(&$params) { * @throws CiviCRM_API3_Exception */ function civicrm_api3_order_delete($params) { - $contribution = civicrm_api3('Contribution', 'get', array( - 'return' => array('is_test'), + $contribution = civicrm_api3('Contribution', 'get', [ + 'return' => ['is_test'], 'id' => $params['id'], - )); + ]); if ($contribution['id'] && $contribution['values'][$contribution['id']]['is_test'] == TRUE) { $result = civicrm_api3('Contribution', 'delete', $params); } @@ -188,11 +188,11 @@ function civicrm_api3_order_cancel($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_order_cancel_spec(&$params) { - $params['contribution_id'] = array( + $params['contribution_id'] = [ 'api.required' => 1 , 'title' => 'Contribution ID', 'type' => CRM_Utils_Type::T_INT, - ); + ]; } /** @@ -204,17 +204,17 @@ function _civicrm_api3_order_cancel_spec(&$params) { * Array of parameters determined by getfields. */ function _civicrm_api3_order_create_spec(&$params) { - $params['contact_id'] = array( + $params['contact_id'] = [ 'name' => 'contact_id', 'title' => 'Contact ID', 'type' => CRM_Utils_Type::T_INT, 'api.required' => TRUE, - ); - $params['total_amount'] = array( + ]; + $params['total_amount'] = [ 'name' => 'total_amount', 'title' => 'Total Amount', 'api.required' => TRUE, - ); + ]; $params['financial_type_id'] = [ 'name' => 'financial_type_id', 'title' => 'Financial Type', @@ -240,10 +240,10 @@ function _civicrm_api3_order_create_spec(&$params) { * Array of parameters determined by getfields. */ function _civicrm_api3_order_delete_spec(&$params) { - $params['contribution_id'] = array( + $params['contribution_id'] = [ 'api.required' => TRUE, 'title' => 'Contribution ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['id']['api.aliases'] = array('contribution_id'); + ]; + $params['id']['api.aliases'] = ['contribution_id']; } diff --git a/api/v3/Participant.php b/api/v3/Participant.php index 18a881744d..d9b75b3be0 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -49,7 +49,7 @@ function civicrm_api3_participant_create($params) { } } - $values = $participant = array(); + $values = $participant = []; _civicrm_api3_custom_format_params($params, $values, 'Participant'); $params = array_merge($values, $params); @@ -104,14 +104,14 @@ function _civicrm_api3_participant_createlineitem(&$params, $participant) { where ps.id is not null and pfv.label = %2 "; - $qParams = array( - 1 => array($params['event_id'], 'Integer'), - 2 => array($label, 'String'), - ); + $qParams = [ + 1 => [$params['event_id'], 'Integer'], + 2 => [$label, 'String'], + ]; $dao = CRM_Core_DAO::executeQuery($sql, $qParams); if ($dao->fetch()) { - $lineItemParams = array( + $lineItemParams = [ 'price_field_id' => $dao->priceFieldID, 'price_field_value_id' => $dao->priceFieldValueID, 'entity_table' => 'civicrm_participant', @@ -121,7 +121,7 @@ function _civicrm_api3_participant_createlineitem(&$params, $participant) { 'participant_count' => 0, 'unit_price' => $dao->amount, 'line_total' => $qty * $dao->amount, - ); + ]; civicrm_api3('line_item', 'create', $lineItemParams); } @@ -143,8 +143,8 @@ function _civicrm_api3_participant_create_spec(&$params) { $params['event_id']['api.required'] = 1; $params['contact_id']['api.required'] = 1; // These are for the sake of search builder options - can be removed if that is fixed - $params['role_id']['api.aliases'] = array('participant_role'); - $params['status_id']['api.aliases'] = array('participant_status'); + $params['role_id']['api.aliases'] = ['participant_role']; + $params['status_id']['api.aliases'] = ['participant_status']; } /** @@ -161,7 +161,7 @@ function civicrm_api3_participant_get($params) { list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, 'Participant'); - $participant = array(); + $participant = []; while ($dao->fetch()) { $query->convertToPseudoNames($dao, FALSE, TRUE); $participant[$dao->participant_id] = $query->store($dao); @@ -181,11 +181,11 @@ function civicrm_api3_participant_get($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_participant_get_spec(&$params) { - $params['participant_test'] = array( + $params['participant_test'] = [ 'api.default' => 0, 'title' => 'Get Test Participants', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } /** diff --git a/api/v3/Payment.php b/api/v3/Payment.php index a4292a5b6b..25e4ae17e9 100644 --- a/api/v3/Payment.php +++ b/api/v3/Payment.php @@ -41,7 +41,7 @@ * Array of financial transactions which are payments, if error an array with an error id and error message */ function civicrm_api3_payment_get($params) { - $financialTrxn = array(); + $financialTrxn = []; $limit = ''; if (isset($params['options']) && CRM_Utils_Array::value('limit', $params['options'])) { $limit = CRM_Utils_Array::value('limit', $params['options']); @@ -49,7 +49,7 @@ function civicrm_api3_payment_get($params) { $params['options']['limit'] = 0; $eft = civicrm_api3('EntityFinancialTrxn', 'get', $params); if (!empty($eft['values'])) { - $eftIds = array(); + $eftIds = []; foreach ($eft['values'] as $efts) { if (empty($efts['financial_trxn_id'])) { continue; @@ -58,10 +58,10 @@ function civicrm_api3_payment_get($params) { $map[$efts['financial_trxn_id']] = $efts['entity_id']; } if (!empty($eftIds)) { - $ftParams = array( - 'id' => array('IN' => $eftIds), + $ftParams = [ + 'id' => ['IN' => $eftIds], 'is_payment' => 1, - ); + ]; if ($limit) { $ftParams['options']['limit'] = $limit; } @@ -71,7 +71,7 @@ function civicrm_api3_payment_get($params) { } } } - return civicrm_api3_create_success(CRM_Utils_Array::value('values', $financialTrxn, array()), $params, 'Payment', 'get'); + return civicrm_api3_create_success(CRM_Utils_Array::value('values', $financialTrxn, []), $params, 'Payment', 'get'); } /** @@ -99,10 +99,10 @@ function civicrm_api3_payment_delete(&$params) { * Api result array */ function civicrm_api3_payment_cancel(&$params) { - $eftParams = array( + $eftParams = [ 'entity_table' => 'civicrm_contribution', 'financial_trxn_id' => $params['id'], - ); + ]; $entity = civicrm_api3('EntityFinancialTrxn', 'getsingle', $eftParams); $contributionId = $entity['entity_id']; $params['total_amount'] = $entity['amount']; @@ -110,7 +110,7 @@ function civicrm_api3_payment_cancel(&$params) { $trxn = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionId, $params, 'refund', NULL, FALSE); - $values = array(); + $values = []; _civicrm_api3_object_to_array_unique_fields($trxn, $values[$trxn->id]); return civicrm_api3_create_success($values, $params, 'Payment', 'cancel', $trxn); } @@ -134,7 +134,7 @@ function civicrm_api3_payment_create(&$params) { } $trxn = CRM_Financial_BAO_Payment::create($params); - $values = array(); + $values = []; _civicrm_api3_object_to_array_unique_fields($trxn, $values[$trxn->id]); return civicrm_api3_create_success($values, $params, 'Payment', 'create', $trxn); } @@ -148,28 +148,28 @@ function civicrm_api3_payment_create(&$params) { * Array of parameters. */ function _civicrm_api3_payment_create_spec(&$params) { - $params = array( - 'contribution_id' => array( + $params = [ + 'contribution_id' => [ 'api.required' => 1 , 'title' => 'Contribution ID', 'type' => CRM_Utils_Type::T_INT, - ), - 'total_amount' => array( + ], + 'total_amount' => [ 'api.required' => 1 , 'title' => 'Total Payment Amount', 'type' => CRM_Utils_Type::T_FLOAT, - ), - 'payment_processor_id' => array( + ], + 'payment_processor_id' => [ 'title' => 'Payment Processor ID', 'type' => CRM_Utils_Type::T_INT, 'description' => ts('Payment processor ID - required for payment processor payments'), - ), - 'id' => array( + ], + 'id' => [ 'title' => 'Payment ID', 'type' => CRM_Utils_Type::T_INT, - 'api.aliases' => array('payment_id'), - ), - ); + 'api.aliases' => ['payment_id'], + ], + ]; } /** @@ -181,21 +181,21 @@ function _civicrm_api3_payment_create_spec(&$params) { * Array of parameters determined by getfields. */ function _civicrm_api3_payment_get_spec(&$params) { - $params = array( - 'contribution_id' => array( + $params = [ + 'contribution_id' => [ 'title' => 'Contribution ID', 'type' => CRM_Utils_Type::T_INT, - ), - 'entity_table' => array( + ], + 'entity_table' => [ 'title' => 'Entity Table', 'api.default' => 'civicrm_contribution', - ), - 'entity_id' => array( + ], + 'entity_id' => [ 'title' => 'Entity ID', 'type' => CRM_Utils_Type::T_INT, - 'api.aliases' => array('contribution_id'), - ), - ); + 'api.aliases' => ['contribution_id'], + ], + ]; } /** @@ -207,14 +207,14 @@ function _civicrm_api3_payment_get_spec(&$params) { * Array of parameters. */ function _civicrm_api3_payment_delete_spec(&$params) { - $params = array( - 'id' => array( + $params = [ + 'id' => [ 'api.required' => 1 , 'title' => 'Payment ID', 'type' => CRM_Utils_Type::T_INT, - 'api.aliases' => array('payment_id'), - ), - ); + 'api.aliases' => ['payment_id'], + ], + ]; } /** @@ -226,14 +226,14 @@ function _civicrm_api3_payment_delete_spec(&$params) { * Array of parameters. */ function _civicrm_api3_payment_cancel_spec(&$params) { - $params = array( - 'id' => array( + $params = [ + 'id' => [ 'api.required' => 1 , 'title' => 'Payment ID', 'type' => CRM_Utils_Type::T_INT, - 'api.aliases' => array('payment_id'), - ), - ); + 'api.aliases' => ['payment_id'], + ], + ]; } /** @@ -275,9 +275,9 @@ function civicrm_api3_payment_sendconfirmation($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_payment_sendconfirmation_spec(&$params) { - $params['id'] = array( + $params['id'] = [ 'api.required' => 1, 'title' => ts('Payment ID'), 'type' => CRM_Utils_Type::T_INT, - ); + ]; } diff --git a/api/v3/PaymentProcessor.php b/api/v3/PaymentProcessor.php index 75b82edb75..5faa1318f4 100644 --- a/api/v3/PaymentProcessor.php +++ b/api/v3/PaymentProcessor.php @@ -41,10 +41,10 @@ */ function civicrm_api3_payment_processor_create($params) { if (empty($params['id']) && empty($params['payment_instrument_id'])) { - $params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', array( + $params['payment_instrument_id'] = civicrm_api3('PaymentProcessorType', 'getvalue', [ 'id' => $params['payment_processor_type_id'], 'return' => 'payment_instrument_id', - )); + ]); } return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PaymentProcessor'); } @@ -104,14 +104,14 @@ function civicrm_api3_payment_processor_get($params) { * @return array */ function _civicrm_api3_payment_processor_getlist_defaults(&$request) { - return array( - 'description_field' => array( + return [ + 'description_field' => [ 'payment_processor_type_id', 'description', - ), - 'params' => array( + ], + 'params' => [ 'is_test' => 0, 'is_active' => 1, - ), - ); + ], + ]; } diff --git a/api/v3/Pledge.php b/api/v3/Pledge.php index 13c790d45e..282aeec92b 100644 --- a/api/v3/Pledge.php +++ b/api/v3/Pledge.php @@ -55,9 +55,9 @@ function civicrm_api3_pledge_create($params) { */ function civicrm_api3_pledge_delete($params) { if (CRM_Pledge_BAO_Pledge::deletePledge($params['id'])) { - return civicrm_api3_create_success(array( + return civicrm_api3_create_success([ 'id' => $params['id'], - ), $params, 'Pledge', 'delete'); + ], $params, 'Pledge', 'delete'); } else { return civicrm_api3_create_error('Could not delete pledge'); @@ -71,7 +71,7 @@ function civicrm_api3_pledge_delete($params) { */ function _civicrm_api3_pledge_delete_spec(&$params) { // set as not required as pledge_id also acceptable & no either/or std yet - $params['id']['api.aliases'] = array('pledge_id'); + $params['id']['api.aliases'] = ['pledge_id']; } /** @@ -80,15 +80,15 @@ function _civicrm_api3_pledge_delete_spec(&$params) { * @param array $params */ function _civicrm_api3_pledge_get_spec(&$params) { - $params['next_pay_date'] = array( + $params['next_pay_date'] = [ 'name' => 'next_pay_date', 'type' => 12, 'title' => 'Pledge Made', 'api.filter' => 0, 'api.return' => 1, - ); + ]; $params['pledge_is_test']['api.default'] = 0; - $params['pledge_financial_type_id']['api.aliases'] = array('contribution_type_id', 'contribution_type'); + $params['pledge_financial_type_id']['api.aliases'] = ['contribution_type_id', 'contribution_type']; } @@ -99,13 +99,13 @@ function _civicrm_api3_pledge_get_spec(&$params) { */ function _civicrm_api3_pledge_create_spec(&$params) { - $required = array('contact_id', 'amount', 'installments', 'start_date', 'financial_type_id'); + $required = ['contact_id', 'amount', 'installments', 'start_date', 'financial_type_id']; foreach ($required as $required_field) { $params[$required_field]['api.required'] = 1; } // @todo this can come from xml - $params['amount']['api.aliases'] = array('pledge_amount'); - $params['financial_type_id']['api.aliases'] = array('contribution_type_id', 'contribution_type'); + $params['amount']['api.aliases'] = ['pledge_amount']; + $params['financial_type_id']['api.aliases'] = ['contribution_type_id', 'contribution_type']; } /** @@ -122,7 +122,7 @@ function civicrm_api3_pledge_get($params) { list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, 'Pledge'); - $pledge = array(); + $pledge = []; while ($dao->fetch()) { $pledge[$dao->pledge_id] = $query->store($dao); } @@ -134,7 +134,7 @@ function civicrm_api3_pledge_get($params) { * Set default to not return test params. */ function _civicrm_api3_pledge_get_defaults() { - return array('pledge_test' => 0); + return ['pledge_test' => 0]; } /** diff --git a/api/v3/PledgePayment.php b/api/v3/PledgePayment.php index 18b06f56e9..4301305a66 100644 --- a/api/v3/PledgePayment.php +++ b/api/v3/PledgePayment.php @@ -61,7 +61,7 @@ function civicrm_api3_pledge_payment_create($params) { } $dao = CRM_Pledge_BAO_PledgePayment::add($paymentParams); - $result = array(); + $result = []; if (empty($dao->pledge_id)) { $dao->find(TRUE); } @@ -98,7 +98,7 @@ function _civicrm_api3_pledge_payment_create_spec(&$params) { function civicrm_api3_pledge_payment_delete($params) { if (CRM_Pledge_BAO_PledgePayment::del($params['id'])) { - return civicrm_api3_create_success(array('id' => $params['id']), $params, 'PledgePayment', 'delete'); + return civicrm_api3_create_success(['id' => $params['id']], $params, 'PledgePayment', 'delete'); } else { return civicrm_api3_create_error('Could not delete payment'); @@ -126,9 +126,9 @@ function civicrm_api3_pledge_payment_get($params) { * Modifiable list of fields allowed for the PledgePayment.get action. */ function civicrm_api3_pledge_payment_get_spec(&$params) { - $params['option.create_new'] = array( + $params['option.create_new'] = [ 'title' => "Create New", 'description' => "Create new field rather than update an unpaid payment", 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } diff --git a/api/v3/Premium.php b/api/v3/Premium.php index 6f6ecdc325..c37b94f887 100644 --- a/api/v3/Premium.php +++ b/api/v3/Premium.php @@ -78,7 +78,7 @@ function civicrm_api3_premium_delete($params) { * @param array $params */ function _civicrm_api3_premium_get_spec(&$params) { - $params['premiums_active']['api.aliases'] = array('is_active'); + $params['premiums_active']['api.aliases'] = ['is_active']; } /** @@ -87,5 +87,5 @@ function _civicrm_api3_premium_get_spec(&$params) { * @param array $params */ function _civicrm_api3_premium_create_spec(&$params) { - $params['premiums_active']['api.aliases'] = array('is_active'); + $params['premiums_active']['api.aliases'] = ['is_active']; } diff --git a/api/v3/PriceFieldValue.php b/api/v3/PriceFieldValue.php index ff66773f62..c4533f7d4b 100644 --- a/api/v3/PriceFieldValue.php +++ b/api/v3/PriceFieldValue.php @@ -45,14 +45,14 @@ * API result array. */ function civicrm_api3_price_field_value_create($params) { - $ids = array(); + $ids = []; if (!empty($params['id'])) { $ids['id'] = $params['id']; } $bao = CRM_Price_BAO_PriceFieldValue::create($params, $ids); - $values = array(); + $values = []; _civicrm_api3_object_to_array($bao, $values[$bao->id]); return civicrm_api3_create_success($values, $params, 'PriceFieldValue', 'create', $bao); diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 13e3b2d499..6c25483f36 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -52,15 +52,15 @@ */ function civicrm_api3_profile_get($params) { $nonStandardLegacyBehaviour = is_numeric($params['profile_id']) ? TRUE : FALSE; - if (!empty($params['check_permissions']) && !empty($params['contact_id']) && !1 === civicrm_api3('contact', 'getcount', array('contact_id' => $params['contact_id'], 'check_permissions' => 1))) { + if (!empty($params['check_permissions']) && !empty($params['contact_id']) && !1 === civicrm_api3('contact', 'getcount', ['contact_id' => $params['contact_id'], 'check_permissions' => 1])) { throw new API_Exception('permission denied'); } $profiles = (array) $params['profile_id']; - $values = array(); + $values = []; $ufGroupBAO = new CRM_Core_BAO_UFGroup(); foreach ($profiles as $profileID) { $profileID = _civicrm_api3_profile_getProfileID($profileID); - $values[$profileID] = array(); + $values[$profileID] = []; if (strtolower($profileID) == 'billing') { $values[$profileID] = _civicrm_api3_profile_getbillingpseudoprofile($params); continue; @@ -84,7 +84,7 @@ function civicrm_api3_profile_get($params) { ); if ($isContactActivityProfile) { - civicrm_api3_verify_mandatory($params, NULL, array('activity_id')); + civicrm_api3_verify_mandatory($params, NULL, ['activity_id']); $errors = CRM_Profile_Form::validateContactActivityProfile($params['activity_id'], $params['contact_id'], @@ -94,7 +94,7 @@ function civicrm_api3_profile_get($params) { throw new API_Exception(array_pop($errors)); } - $contactFields = $activityFields = array(); + $contactFields = $activityFields = []; foreach ($profileFields as $fieldName => $field) { if (CRM_Utils_Array::value('field_type', $field) == 'Activity') { $activityFields[$fieldName] = $field; @@ -172,12 +172,12 @@ function civicrm_api3_profile_submit($params) { throw new API_Exception('Update profiles including more than one entity not currently supported'); } - $contactParams = $activityParams = $missingParams = array(); + $contactParams = $activityParams = $missingParams = []; - $profileFields = civicrm_api3('Profile', 'getfields', array('action' => 'submit', 'profile_id' => $profileID)); + $profileFields = civicrm_api3('Profile', 'getfields', ['action' => 'submit', 'profile_id' => $profileID]); $profileFields = $profileFields['values']; if ($isContactActivityProfile) { - civicrm_api3_verify_mandatory($params, NULL, array('activity_id')); + civicrm_api3_verify_mandatory($params, NULL, ['activity_id']); $errors = CRM_Profile_Form::validateContactActivityProfile($params['activity_id'], $params['contact_id'], @@ -205,8 +205,8 @@ function civicrm_api3_profile_submit($params) { if ($params[$fieldName] && isset($params[$fieldName . '_id'])) { $value = $params[$fieldName . '_id']; } - $contactEntities = array('contact', 'individual', 'organization', 'household'); - $locationEntities = array('email', 'address', 'phone', 'website', 'im'); + $contactEntities = ['contact', 'individual', 'organization', 'household']; + $locationEntities = ['email', 'address', 'phone', 'website', 'im']; $entity = strtolower(CRM_Utils_Array::value('entity', $field)); if ($entity && !in_array($entity, array_merge($contactEntities, $locationEntities))) { @@ -246,17 +246,17 @@ function civicrm_api3_profile_submit($params) { } } if (isset($contactParams['api.contribution.create']) && isset($contactParams['api.membership.create'])) { - $contactParams['api.membership_payment.create'] = array( + $contactParams['api.membership_payment.create'] = [ 'contribution_id' => '$value.api.contribution.create.id', 'membership_id' => '$value.api.membership.create.id', - ); + ]; } if (isset($contactParams['api.contribution.create']) && isset($contactParams['api.participant.create'])) { - $contactParams['api.participant_payment.create'] = array( + $contactParams['api.participant_payment.create'] = [ 'contribution_id' => '$value.api.contribution.create.id', 'participant_id' => '$value.api.participant.create.id', - ); + ]; } $contactParams['contact_id'] = empty($params['contact_id']) ? CRM_Utils_Array::value('id', $params) : $params['contact_id']; @@ -422,7 +422,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) { if (empty($params['contact_id'])) { $config = CRM_Core_Config::singleton(); - $blanks = array( + $blanks = [ 'billing_first_name' => '', 'billing_middle_name' => '', 'billing_last_name' => '', @@ -433,27 +433,27 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) { 'billing_street_address-' . $locationTypeID => '', 'billing_country_id-' . $locationTypeID => $config->defaultContactCountry, 'billing_state_province_id-' . $locationTypeID => $config->defaultContactStateProvince, - ); + ]; return $blanks; } - $addressFields = array('street_address', 'city', 'state_province_id', 'country_id', 'postal_code'); - $result = civicrm_api3('contact', 'getsingle', array( + $addressFields = ['street_address', 'city', 'state_province_id', 'country_id', 'postal_code']; + $result = civicrm_api3('contact', 'getsingle', [ 'id' => $params['contact_id'], - 'api.address.get.1' => array('location_type_id' => 'Billing', 'return' => $addressFields), + 'api.address.get.1' => ['location_type_id' => 'Billing', 'return' => $addressFields], // getting the is_billing required or not is an extra db call but probably cheap enough as this isn't an import api - 'api.address.get.2' => array('is_billing' => TRUE, 'return' => $addressFields), - 'api.email.get.1' => array('location_type_id' => 'Billing'), - 'api.email.get.2' => array('is_billing' => TRUE), + 'api.address.get.2' => ['is_billing' => TRUE, 'return' => $addressFields], + 'api.email.get.1' => ['location_type_id' => 'Billing'], + 'api.email.get.2' => ['is_billing' => TRUE], 'return' => 'api.email.get, api.address.get, api.address.getoptions, country, state_province, email, first_name, last_name, middle_name, ' . implode($addressFields, ','), - ) + ] ); - $values = array( + $values = [ 'billing_first_name' => $result['first_name'], 'billing_middle_name' => $result['middle_name'], 'billing_last_name' => $result['last_name'], - ); + ]; if (!empty($result['api.address.get.1']['count'])) { foreach ($addressFields as $fieldname) { @@ -505,9 +505,9 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) { * @return array|void */ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = 1, $is_flush) { - static $profileFields = array(); + static $profileFields = []; if ($is_flush) { - $profileFields = array(); + $profileFields = []; if (empty($profileID)) { return NULL; } @@ -515,26 +515,26 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = if (isset($profileFields[$profileID])) { return $profileFields[$profileID]; } - $fields = civicrm_api3('uf_field', 'get', array('uf_group_id' => $profileID)); - $entities = array(); + $fields = civicrm_api3('uf_field', 'get', ['uf_group_id' => $profileID]); + $entities = []; foreach ($fields['values'] as $field) { if (!$field['is_active']) { continue; } list($entity, $fieldName) = _civicrm_api3_map_profile_fields_to_entity($field); - $aliasArray = array(); + $aliasArray = []; if (strtolower($fieldName) != $fieldName) { - $aliasArray['api.aliases'] = array($fieldName); + $aliasArray['api.aliases'] = [$fieldName]; $fieldName = strtolower($fieldName); } - $profileFields[$profileID][$fieldName] = array_merge(array( + $profileFields[$profileID][$fieldName] = array_merge([ 'api.required' => $field['is_required'], 'title' => $field['label'], 'help_pre' => CRM_Utils_Array::value('help_pre', $field), 'help_post' => CRM_Utils_Array::value('help_post', $field), 'entity' => $entity, 'weight' => CRM_Utils_Array::value('weight', $field), - ), $aliasArray); + ], $aliasArray); $ufFieldTaleFieldName = $field['field_name']; if (isset($entity[$ufFieldTaleFieldName]['name'])) { @@ -545,7 +545,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = //see function notes // as we build up a list of these we should be able to determine a generic approach // - $hardCodedEntityFields = array( + $hardCodedEntityFields = [ 'state_province' => 'state_province_id', 'country' => 'country_id', 'participant_status' => 'status_id', @@ -555,7 +555,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = 'group' => 'group_id', 'tag' => 'tag_id', 'soft_credit_type' => 'soft_credit_type_id', - ); + ]; if (array_key_exists($ufFieldTaleFieldName, $hardCodedEntityFields)) { $ufFieldTaleFieldName = $hardCodedEntityFields[$ufFieldTaleFieldName]; @@ -565,7 +565,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = } foreach ($entities as $entity => $entityFields) { - $result = civicrm_api3($entity, 'getfields', array('action' => 'create')); + $result = civicrm_api3($entity, 'getfields', ['action' => 'create']); $entityGetFieldsResult = _civicrm_api3_profile_appendaliases($result['values'], $entity); foreach ($entityFields as $entityfield => $realName) { $fieldName = strtolower($entityfield); @@ -591,11 +591,11 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = } $profileFields[$profileID][$fieldName] = array_merge($entityGetFieldsResult[$realName], $profileFields[$profileID][$entityfield]); if (!isset($profileFields[$profileID][$fieldName]['api.aliases'])) { - $profileFields[$profileID][$fieldName]['api.aliases'] = array(); + $profileFields[$profileID][$fieldName]['api.aliases'] = []; } if ($optionsBehaviour && !empty($entityGetFieldsResult[$realName]['pseudoconstant'])) { - if ($optionsBehaviour > 1 || !in_array($realName, array('state_province_id', 'county_id', 'country_id'))) { - $options = civicrm_api3($entity, 'getoptions', array('field' => $realName)); + if ($optionsBehaviour > 1 || !in_array($realName, ['state_province_id', 'county_id', 'country_id'])) { + $options = civicrm_api3($entity, 'getoptions', ['field' => $realName]); $profileFields[$profileID][$fieldName]['options'] = $options['values']; } } @@ -642,12 +642,12 @@ function _civicrm_api3_order_by_weight($a, $b) { */ function _civicrm_api3_map_profile_fields_to_entity(&$field) { $entity = $field['field_type']; - $contactTypes = civicrm_api3('contact', 'getoptions', array('field' => 'contact_type')); + $contactTypes = civicrm_api3('contact', 'getoptions', ['field' => 'contact_type']); if (in_array($entity, $contactTypes['values'])) { $entity = 'contact'; } $entity = _civicrm_api_get_entity_name_from_camel($entity); - $locationFields = array('email' => 'email'); + $locationFields = ['email' => 'email']; $fieldName = $field['field_name']; if (!empty($field['location_type_id'])) { if ($fieldName == 'email') { @@ -672,7 +672,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) { // not a great solution but probably if we looked in the BAO we'd find a scary switch statement // in a perfect world the uf_field table would hold the correct entity for each item // & only the relationships between entities would need to be coded - $hardCodedEntityMappings = array( + $hardCodedEntityMappings = [ 'street_address' => 'address', 'street_number' => 'address', 'supplemental_address_1' => 'address', @@ -698,11 +698,11 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) { 'group' => 'group_contact', 'tag' => 'entity_tag', 'note' => 'note', - ); + ]; if (array_key_exists($fieldName, $hardCodedEntityMappings)) { $entity = $hardCodedEntityMappings[$fieldName]; } - return array($entity, $fieldName); + return [$entity, $fieldName]; } /** @@ -716,7 +716,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) { */ function _civicrm_api3_profile_getProfileID($profileID) { if (!empty($profileID) && strtolower($profileID) != 'billing' && !is_numeric($profileID)) { - $profileID = civicrm_api3('uf_group', 'getvalue', array('return' => 'id', 'name' => $profileID)); + $profileID = civicrm_api3('uf_group', 'getvalue', ['return' => 'id', 'name' => $profileID]); } return $profileID; } @@ -745,8 +745,8 @@ function _civicrm_api3_profile_appendaliases($values, $entity) { } } //special case on membership & contribution - can't see how to handle in a generic way - if (in_array($entity, array('membership', 'contribution'))) { - $values['send_receipt'] = array('title' => 'Send Receipt', 'type' => (int) 16); + if (in_array($entity, ['membership', 'contribution'])) { + $values['send_receipt'] = ['title' => 'Send Receipt', 'type' => (int) 16]; } return $values; } @@ -757,8 +757,8 @@ function _civicrm_api3_profile_appendaliases($values, $entity) { * Array of deprecated actions */ function _civicrm_api3_profile_deprecation() { - return array( + return [ 'set' => 'Profile api "set" action is deprecated in favor of "submit".', 'apply' => 'Profile api "apply" action is deprecated in favor of "submit".', - ); + ]; } diff --git a/api/v3/RecurringEntity.php b/api/v3/RecurringEntity.php index 17fbaa4872..3d7ec66cce 100644 --- a/api/v3/RecurringEntity.php +++ b/api/v3/RecurringEntity.php @@ -52,10 +52,10 @@ function civicrm_api3_recurring_entity_get($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_recurring_entity_get_spec(&$params) { - $params['entity_table']['options'] = array( + $params['entity_table']['options'] = [ 'civicrm_event' => 'civicrm_event', 'civicrm_activity' => 'civicrm_activity', - ); + ]; } /** @@ -78,10 +78,10 @@ function civicrm_api3_recurring_entity_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_recurring_entity_create_spec(&$params) { - $params['entity_table']['options'] = array( + $params['entity_table']['options'] = [ 'civicrm_event' => 'civicrm_event', 'civicrm_activity' => 'civicrm_activity', - ); + ]; $params['entity_table']['api.required'] = 1; } diff --git a/api/v3/Relationship.php b/api/v3/Relationship.php index 30a172e1b6..0a7254cc9a 100644 --- a/api/v3/Relationship.php +++ b/api/v3/Relationship.php @@ -121,7 +121,7 @@ function civicrm_api3_relationship_get($params) { } //perhaps we should add a 'getcount' but at this stage lets just handle getcount output if ($options['is_count']) { - return array('count' => $relationships); + return ['count' => $relationships]; } foreach ($relationships as $relationshipId => $values) { _civicrm_api3_custom_data_get($relationships[$relationshipId], CRM_Utils_Array::value('check_permissions', $params), 'Relationship', $relationshipId, NULL, CRM_Utils_Array::value('relationship_type_id', $values)); @@ -158,7 +158,7 @@ function _civicrm_api3_handle_relationship_type(&$params) { */ function civicrm_api3_relationship_setvalue($params) { require_once 'api/v3/Generic/Setvalue.php'; - $result = civicrm_api3_generic_setValue(array("entity" => 'Relationship', 'params' => $params)); + $result = civicrm_api3_generic_setValue(["entity" => 'Relationship', 'params' => $params]); if (empty($result['is_error']) && CRM_Utils_String::munge($params['field']) == 'is_active') { $action = CRM_Core_Action::DISABLE; diff --git a/api/v3/RelationshipType.php b/api/v3/RelationshipType.php index 6ff0766041..625bca61c0 100644 --- a/api/v3/RelationshipType.php +++ b/api/v3/RelationshipType.php @@ -100,8 +100,8 @@ function civicrm_api3_relationship_type_delete($params) { * @return array */ function _civicrm_api3_relationship_type_getlist_defaults($request) { - return array( + return [ 'label_field' => 'label_a_b', 'search_field' => 'label_a_b', - ); + ]; } diff --git a/api/v3/ReportInstance.php b/api/v3/ReportInstance.php index 9aa67bc356..0e6fb0d32d 100644 --- a/api/v3/ReportInstance.php +++ b/api/v3/ReportInstance.php @@ -71,10 +71,10 @@ function _civicrm_api3_report_instance_create_spec(&$params) { $params['view_mode']['api.default'] = 'view'; $params['view_mode']['title'] = ts('View Mode for Navigation URL'); $params['view_mode']['type'] = CRM_Utils_Type::T_STRING; - $params['view_mode']['options'] = array( + $params['view_mode']['options'] = [ 'view' => ts('View'), 'criteria' => ts('Show Criteria'), - ); + ]; } /** diff --git a/api/v3/ReportTemplate.php b/api/v3/ReportTemplate.php index 4237a6b14e..87d54afdce 100644 --- a/api/v3/ReportTemplate.php +++ b/api/v3/ReportTemplate.php @@ -63,7 +63,7 @@ function civicrm_api3_report_template_create($params) { 'CRM_Core_DAO_OptionGroup', 'report_template', 'id', 'name' ); if (!empty($params['component_id']) && !is_numeric($params['component_id'])) { - $components = CRM_Core_PseudoConstant::get('CRM_Core_DAO_OptionValue', 'component_id', array('onlyActive' => FALSE, 'labelColumn' => 'name')); + $components = CRM_Core_PseudoConstant::get('CRM_Core_DAO_OptionValue', 'component_id', ['onlyActive' => FALSE, 'labelColumn' => 'name']); $params['component_id'] = array_search($params['component_id'], $components); } return civicrm_api3_option_value_create($params); @@ -80,8 +80,8 @@ function civicrm_api3_report_template_create($params) { function _civicrm_api3_report_template_create_spec(&$params) { require_once 'api/v3/OptionValue.php'; _civicrm_api3_option_value_create_spec($params); - $params['value']['api.aliases'] = array('report_url'); - $params['name']['api.aliases'] = array('class_name'); + $params['value']['api.aliases'] = ['report_url']; + $params['name']['api.aliases'] = ['class_name']; $params['option_group_id']['api.default'] = CRM_Core_DAO::getFieldValue( 'CRM_Core_DAO_OptionGroup', 'report_template', 'id', 'name' ); @@ -111,7 +111,7 @@ function civicrm_api3_report_template_delete($params) { * API result array */ function civicrm_api3_report_template_getrows($params) { - civicrm_api3_verify_one_mandatory($params, NULL, array('report_id', 'instance_id')); + civicrm_api3_verify_one_mandatory($params, NULL, ['report_id', 'instance_id']); list($rows, $instance, $metadata) = _civicrm_api3_report_template_getrows($params); $instance->cleanUpTemporaryTables(); return civicrm_api3_create_success($rows, $params, 'ReportTemplate', 'getrows', CRM_Core_DAO::$_nullObject, $metadata); @@ -128,14 +128,14 @@ function civicrm_api3_report_template_getrows($params) { */ function _civicrm_api3_report_template_getrows($params) { if (empty($params['report_id'])) { - $params['report_id'] = civicrm_api3('report_instance', 'getvalue', array('id' => $params['instance_id'], 'return' => 'report_id')); + $params['report_id'] = civicrm_api3('report_instance', 'getvalue', ['id' => $params['instance_id'], 'return' => 'report_id']); } - $class = (string) civicrm_api3('option_value', 'getvalue', array( + $class = (string) civicrm_api3('option_value', 'getvalue', [ 'option_group_name' => 'report_template', 'return' => 'name', 'value' => $params['report_id'], - ) + ] ); $reportInstance = new $class(); @@ -154,7 +154,7 @@ function _civicrm_api3_report_template_getrows($params) { $reportInstance->beginPostProcessCommon(); $sql = $reportInstance->buildQuery(); $reportInstance->addToDeveloperTab($sql); - $rows = $metadata = $requiredMetadata = array(); + $rows = $metadata = $requiredMetadata = []; $reportInstance->buildRows($sql, $rows); $reportInstance->formatDisplay($rows); @@ -174,7 +174,7 @@ function _civicrm_api3_report_template_getrows($params) { $metadata['metadata']['sql'] = $reportInstance->getReportSql(); } } - return array($rows, $reportInstance, $metadata); + return [$rows, $reportInstance, $metadata]; } /** @@ -198,9 +198,9 @@ function civicrm_api3_report_template_getstatistics($params) { * Input parameters. */ function _civicrm_api3_report_template_getrows_spec(&$params) { - $params['report_id'] = array( + $params['report_id'] = [ 'title' => 'Report ID - eg. member/lapse', - ); + ]; } /* @codingStandardsIgnoreStart diff --git a/api/v3/SavedSearch.php b/api/v3/SavedSearch.php index 65f449e10b..4c6b7a2fd4 100644 --- a/api/v3/SavedSearch.php +++ b/api/v3/SavedSearch.php @@ -43,7 +43,7 @@ * @access public */ function civicrm_api3_saved_search_create($params) { - civicrm_api3_verify_one_mandatory($params, NULL, array('form_values', 'where_clause')); + civicrm_api3_verify_one_mandatory($params, NULL, ['form_values', 'where_clause']); // The create function of the dao expects a 'formValues' that is // not serialized. The get function returns form_values, that is // serialized. diff --git a/api/v3/Setting.php b/api/v3/Setting.php index 29df94b76e..21a38ed52d 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -40,17 +40,17 @@ */ function civicrm_api3_setting_getfields($params) { if (!empty($params['action']) && strtolower($params['action']) == 'getvalue') { - $result = array( - 'name' => array( + $result = [ + 'name' => [ 'title' => 'name of setting field', 'api.required' => 1, - 'type' => CRM_Utils_Type::T_STRING), - 'group' => array( + 'type' => CRM_Utils_Type::T_STRING], + 'group' => [ 'api.required' => 0, 'title' => 'Setting Group', 'description' => 'Settings Group. This is required if the setting is not stored in config', - 'type' => CRM_Utils_Type::T_STRING), - ); + 'type' => CRM_Utils_Type::T_STRING], + ]; return civicrm_api3_create_success($result, $params, 'Setting', 'getfields'); } if (!empty($params['name'])) { @@ -60,7 +60,7 @@ function civicrm_api3_setting_getfields($params) { } $result = CRM_Core_BAO_Setting::getSettingSpecification( CRM_Utils_Array::value('component_id', $params), - CRM_Utils_Array::value('filters', $params, array()), + CRM_Utils_Array::value('filters', $params, []), CRM_Utils_Array::value('domain_id', $params, NULL), CRM_Utils_Array::value('profile', $params, NULL) ); @@ -80,18 +80,18 @@ function civicrm_api3_setting_getfields($params) { * @param array $params */ function _civicrm_api3_setting_getfields_spec(&$params) { - $params['filters'] = array( + $params['filters'] = [ 'title' => 'Filters', 'description' => 'Fields you wish to filter by e.g. array("group_name" => "CiviCRM Preferences")', - ); - $params['component_id'] = array( + ]; + $params['component_id'] = [ 'title' => 'Component ID', 'description' => 'ID of relevant component', - ); - $params['profile'] = array( + ]; + $params['profile'] = [ 'title' => 'Profile', 'description' => 'Profile is passed through to hooks & added to cachestring', - ); + ]; } /** @@ -110,9 +110,9 @@ function _civicrm_api3_setting_getfields_spec(&$params) { function civicrm_api3_setting_getdefaults(&$params) { $settings = civicrm_api3('Setting', 'getfields', $params); $domains = _civicrm_api3_setting_getDomainArray($params); - $defaults = array(); + $defaults = []; foreach ($domains as $domainID) { - $defaults[$domainID] = array(); + $defaults[$domainID] = []; foreach ($settings['values'] as $setting => $spec) { if (array_key_exists('default', $spec) && !is_null($spec['default'])) { $defaults[$domainID][$setting] = $spec['default']; @@ -128,12 +128,12 @@ function civicrm_api3_setting_getdefaults(&$params) { * Parameters as passed to the API. */ function _civicrm_api3_setting_getdefaults_spec(&$params) { - $params['domain_id'] = array( + $params['domain_id'] = [ 'api.default' => 'current_domain', 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain an array or "all" are acceptable values for multiple domains', 'title' => 'Setting Domain', - ); + ]; } /** @@ -157,7 +157,7 @@ function civicrm_api3_setting_getoptions($params) { // but it's tightly coupled to DAO/field. However, if you really need to support // more pseudoconstant types, then probably best to refactor it. For now, KISS. if (!empty($pseudoconstant['callback'])) { - $values = Civi\Core\Resolver::singleton()->call($pseudoconstant['callback'], array()); + $values = Civi\Core\Resolver::singleton()->call($pseudoconstant['callback'], []); return civicrm_api3_create_success($values, $params, 'Setting', 'getoptions'); } elseif (!empty($pseudoconstant['optionGroupName'])) { @@ -187,7 +187,7 @@ function civicrm_api3_setting_revert(&$params) { $fields = civicrm_api('Setting', 'getfields', $params); $fields = $fields['values']; $domains = _civicrm_api3_setting_getDomainArray($params); - $result = array(); + $result = []; foreach ($domains as $domainID) { $valuesToRevert = array_intersect_key($defaults['values'][$domainID], $fields); if (!empty($valuesToRevert)) { @@ -207,20 +207,20 @@ function civicrm_api3_setting_revert(&$params) { * @param array $params */ function _civicrm_api3_setting_revert_spec(&$params) { - $params['name'] = array( + $params['name'] = [ 'title' => 'Name', 'description' => 'Setting Name belongs to', - ); - $params['component_id'] = array( + ]; + $params['component_id'] = [ 'title' => 'Component ID', 'description' => 'ID of relevant component', - ); - $params['domain_id'] = array( + ]; + $params['domain_id'] = [ 'api.default' => 'current_domain', 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain' . ' an array or "all" are acceptable values for multiple domains', 'title' => 'Setting Domain', - ); + ]; } /** @@ -235,12 +235,12 @@ function _civicrm_api3_setting_revert_spec(&$params) { function civicrm_api3_setting_fill(&$params) { $defaults = civicrm_api3('Setting', 'getdefaults', $params); $domains = _civicrm_api3_setting_getDomainArray($params); - $result = array(); + $result = []; foreach ($domains as $domainID) { - $apiArray = array( + $apiArray = [ 'version' => $params['version'], 'domain_id' => $domainID, - ); + ]; $existing = civicrm_api3('Setting', 'get', $apiArray); $valuesToFill = array_diff_key($defaults['values'][$domainID], $existing['values'][$domainID]); if (!empty($valuesToFill)) { @@ -256,20 +256,20 @@ function civicrm_api3_setting_fill(&$params) { * @param array $params */ function _civicrm_api3_setting_fill_spec(&$params) { - $params['name'] = array( + $params['name'] = [ 'title' => 'Name', 'description' => 'Setting Name belongs to', - ); - $params['component_id'] = array( + ]; + $params['component_id'] = [ 'title' => 'Component ID', 'description' => 'ID of relevant component', - ); - $params['domain_id'] = array( + ]; + $params['domain_id'] = [ 'api.default' => 'current_domain', 'title' => 'Setting Domain', 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the ' . 'current domain, an array or "all" are acceptable values for multiple domains', - ); + ]; } /** @@ -294,16 +294,16 @@ function civicrm_api3_setting_create($params) { * Parameters as passed to the API. */ function _civicrm_api3_setting_create_spec(&$params) { - $params['domain_id'] = array( + $params['domain_id'] = [ 'api.default' => 'current_domain', 'title' => 'Setting Domain', 'description' => 'if you do not pass in a domain id this will default to the current domain an array or "all" are acceptable values for multiple domains', - ); - $params['group'] = array( + ]; + $params['group'] = [ 'title' => 'Setting Group', 'description' => 'if you know the group defining it will make the api more efficient', - ); + ]; } /** @@ -317,7 +317,7 @@ function _civicrm_api3_setting_create_spec(&$params) { */ function civicrm_api3_setting_get($params) { $domains = _civicrm_api3_setting_getDomainArray($params); - $result = CRM_Core_BAO_Setting::getItems($params, $domains, CRM_Utils_Array::value('return', $params, array())); + $result = CRM_Core_BAO_Setting::getItems($params, $domains, CRM_Utils_Array::value('return', $params, [])); return civicrm_api3_create_success($result, $params, 'Setting', 'get'); } /** @@ -327,15 +327,15 @@ function civicrm_api3_setting_get($params) { * Parameters as passed to the API. */ function _civicrm_api3_setting_get_spec(&$params) { - $params['domain_id'] = array( + $params['domain_id'] = [ 'api.default' => 'current_domain', 'title' => 'Setting Domain', 'description' => 'if you do not pass in a domain id this will default to the current domain', - ); - $params['group'] = array( + ]; + $params['group'] = [ 'title' => 'Setting Group', 'description' => 'if you know the group defining it will make the api more efficient', - ); + ]; } /** * Returns value for specific parameter. @@ -373,27 +373,27 @@ function civicrm_api3_setting_getvalue($params) { */ function _civicrm_api3_setting_getvalue_spec(&$params) { - $params['group'] = array( + $params['group'] = [ 'title' => 'Settings Group', 'api.required' => TRUE, - ); - $params['name'] = array( + ]; + $params['name'] = [ 'title' => 'Setting Name', - 'api.aliases' => array('return'), - ); - $params['default_value'] = array( + 'api.aliases' => ['return'], + ]; + $params['default_value'] = [ 'title' => 'Default Value', - ); - $params['component_id'] = array( + ]; + $params['component_id'] = [ 'title' => 'Component Id', - ); - $params['contact_id'] = array( + ]; + $params['contact_id'] = [ 'title' => 'Contact Id', - ); - $params['domain_id'] = array( + ]; + $params['domain_id'] = [ 'title' => 'Setting Domain', 'description' => 'if you do not pass in a domain id this will default to the current domain', - ); + ]; } /** @@ -421,7 +421,7 @@ function _civicrm_api3_setting_getDomainArray(&$params) { } if ($params['domain_id'] == 'all') { - $domainAPIResult = civicrm_api('domain', 'get', array('version' => 3, 'return' => 'id')); + $domainAPIResult = civicrm_api('domain', 'get', ['version' => 3, 'return' => 'id']); if (isset($domainAPIResult['values'])) { $params['domain_id'] = array_keys($domainAPIResult['values']); } @@ -433,7 +433,7 @@ function _civicrm_api3_setting_getDomainArray(&$params) { $domains = $params['domain_id']; } else { - $domains = array($params['domain_id']); + $domains = [$params['domain_id']]; } return $domains; } diff --git a/api/v3/Survey.php b/api/v3/Survey.php index 45b365c3e4..dbea9f1ec3 100644 --- a/api/v3/Survey.php +++ b/api/v3/Survey.php @@ -99,12 +99,12 @@ function civicrm_api3_survey_delete($params) { * @return array */ function _civicrm_api3_survey_getlist_defaults(&$request) { - return array( - 'description_field' => array( + return [ + 'description_field' => [ 'campaign_id', - ), - 'params' => array( + ], + 'params' => [ 'is_active' => 1, - ), - ); + ], + ]; } diff --git a/api/v3/SurveyRespondant.php b/api/v3/SurveyRespondant.php index f8b663eece..5fccf6bc6f 100644 --- a/api/v3/SurveyRespondant.php +++ b/api/v3/SurveyRespondant.php @@ -56,7 +56,7 @@ function _civicrm_api3_survey_respondant_deprecation() { */ function civicrm_api3_survey_respondant_get(&$params) { - civicrm_api3_verify_one_mandatory($params, NULL, array('survey_id', 'id')); + civicrm_api3_verify_one_mandatory($params, NULL, ['survey_id', 'id']); if (array_key_exists('survey_id', $params)) { $surveyID = $params['survey_id']; @@ -70,7 +70,7 @@ function civicrm_api3_survey_respondant_get(&$params) { $interviewerID = $params['interviewer_id']; } - $statusIds = array(); + $statusIds = []; if (array_key_exists('status_id', $params)) { $statusIds = explode(',', $params['status_id']); } diff --git a/api/v3/System.php b/api/v3/System.php index e704db4952..258afb3445 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -60,16 +60,16 @@ function civicrm_api3_system_flush($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_system_flush_spec(&$params) { - $params['triggers'] = array( + $params['triggers'] = [ 'title' => 'Triggers', 'description' => 'rebuild triggers (boolean)', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $params['session'] = array( + ]; + $params['session'] = [ 'title' => 'Sessions', 'description' => 'refresh sessions (boolean)', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); + ]; } /** @@ -83,53 +83,53 @@ function _civicrm_api3_system_flush_spec(&$params) { * @see http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards */ function _civicrm_api3_system_check_spec(&$spec) { - $spec['id'] = array( + $spec['id'] = [ 'title' => 'ID', 'description' => 'Not a real identifier - do not use', 'type' => CRM_Utils_Type::T_INT, - ); - $spec['name'] = array( + ]; + $spec['name'] = [ 'title' => 'Name', 'description' => 'Unique identifier', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['title'] = array( + ]; + $spec['title'] = [ 'title' => 'Title', 'description' => 'Short title text', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['message'] = array( + ]; + $spec['message'] = [ 'title' => 'Message', 'description' => 'Long description html', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['help'] = array( + ]; + $spec['help'] = [ 'title' => 'Help', 'description' => 'Optional extra help (html string)', 'type' => CRM_Utils_Type::T_STRING, - ); - $spec['severity'] = array( + ]; + $spec['severity'] = [ 'title' => 'Severity', 'description' => 'Psr\Log\LogLevel string', 'type' => CRM_Utils_Type::T_STRING, 'options' => array_combine(CRM_Utils_Check::getSeverityList(), CRM_Utils_Check::getSeverityList()), - ); - $spec['severity_id'] = array( + ]; + $spec['severity_id'] = [ 'title' => 'Severity ID', 'description' => 'Integer representation of Psr\Log\LogLevel', 'type' => CRM_Utils_Type::T_INT, 'options' => CRM_Utils_Check::getSeverityList(), - ); - $spec['is_visible'] = array( + ]; + $spec['is_visible'] = [ 'title' => 'is visible', 'description' => '0 if message has been hidden by the user', 'type' => CRM_Utils_Type::T_BOOLEAN, - ); - $spec['hidden_until'] = array( + ]; + $spec['hidden_until'] = [ 'title' => 'Hidden_until', 'description' => 'When will hidden message be visible again?', 'type' => CRM_Utils_Type::T_DATE, - ); + ]; } /** @@ -146,14 +146,14 @@ function _civicrm_api3_system_check_spec(&$spec) { function civicrm_api3_system_check($params) { // array(array('name'=> $, 'severity'=>$, ...)) $id = 1; - $returnValues = $fields = array(); + $returnValues = $fields = []; _civicrm_api3_system_check_spec($fields); // array(CRM_Utils_Check_Message) $messages = CRM_Utils_Check::checkAll(); foreach ($messages as $msg) { - $returnValues[] = $msg->toArray() + array('id' => $id++); + $returnValues[] = $msg->toArray() + ['id' => $id++]; } return _civicrm_api3_basic_array_get('systemCheck', $params, $returnValues, "id", array_keys($fields)); @@ -171,9 +171,9 @@ function civicrm_api3_system_log($params) { // This part means fields with separate db storage are accepted as params which kind of seems more intuitive to me // because I felt like not doing this required a bunch of explanation in the spec function - but perhaps other won't see it as helpful? if (!isset($params['context'])) { - $params['context'] = array(); + $params['context'] = []; } - $specialFields = array('contact_id', 'hostname'); + $specialFields = ['contact_id', 'hostname']; foreach ($specialFields as $specialField) { if (isset($params[$specialField]) && !isset($params['context'])) { $params['context'][$specialField] = $params[$specialField]; @@ -189,34 +189,34 @@ function civicrm_api3_system_log($params) { * @param array $params */ function _civicrm_api3_system_log_spec(&$params) { - $params['level'] = array( + $params['level'] = [ 'title' => 'Log Level', 'description' => 'Log level as described in PSR3 (info, debug, warning etc)', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => TRUE, - ); - $params['message'] = array( + ]; + $params['message'] = [ 'title' => 'Log Message', 'description' => 'Standardised message string, you can also ', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => TRUE, - ); - $params['context'] = array( + ]; + $params['context'] = [ 'title' => 'Log Context', 'description' => 'An array of additional data to store.', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'api.default' => array(), - ); - $params['contact_id'] = array( + 'api.default' => [], + ]; + $params['contact_id'] = [ 'title' => 'Log Contact ID', 'description' => 'Optional ID of relevant contact', 'type' => CRM_Utils_Type::T_INT, - ); - $params['hostname'] = array( + ]; + $params['hostname'] = [ 'title' => 'Log Hostname', 'description' => 'Optional name of host', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; } /** @@ -228,29 +228,29 @@ function _civicrm_api3_system_log_spec(&$params) { */ function civicrm_api3_system_get($params) { $config = CRM_Core_Config::singleton(); - $returnValues = array( - array( + $returnValues = [ + [ 'version' => CRM_Utils_System::version(), // deprecated in favor of civi.version 'uf' => CIVICRM_UF, // deprecated in favor of cms.type - 'php' => array( + 'php' => [ 'version' => phpversion(), 'time' => time(), 'tz' => date_default_timezone_get(), 'sapi' => php_sapi_name(), 'extensions' => get_loaded_extensions(), 'ini' => _civicrm_api3_system_get_redacted_ini(), - ), - 'mysql' => array( + ], + 'mysql' => [ 'version' => CRM_Core_DAO::singleValueQuery('SELECT @@version'), 'time' => CRM_Core_DAO::singleValueQuery('SELECT unix_timestamp()'), 'vars' => _civicrm_api3_system_get_redacted_mysql(), - ), - 'cms' => array( + ], + 'cms' => [ 'version' => $config->userSystem->getVersion(), 'type' => CIVICRM_UF, 'modules' => CRM_Core_Module::collectStatuses($config->userSystem->getModules()), - ), - 'civi' => array( + ], + 'civi' => [ 'version' => CRM_Utils_System::version(), 'dev' => (bool) CRM_Utils_System::isDevelopment(), 'components' => array_keys(CRM_Core_Component::getEnabledComponents()), @@ -262,20 +262,20 @@ function civicrm_api3_system_get($params) { 'multidomain' => CRM_Core_DAO::singleValueQuery('SELECT count(*) FROM civicrm_domain') > 1, 'settings' => _civicrm_api3_system_get_redacted_settings(), 'exampleUrl' => CRM_Utils_System::url('civicrm/example', NULL, TRUE, NULL, FALSE), - ), - 'http' => array( + ], + 'http' => [ 'software' => CRM_Utils_Array::value('SERVER_SOFTWARE', $_SERVER), 'forwarded' => !empty($_SERVER['HTTP_X_FORWARDED_FOR']) || !empty($_SERVER['X_FORWARDED_PROTO']), 'port' => (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? 'Standard' : 'Nonstandard', - ), - 'os' => array( + ], + 'os' => [ 'type' => php_uname('s'), 'release' => php_uname('r'), 'version' => php_uname('v'), 'machine' => php_uname('m'), - ), - ), - ); + ], + ], + ]; return civicrm_api3_create_success($returnValues, $params, 'System', 'get'); } @@ -308,7 +308,7 @@ function _civicrm_api3_system_get_redacted_ini() { } $inis = ini_get_all(NULL, FALSE); - $result = array(); + $result = []; foreach ($inis as $k => $v) { if (empty($v) || in_array($k, $whitelist)) { $result[$k] = $v; @@ -334,7 +334,7 @@ function _civicrm_api3_system_get_redacted_mysql() { } $inis = ini_get_all(NULL, FALSE); - $result = array(); + $result = []; $dao = CRM_Core_DAO::executeQuery('SHOW VARIABLES'); while ($dao->fetch()) { if (empty($dao->Variable_name) || in_array($dao->Variable_name, $whitelist)) { @@ -360,8 +360,8 @@ function _civicrm_api3_system_get_redacted_settings() { $whitelist = _civicrm_api3_system_get_whitelist(__DIR__ . '/System/setting-whitelist.txt'); } - $apiResult = civicrm_api3('Setting', 'get', array()); - $result = array(); + $apiResult = civicrm_api3('Setting', 'get', []); + $result = []; foreach ($apiResult['values'] as $settings) { foreach ($settings as $key => $value) { if (in_array($key, $whitelist)) { diff --git a/api/v3/Tag.php b/api/v3/Tag.php index 7d66d3741b..a2077a592b 100644 --- a/api/v3/Tag.php +++ b/api/v3/Tag.php @@ -62,7 +62,7 @@ function civicrm_api3_tag_create($params) { function _civicrm_api3_tag_create_spec(&$params) { $params['used_for']['api.default'] = 'civicrm_contact'; $params['name']['api.required'] = 1; - $params['id']['api.aliases'] = array('tag'); + $params['id']['api.aliases'] = ['tag']; } /** diff --git a/api/v3/UFField.php b/api/v3/UFField.php index 765f410bd9..19e676f75f 100644 --- a/api/v3/UFField.php +++ b/api/v3/UFField.php @@ -55,12 +55,12 @@ function _civicrm_api3_uf_field_create_spec(&$params) { $params['field_name']['api.required'] = TRUE; $params['uf_group_id']['api.required'] = TRUE; - $params['option.autoweight'] = array( + $params['option.autoweight'] = [ 'title' => "Auto Weight", 'description' => "Automatically adjust weights in UFGroup to align with UFField", 'type' => CRM_Utils_Type::T_BOOLEAN, 'api.default' => TRUE, - ); + ]; $params['is_active']['api.default'] = TRUE; } @@ -108,5 +108,5 @@ function civicrm_api3_uf_field_delete($params) { */ function _civicrm_api3_uf_field_delete_spec(&$params) { // legacy support for field_id - $params['id']['api.aliases'] = array('field_id'); + $params['id']['api.aliases'] = ['field_id']; } diff --git a/api/v3/UFGroup.php b/api/v3/UFGroup.php index f2b1767380..653ebf02bb 100644 --- a/api/v3/UFGroup.php +++ b/api/v3/UFGroup.php @@ -96,15 +96,15 @@ function civicrm_api3_uf_group_delete($params) { * @return array */ function _civicrm_api3_uf_group_getlist_defaults(&$request) { - return array( - 'description_field' => array( + return [ + 'description_field' => [ 'description', 'group_type', - ), - 'params' => array( + ], + 'params' => [ 'is_active' => 1, - ), - ); + ], + ]; } /** @@ -120,15 +120,15 @@ function _civicrm_api3_uf_group_getlist_defaults(&$request) { * @return array */ function _civicrm_api3_uf_group_getlist_output($result, $request, $entity, $fields) { - $output = array(); + $output = []; if (!empty($result['values'])) { foreach ($result['values'] as $row) { - $data = array( + $data = [ 'id' => $row[$request['id_field']], 'label' => $row[$request['label_field']], - ); + ]; if (!empty($request['description_field'])) { - $data['description'] = array(); + $data['description'] = []; foreach ((array) $request['description_field'] as $field) { if (!empty($row[$field])) { // Special formatting for group_type field diff --git a/api/v3/User.php b/api/v3/User.php index e16ad2ddeb..47ebc7c98a 100644 --- a/api/v3/User.php +++ b/api/v3/User.php @@ -40,16 +40,16 @@ */ function civicrm_api3_user_get($params) { if (empty($params['contact_id'])) { - $params['contact_id'] = civicrm_api3('UFMatch', 'getvalue', array( + $params['contact_id'] = civicrm_api3('UFMatch', 'getvalue', [ 'uf_id' => $params['id'], 'domain_id' => CRM_Core_Config::domainID(), 'return' => 'contact_id', - )); + ]); } $result = CRM_Core_Config::singleton()->userSystem->getUser($params['contact_id']); $result['contact_id'] = $params['contact_id']; return civicrm_api3_create_success( - array($result['id'] => $result), + [$result['id'] => $result], $params, 'user', 'get' @@ -67,17 +67,17 @@ function civicrm_api3_user_get($params) { */ function _civicrm_api3_user_get_spec(&$params) { // At this stage contact-id is required - we may be able to loosen this. - $params['contact_id'] = array( + $params['contact_id'] = [ 'title' => 'Contact ID', 'type' => CRM_Utils_Type::T_INT, 'api.required' => 1, - ); - $params['id'] = array( + ]; + $params['id'] = [ 'title' => 'CMS User ID', 'type' => CRM_Utils_Type::T_INT, - ); - $params['name'] = array( + ]; + $params['name'] = [ 'title' => 'Username', 'type' => CRM_Utils_Type::T_STRING, - ); + ]; } diff --git a/api/v3/examples/Activity/ContactRefCustomField.php b/api/v3/examples/Activity/ContactRefCustomField.php index b7e650b6e3..7c70fcb0b6 100644 --- a/api/v3/examples/Activity/ContactRefCustomField.php +++ b/api/v3/examples/Activity/ContactRefCustomField.php @@ -8,7 +8,7 @@ * API result array */ function activity_create_example() { - $params = array( + $params = [ 'source_contact_id' => 1, 'activity_type_id' => 'Test activity type', 'subject' => 'test activity type id', @@ -19,7 +19,7 @@ function activity_create_example() { 'location' => 'Pennsylvania', 'details' => 'a test activity', 'custom_2' => '1', - ); + ]; try{ $result = civicrm_api3('Activity', 'create', $params); @@ -29,12 +29,12 @@ function activity_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -48,13 +48,13 @@ function activity_create_example() { */ function activity_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'source_record_id' => '', 'activity_type_id' => '9999', @@ -80,9 +80,9 @@ function activity_create_expectedresult() { 'engagement_level' => '', 'weight' => '', 'is_star' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/ContactRefCustomFieldGet.php b/api/v3/examples/Activity/ContactRefCustomFieldGet.php index 47e797e5b5..1b1ee194a3 100644 --- a/api/v3/examples/Activity/ContactRefCustomFieldGet.php +++ b/api/v3/examples/Activity/ContactRefCustomFieldGet.php @@ -8,10 +8,10 @@ * API result array */ function activity_get_example() { - $params = array( + $params = [ 'return.custom_2' => 1, 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Activity', 'get', $params); @@ -21,12 +21,12 @@ function activity_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function activity_get_example() { */ function activity_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'activity_type_id' => '9999', 'subject' => 'test activity type id', @@ -68,9 +68,9 @@ function activity_get_expectedresult() { 'custom_1_1' => 'defaultValue', 'custom_2_1' => 'Anderson, Anthony', 'custom_2_1_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/Create.php b/api/v3/examples/Activity/Create.php index 0a3c1474f3..3d48bdddeb 100644 --- a/api/v3/examples/Activity/Create.php +++ b/api/v3/examples/Activity/Create.php @@ -6,7 +6,7 @@ * API result array */ function activity_create_example() { - $params = array( + $params = [ 'source_contact_id' => 1, 'activity_type_id' => 'Test activity type', 'subject' => 'test activity type id', @@ -17,7 +17,7 @@ function activity_create_example() { 'location' => 'Pennsylvania', 'details' => 'a test activity', 'custom_1' => 'custom string', - ); + ]; try{ $result = civicrm_api3('Activity', 'create', $params); @@ -27,12 +27,12 @@ function activity_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -46,13 +46,13 @@ function activity_create_example() { */ function activity_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'source_record_id' => '', 'activity_type_id' => '9999', @@ -78,9 +78,9 @@ function activity_create_expectedresult() { 'engagement_level' => '', 'weight' => '', 'is_star' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/DateTimeHigh.php b/api/v3/examples/Activity/DateTimeHigh.php index b41659c205..7f8009b078 100644 --- a/api/v3/examples/Activity/DateTimeHigh.php +++ b/api/v3/examples/Activity/DateTimeHigh.php @@ -8,11 +8,11 @@ * API result array */ function activity_get_example() { - $params = array( + $params = [ 'source_contact_id' => 1, 'filter.activity_date_time_high' => '20120101000000', 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('Activity', 'get', $params); @@ -22,12 +22,12 @@ function activity_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function activity_get_example() { */ function activity_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'activity_type_id' => '9999', 'subject' => 'Make-it-Happen Meeting', @@ -63,9 +63,9 @@ function activity_get_expectedresult() { 'is_deleted' => 0, 'is_star' => 0, 'source_contact_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/DateTimeLow.php b/api/v3/examples/Activity/DateTimeLow.php index dec83787de..c4ccee6a68 100644 --- a/api/v3/examples/Activity/DateTimeLow.php +++ b/api/v3/examples/Activity/DateTimeLow.php @@ -8,10 +8,10 @@ * API result array */ function activity_get_example() { - $params = array( + $params = [ 'filter.activity_date_time_low' => '20120101000000', 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('Activity', 'get', $params); @@ -21,12 +21,12 @@ function activity_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function activity_get_example() { */ function activity_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '2', 'activity_type_id' => '9999', 'subject' => 'Make-it-Happen Meeting', @@ -62,9 +62,9 @@ function activity_get_expectedresult() { 'is_deleted' => 0, 'is_star' => 0, 'source_contact_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/Delete.php b/api/v3/examples/Activity/Delete.php index f2e9bbfa57..131e8ad31c 100644 --- a/api/v3/examples/Activity/Delete.php +++ b/api/v3/examples/Activity/Delete.php @@ -6,9 +6,9 @@ * API result array */ function activity_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Activity', 'delete', $params); @@ -18,12 +18,12 @@ function activity_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function activity_delete_example() { */ function activity_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/Get.php b/api/v3/examples/Activity/Get.php index 9a208f9df1..0c8055de06 100644 --- a/api/v3/examples/Activity/Get.php +++ b/api/v3/examples/Activity/Get.php @@ -6,12 +6,12 @@ * API result array */ function activity_get_example() { - $params = array( + $params = [ 'contact_id' => 1, 'activity_type_id' => 9999, 'sequential' => 1, 'return.custom_1' => 1, - ); + ]; try{ $result = civicrm_api3('Activity', 'get', $params); @@ -21,12 +21,12 @@ function activity_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function activity_get_example() { */ function activity_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'activity_type_id' => '9999', 'subject' => 'test activity type id', @@ -66,9 +66,9 @@ function activity_get_expectedresult() { 'status' => 'Completed', 'activity_name' => 'Test activity type', 'custom_1_1' => 'custom string', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/GetFields.php b/api/v3/examples/Activity/GetFields.php index 76bca1d500..6155aa26ed 100644 --- a/api/v3/examples/Activity/GetFields.php +++ b/api/v3/examples/Activity/GetFields.php @@ -6,9 +6,9 @@ * API result array */ function activity_getfields_example() { - $params = array( + $params = [ 'action' => 'create', - ); + ]; try{ $result = civicrm_api3('Activity', 'getfields', $params); @@ -18,12 +18,12 @@ function activity_getfields_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function activity_getfields_example() { */ function activity_getfields_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 29, - 'values' => array( - 'source_record_id' => array( + 'values' => [ + 'source_record_id' => [ 'name' => 'source_record_id', 'type' => 1, 'title' => 'Source Record', @@ -50,8 +50,8 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - ), - 'activity_type_id' => array( + ], + 'activity_type_id' => [ 'name' => 'activity_type_id', 'type' => 1, 'title' => 'Activity Type ID', @@ -65,17 +65,17 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'activity_type', 'optionEditPath' => 'civicrm/admin/options/activity_type', - ), - ), - 'activity_date_time' => array( + ], + ], + 'activity_date_time' => [ 'name' => 'activity_date_time', 'type' => 12, 'title' => 'Activity Date', @@ -87,12 +87,12 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'format' => 'activityDateTime', - ), - ), - 'phone_id' => array( + ], + ], + 'phone_id' => [ 'name' => 'phone_id', 'type' => 1, 'title' => 'Phone (called) ID', @@ -101,14 +101,14 @@ function activity_getfields_expectedresult() { 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'FKClassName' => 'CRM_Core_DAO_Phone', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', 'size' => 6, 'maxlength' => 14, - ), + ], 'FKApiName' => 'Phone', - ), - 'phone_number' => array( + ], + 'phone_number' => [ 'name' => 'phone_number', 'type' => 2, 'title' => 'Phone (called) Number', @@ -118,13 +118,13 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, - ), - ), - 'priority_id' => array( + ], + ], + 'priority_id' => [ 'name' => 'priority_id', 'type' => 1, 'title' => 'Priority', @@ -132,17 +132,17 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'priority', 'optionEditPath' => 'civicrm/admin/options/priority', - ), - ), - 'parent_id' => array( + ], + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => 1, 'title' => 'Parent Activity Id', @@ -152,16 +152,16 @@ function activity_getfields_expectedresult() { 'bao' => 'CRM_Activity_BAO_Activity', 'FKClassName' => 'CRM_Activity_DAO_Activity', 'FKApiName' => 'Activity', - ), - 'is_auto' => array( + ], + 'is_auto' => [ 'name' => 'is_auto', 'type' => 16, 'title' => 'Auto', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - ), - 'relationship_id' => array( + ], + 'relationship_id' => [ 'name' => 'relationship_id', 'type' => 1, 'title' => 'Relationship Id', @@ -172,8 +172,8 @@ function activity_getfields_expectedresult() { 'bao' => 'CRM_Activity_BAO_Activity', 'FKClassName' => 'CRM_Contact_DAO_Relationship', 'FKApiName' => 'Relationship', - ), - 'is_current_revision' => array( + ], + 'is_current_revision' => [ 'name' => 'is_current_revision', 'type' => 16, 'title' => 'Is this activity a current revision in versioning chain?', @@ -185,11 +185,11 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'original_id' => array( + ], + ], + 'original_id' => [ 'name' => 'original_id', 'type' => 1, 'title' => 'Original Activity ID ', @@ -199,21 +199,21 @@ function activity_getfields_expectedresult() { 'bao' => 'CRM_Activity_BAO_Activity', 'FKClassName' => 'CRM_Activity_DAO_Activity', 'FKApiName' => 'Activity', - ), - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => 1, 'title' => 'Order', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Text', 'size' => 6, 'maxlength' => 14, - ), - ), - 'is_star' => array( + ], + ], + 'is_star' => [ 'name' => 'is_star', 'type' => 16, 'title' => 'Is Starred', @@ -225,8 +225,8 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - ), - 'id' => array( + ], + 'id' => [ 'name' => 'id', 'type' => 1, 'title' => 'Activity ID', @@ -239,11 +239,11 @@ function activity_getfields_expectedresult() { 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'uniqueName' => 'activity_id', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'activity_id', - ), - ), - 'subject' => array( + ], + ], + 'subject' => [ 'name' => 'subject', 'type' => 2, 'title' => 'Subject', @@ -257,14 +257,14 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, - ), + ], 'uniqueName' => 'activity_subject', - ), - 'duration' => array( + ], + 'duration' => [ 'name' => 'duration', 'type' => 1, 'title' => 'Duration', @@ -276,14 +276,14 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Text', 'size' => 6, 'maxlength' => 14, - ), + ], 'uniqueName' => 'activity_duration', - ), - 'location' => array( + ], + 'location' => [ 'name' => 'location', 'type' => 2, 'title' => 'Location', @@ -297,14 +297,14 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, - ), + ], 'uniqueName' => 'activity_location', - ), - 'details' => array( + ], + 'details' => [ 'name' => 'details', 'type' => 32, 'title' => 'Details', @@ -316,14 +316,14 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', 'rows' => 2, 'cols' => 80, - ), + ], 'uniqueName' => 'activity_details', - ), - 'status_id' => array( + ], + 'status_id' => [ 'name' => 'status_id', 'type' => 1, 'title' => 'Activity Status', @@ -334,21 +334,21 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'activity_status', 'optionEditPath' => 'civicrm/admin/options/activity_status', - ), + ], 'uniqueName' => 'activity_status_id', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'activity_status', - ), - ), - 'is_test' => array( + ], + ], + 'is_test' => [ 'name' => 'is_test', 'type' => 16, 'title' => 'Test', @@ -359,12 +359,12 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Select', - ), + ], 'uniqueName' => 'activity_is_test', - ), - 'medium_id' => array( + ], + 'medium_id' => [ 'name' => 'medium_id', 'type' => 1, 'title' => 'Activity Medium', @@ -373,18 +373,18 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'encounter_medium', 'optionEditPath' => 'civicrm/admin/options/encounter_medium', - ), + ], 'uniqueName' => 'activity_medium_id', - ), - 'result' => array( + ], + 'result' => [ 'name' => 'result', 'type' => 2, 'title' => 'Result', @@ -394,14 +394,14 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, - ), + ], 'uniqueName' => 'activity_result', - ), - 'is_deleted' => array( + ], + 'is_deleted' => [ 'name' => 'is_deleted', 'type' => 16, 'title' => 'Activity is in the Trash', @@ -412,12 +412,12 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Text', - ), + ], 'uniqueName' => 'activity_is_deleted', - ), - 'campaign_id' => array( + ], + 'campaign_id' => [ 'name' => 'campaign_id', 'type' => 1, 'title' => 'Campaign', @@ -429,20 +429,20 @@ function activity_getfields_expectedresult() { 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ), + ], 'uniqueName' => 'activity_campaign_id', 'FKApiName' => 'Campaign', - ), - 'engagement_level' => array( + ], + 'engagement_level' => [ 'name' => 'engagement_level', 'type' => 1, 'title' => 'Engagement Index', @@ -453,18 +453,18 @@ function activity_getfields_expectedresult() { 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'engagement_index', 'optionEditPath' => 'civicrm/admin/options/engagement_index', - ), + ], 'uniqueName' => 'activity_engagement_level', - ), - 'source_contact_id' => array( + ], + 'source_contact_id' => [ 'name' => 'source_contact_id', 'title' => 'Activity Source Contact', 'description' => 'Person who created this activity. Defaults to current user.', @@ -472,33 +472,33 @@ function activity_getfields_expectedresult() { 'FKClassName' => 'CRM_Contact_DAO_Contact', 'api.default' => 'user_contact_id', 'FKApiName' => 'Contact', - ), - 'assignee_contact_id' => array( + ], + 'assignee_contact_id' => [ 'name' => 'assignee_id', 'title' => 'Activity Assignee', 'description' => 'Contact(s) assigned to this activity.', 'type' => 1, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ), - 'target_contact_id' => array( + ], + 'target_contact_id' => [ 'name' => 'target_id', 'title' => 'Activity Target', 'description' => 'Contact(s) participating in this activity.', 'type' => 1, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ), - 'case_id' => array( + ], + 'case_id' => [ 'name' => 'case_id', 'title' => 'Case ID', 'description' => 'For creating an activity as part of a case.', 'type' => 1, 'FKClassName' => 'CRM_Case_DAO_Case', 'FKApiName' => 'Case', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/GetTargetandAssignee.php b/api/v3/examples/Activity/GetTargetandAssignee.php index c225c8d38e..1cdffbae4b 100644 --- a/api/v3/examples/Activity/GetTargetandAssignee.php +++ b/api/v3/examples/Activity/GetTargetandAssignee.php @@ -8,7 +8,7 @@ * API result array */ function activity_create_example() { - $params = array( + $params = [ 'source_contact_id' => 1, 'subject' => 'Make-it-Happen Meeting', 'activity_date_time' => '20110316', @@ -20,7 +20,7 @@ function activity_create_example() { 'priority_id' => 1, 'target_contact_id' => 1, 'assignee_contact_id' => 1, - ); + ]; try{ $result = civicrm_api3('Activity', 'create', $params); @@ -30,12 +30,12 @@ function activity_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -49,13 +49,13 @@ function activity_create_example() { */ function activity_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'source_record_id' => '', 'activity_type_id' => '1', @@ -81,9 +81,9 @@ function activity_create_expectedresult() { 'engagement_level' => '', 'weight' => '', 'is_star' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/GetTargetandAssigneeName.php b/api/v3/examples/Activity/GetTargetandAssigneeName.php index 003b333d37..7eaa7b8f9b 100644 --- a/api/v3/examples/Activity/GetTargetandAssigneeName.php +++ b/api/v3/examples/Activity/GetTargetandAssigneeName.php @@ -8,15 +8,15 @@ * API result array */ function activity_getsingle_example() { - $params = array( + $params = [ 'id' => 1, - 'return' => array( + 'return' => [ '0' => 'source_contact_name', '1' => 'target_contact_name', '2' => 'assignee_contact_name', '3' => 'subject', - ), - ); + ], + ]; try{ $result = civicrm_api3('Activity', 'getsingle', $params); @@ -26,12 +26,12 @@ function activity_getsingle_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,23 +45,23 @@ function activity_getsingle_example() { */ function activity_getsingle_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'id' => '1', 'subject' => 'Make-it-Happen Meeting', 'source_contact_id' => '6', 'source_contact_name' => 'D Bug', - 'target_contact_id' => array( + 'target_contact_id' => [ '1' => '4', - ), - 'target_contact_name' => array( + ], + 'target_contact_name' => [ '3' => 'A Cat', '4' => 'B Good', - ), - 'assignee_contact_id' => array(), - 'assignee_contact_name' => array( + ], + 'assignee_contact_id' => [], + 'assignee_contact_name' => [ '5' => 'C Shore', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Activity/ReturnAssigneeContact.php b/api/v3/examples/Activity/ReturnAssigneeContact.php index 66177e8eaf..3c61ec8b8a 100644 --- a/api/v3/examples/Activity/ReturnAssigneeContact.php +++ b/api/v3/examples/Activity/ReturnAssigneeContact.php @@ -8,14 +8,14 @@ * API result array */ function activity_get_example() { - $params = array( + $params = [ 'activity_id' => 1, 'sequential' => 1, 'return.assignee_contact_id' => 1, - 'api.contact.get' => array( + 'api.contact.get' => [ 'id' => '$value.source_contact_id', - ), - ); + ], + ]; try{ $result = civicrm_api3('Activity', 'get', $params); @@ -25,12 +25,12 @@ function activity_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function activity_get_example() { */ function activity_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'activity_type_id' => '9999', 'subject' => 'test activity type id', @@ -65,17 +65,17 @@ function activity_get_expectedresult() { 'is_current_revision' => '1', 'is_deleted' => 0, 'is_star' => 0, - 'assignee_contact_id' => array( + 'assignee_contact_id' => [ '0' => '3', - ), + ], 'source_contact_id' => '1', - 'api.contact.get' => array( + 'api.contact.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'contact_id' => '1', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -144,12 +144,12 @@ function activity_get_expectedresult() { 'state_province' => '', 'country' => '', 'id' => '1', - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ActivityContact/Create.php b/api/v3/examples/ActivityContact/Create.php index f01e72a521..551318b114 100644 --- a/api/v3/examples/ActivityContact/Create.php +++ b/api/v3/examples/ActivityContact/Create.php @@ -6,11 +6,11 @@ * API result array */ function activity_contact_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'activity_id' => 1, 'record_type_id' => 2, - ); + ]; try{ $result = civicrm_api3('ActivityContact', 'create', $params); @@ -20,12 +20,12 @@ function activity_contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function activity_contact_create_example() { */ function activity_contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 4, - 'values' => array( - '4' => array( + 'values' => [ + '4' => [ 'id' => '4', 'activity_id' => '1', 'contact_id' => '3', 'record_type_id' => '2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ActivityContact/Delete.php b/api/v3/examples/ActivityContact/Delete.php index d627dcac85..e3cc42dceb 100644 --- a/api/v3/examples/ActivityContact/Delete.php +++ b/api/v3/examples/ActivityContact/Delete.php @@ -6,9 +6,9 @@ * API result array */ function activity_contact_delete_example() { - $params = array( + $params = [ 'id' => 8, - ); + ]; try{ $result = civicrm_api3('ActivityContact', 'delete', $params); @@ -18,12 +18,12 @@ function activity_contact_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function activity_contact_delete_example() { */ function activity_contact_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ActivityType/Create.php b/api/v3/examples/ActivityType/Create.php index b3a231503b..10325428f7 100644 --- a/api/v3/examples/ActivityType/Create.php +++ b/api/v3/examples/ActivityType/Create.php @@ -9,14 +9,14 @@ * API result array */ function activity_type_create_example() { - $params = array( + $params = [ 'weight' => '2', 'label' => 'send out letters', 'filter' => 0, 'is_active' => 1, 'is_optgroup' => 1, 'is_default' => 0, - ); + ]; try{ $result = civicrm_api3('ActivityType', 'create', $params); @@ -26,12 +26,12 @@ function activity_type_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,13 +45,13 @@ function activity_type_create_example() { */ function activity_type_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 849, - 'values' => array( - '849' => array( + 'values' => [ + '849' => [ 'id' => '849', 'option_group_id' => '2', 'label' => 'send out letters', @@ -70,10 +70,10 @@ function activity_type_create_expectedresult() { 'visibility_id' => '', 'icon' => '', 'color' => '', - ), - ), + ], + ], 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ActivityType/Get.php b/api/v3/examples/ActivityType/Get.php index 3befa05035..a1d8d70fd9 100644 --- a/api/v3/examples/ActivityType/Get.php +++ b/api/v3/examples/ActivityType/Get.php @@ -9,7 +9,7 @@ * API result array */ function activity_type_get_example() { - $params = array(); + $params = []; try{ $result = civicrm_api3('ActivityType', 'get', $params); @@ -19,12 +19,12 @@ function activity_type_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,11 +38,11 @@ function activity_type_get_example() { */ function activity_type_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 54, - 'values' => array( + 'values' => [ '1' => 'Meeting', '2' => 'Phone Call', '3' => 'Email', @@ -97,9 +97,9 @@ function activity_type_get_expectedresult() { '52' => 'Contact Deleted by Merge', '53' => 'Failed Payment', '54' => 'Close Accounting Period', - ), + ], 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Address/AddressLike.php b/api/v3/examples/Address/AddressLike.php index 74d0da4545..b781816ce6 100644 --- a/api/v3/examples/Address/AddressLike.php +++ b/api/v3/examples/Address/AddressLike.php @@ -8,12 +8,12 @@ * API result array */ function address_get_example() { - $params = array( - 'street_address' => array( + $params = [ + 'street_address' => [ 'LIKE' => '%mb%', - ), + ], 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('Address', 'get', $params); @@ -23,12 +23,12 @@ function address_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function address_get_example() { */ function address_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'contact_id' => '20', 'location_type_id' => '18', @@ -61,9 +61,9 @@ function address_get_expectedresult() { 'postal_code' => '6971 BN', 'country_id' => '1152', 'manual_geo_code' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Address/AddressParse.php b/api/v3/examples/Address/AddressParse.php index 329f7c071d..ddd86d3cc0 100644 --- a/api/v3/examples/Address/AddressParse.php +++ b/api/v3/examples/Address/AddressParse.php @@ -8,12 +8,12 @@ * API result array */ function address_create_example() { - $params = array( + $params = [ 'street_parsing' => 1, 'street_address' => '54A Excelsior Ave. Apt 1C', 'location_type_id' => 7, 'contact_id' => 4, - ); + ]; try{ $result = civicrm_api3('Address', 'create', $params); @@ -23,12 +23,12 @@ function address_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function address_create_example() { */ function address_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '4', 'location_type_id' => '7', @@ -60,9 +60,9 @@ function address_create_expectedresult() { 'street_name' => 'Excelsior Ave.', 'street_unit' => 'Apt 1C', 'manual_geo_code' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Address/AddressSort.php b/api/v3/examples/Address/AddressSort.php index de36d5b903..edde7694d2 100644 --- a/api/v3/examples/Address/AddressSort.php +++ b/api/v3/examples/Address/AddressSort.php @@ -8,13 +8,13 @@ * API result array */ function address_get_example() { - $params = array( - 'options' => array( + $params = [ + 'options' => [ 'sort' => 'street_address DESC', 'limit' => 2, - ), + ], 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('Address', 'get', $params); @@ -24,12 +24,12 @@ function address_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,12 +43,12 @@ function address_get_example() { */ function address_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '2', 'contact_id' => '19', 'location_type_id' => '17', @@ -61,8 +61,8 @@ function address_get_expectedresult() { 'postal_code' => '6971 BN', 'country_id' => '1152', 'manual_geo_code' => 0, - ), - '1' => array( + ], + '1' => [ 'id' => '1', 'contact_id' => '19', 'location_type_id' => '17', @@ -75,9 +75,9 @@ function address_get_expectedresult() { 'postal_code' => '6971 BN', 'country_id' => '1152', 'manual_geo_code' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Address/Create.php b/api/v3/examples/Address/Create.php index cabd73c7be..d4075de134 100644 --- a/api/v3/examples/Address/Create.php +++ b/api/v3/examples/Address/Create.php @@ -6,7 +6,7 @@ * API result array */ function address_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'location_type_id' => 6, 'street_name' => 'Ambachtstraat', @@ -16,7 +16,7 @@ function address_create_example() { 'country_id' => '1152', 'city' => 'Brummen', 'is_primary' => 1, - ); + ]; try{ $result = civicrm_api3('Address', 'create', $params); @@ -26,12 +26,12 @@ function address_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,13 +45,13 @@ function address_create_example() { */ function address_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id' => '3', 'location_type_id' => '6', @@ -64,9 +64,9 @@ function address_create_expectedresult() { 'postal_code' => '6971 BN', 'country_id' => '1152', 'manual_geo_code' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Address/Delete.php b/api/v3/examples/Address/Delete.php index 09e5867669..0f9508a113 100644 --- a/api/v3/examples/Address/Delete.php +++ b/api/v3/examples/Address/Delete.php @@ -6,9 +6,9 @@ * API result array */ function address_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Address', 'delete', $params); @@ -18,12 +18,12 @@ function address_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function address_delete_example() { */ function address_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Address/Get.php b/api/v3/examples/Address/Get.php index f19315e085..89cb571ae3 100644 --- a/api/v3/examples/Address/Get.php +++ b/api/v3/examples/Address/Get.php @@ -6,10 +6,10 @@ * API result array */ function address_get_example() { - $params = array( + $params = [ 'contact_id' => 17, 'street_name' => 'Ambachtstraat', - ); + ]; try{ $result = civicrm_api3('Address', 'get', $params); @@ -19,12 +19,12 @@ function address_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function address_get_example() { */ function address_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '17', 'location_type_id' => '15', @@ -57,9 +57,9 @@ function address_get_expectedresult() { 'postal_code' => '6971 BN', 'country_id' => '1152', 'manual_geo_code' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Address/GetOptions.php b/api/v3/examples/Address/GetOptions.php index 436b1e475a..3ec7f662b9 100644 --- a/api/v3/examples/Address/GetOptions.php +++ b/api/v3/examples/Address/GetOptions.php @@ -6,9 +6,9 @@ * API result array */ function address_getoptions_example() { - $params = array( + $params = [ 'field' => 'location_type_id', - ); + ]; try{ $result = civicrm_api3('Address', 'getoptions', $params); @@ -18,12 +18,12 @@ function address_getoptions_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,18 +37,18 @@ function address_getoptions_example() { */ function address_getoptions_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 5, - 'values' => array( + 'values' => [ '5' => 'Billing', '1' => 'Home', '3' => 'Main', '4' => 'Other', '2' => 'Work', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Batch/Create.php b/api/v3/examples/Batch/Create.php index 6b4c9f1991..e8cf61299b 100644 --- a/api/v3/examples/Batch/Create.php +++ b/api/v3/examples/Batch/Create.php @@ -6,14 +6,14 @@ * API result array */ function batch_create_example() { - $params = array( + $params = [ 'name' => 'New_Batch_04', 'title' => 'New Batch 04', 'description' => 'This is description for New Batch 04', 'total' => '400.44', 'item_count' => 4, 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Batch', 'create', $params); @@ -23,12 +23,12 @@ function batch_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function batch_create_example() { */ function batch_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'name' => 'New_Batch_04', 'title' => 'New Batch 04', @@ -66,9 +66,9 @@ function batch_create_expectedresult() { 'payment_instrument_id' => '', 'exported_date' => '', 'data' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Batch/Delete.php b/api/v3/examples/Batch/Delete.php index bed04ab9bd..a8478434a5 100644 --- a/api/v3/examples/Batch/Delete.php +++ b/api/v3/examples/Batch/Delete.php @@ -6,9 +6,9 @@ * API result array */ function batch_delete_example() { - $params = array( + $params = [ 'id' => 5, - ); + ]; try{ $result = civicrm_api3('Batch', 'delete', $params); @@ -18,12 +18,12 @@ function batch_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function batch_delete_example() { */ function batch_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Batch/Get.php b/api/v3/examples/Batch/Get.php index 9deff39a48..45420adb86 100644 --- a/api/v3/examples/Batch/Get.php +++ b/api/v3/examples/Batch/Get.php @@ -6,9 +6,9 @@ * API result array */ function batch_get_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Batch', 'get', $params); @@ -18,12 +18,12 @@ function batch_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,21 +37,21 @@ function batch_get_example() { */ function batch_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => 'Batch_433397', 'title' => 'Batch_433397', 'modified_date' => '2012-11-14 16:02:35', 'status_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Batch/Update.php b/api/v3/examples/Batch/Update.php index df859472e4..5eed12da7e 100644 --- a/api/v3/examples/Batch/Update.php +++ b/api/v3/examples/Batch/Update.php @@ -6,14 +6,14 @@ * API result array */ function batch_update_example() { - $params = array( + $params = [ 'name' => 'New_Batch_04', 'title' => 'New Batch 04', 'description' => 'This is description for New Batch 04', 'total' => '400.44', 'item_count' => 4, 'id' => 3, - ); + ]; try{ $result = civicrm_api3('batch', 'update', $params); @@ -23,11 +23,11 @@ function batch_update_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function batch_update_example() { */ function batch_update_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'name' => 'New_Batch_04', 'title' => 'New Batch 04', @@ -65,9 +65,9 @@ function batch_update_expectedresult() { 'payment_instrument_id' => '', 'exported_date' => '', 'data' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Campaign/Create.php b/api/v3/examples/Campaign/Create.php index 86f1df29d1..1a8e74242d 100644 --- a/api/v3/examples/Campaign/Create.php +++ b/api/v3/examples/Campaign/Create.php @@ -9,11 +9,11 @@ * API result array */ function campaign_create_example() { - $params = array( + $params = [ 'title' => 'campaign title', 'description' => 'Call people, ask for money', 'created_date' => 'first sat of July 2008', - ); + ]; try{ $result = civicrm_api3('Campaign', 'create', $params); @@ -23,12 +23,12 @@ function campaign_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function campaign_create_example() { */ function campaign_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => 'campaign_title', 'title' => 'campaign title', @@ -66,9 +66,9 @@ function campaign_create_expectedresult() { 'last_modified_date' => '', 'goal_general' => '', 'goal_revenue' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Campaign/Delete.php b/api/v3/examples/Campaign/Delete.php index d6b5fd5eae..b6d5d3c420 100644 --- a/api/v3/examples/Campaign/Delete.php +++ b/api/v3/examples/Campaign/Delete.php @@ -6,9 +6,9 @@ * API result array */ function campaign_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Campaign', 'delete', $params); @@ -18,12 +18,12 @@ function campaign_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function campaign_delete_example() { */ function campaign_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Campaign/Get.php b/api/v3/examples/Campaign/Get.php index afad3b080a..5e6fb6a0f0 100644 --- a/api/v3/examples/Campaign/Get.php +++ b/api/v3/examples/Campaign/Get.php @@ -6,11 +6,11 @@ * API result array */ function campaign_get_example() { - $params = array( + $params = [ 'title' => 'campaign title', 'description' => 'Call people, ask for money', 'created_date' => 'first sat of July 2008', - ); + ]; try{ $result = civicrm_api3('Campaign', 'get', $params); @@ -20,12 +20,12 @@ function campaign_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,22 +39,22 @@ function campaign_get_example() { */ function campaign_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'name' => 'campaign_title', 'title' => 'campaign title', 'description' => 'Call people, ask for money', 'is_active' => '1', 'created_date' => '2013-07-28 08:49:19', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Case/Create.php b/api/v3/examples/Case/Create.php index bfffed40bb..d57c589a9c 100644 --- a/api/v3/examples/Case/Create.php +++ b/api/v3/examples/Case/Create.php @@ -6,11 +6,11 @@ * API result array */ function case_create_example() { - $params = array( + $params = [ 'subject' => 'Test case', 'contact_id' => 17, 'case_type' => 'housing_support', - ); + ]; try{ $result = civicrm_api3('Case', 'create', $params); @@ -20,12 +20,12 @@ function case_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function case_create_example() { */ function case_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'case_type_id' => '1', 'subject' => 'Test case', @@ -54,9 +54,9 @@ function case_create_expectedresult() { 'details' => '', 'status_id' => '1', 'is_deleted' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/CaseContact/Get.php b/api/v3/examples/CaseContact/Get.php index b4070df73a..3f12514cea 100644 --- a/api/v3/examples/CaseContact/Get.php +++ b/api/v3/examples/CaseContact/Get.php @@ -6,9 +6,9 @@ * API result array */ function case_contact_get_example() { - $params = array( + $params = [ 'contact_id' => 19, - ); + ]; try{ $result = civicrm_api3('CaseContact', 'get', $params); @@ -18,12 +18,12 @@ function case_contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,19 +37,19 @@ function case_contact_get_example() { */ function case_contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'case_id' => '2', 'contact_id' => '19', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Constant/Get.php b/api/v3/examples/Constant/Get.php index 561e259a1e..c147be4c92 100644 --- a/api/v3/examples/Constant/Get.php +++ b/api/v3/examples/Constant/Get.php @@ -9,9 +9,9 @@ * API result array */ function constant_get_example() { - $params = array( + $params = [ 'name' => 'activityType', - ); + ]; try{ $result = civicrm_api3('Constant', 'get', $params); @@ -21,12 +21,12 @@ function constant_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,11 +40,11 @@ function constant_get_example() { */ function constant_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 36, - 'values' => array( + 'values' => [ '1' => 'Meeting', '2' => 'Phone Call', '3' => 'Email', @@ -81,9 +81,9 @@ function constant_get_expectedresult() { '52' => 'Contact Deleted by Merge', '53' => 'Failed Payment', '54' => 'Close Accounting Period', - ), + ], 'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/APIChainedArray.php b/api/v3/examples/Contact/APIChainedArray.php index 4a6ed7ea9e..d69e48ce4c 100644 --- a/api/v3/examples/Contact/APIChainedArray.php +++ b/api/v3/examples/Contact/APIChainedArray.php @@ -9,15 +9,15 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'id' => 3, - 'api.website.get' => array(), - 'api.Contribution.get' => array( + 'api.website.get' => [], + 'api.Contribution.get' => [ 'total_amount' => '120.00', - ), + ], 'api.CustomValue.get' => 1, 'api.Note.get' => 1, - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -27,12 +27,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -46,13 +46,13 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -121,26 +121,26 @@ function contact_get_expectedresult() { 'state_province' => '', 'country' => '', 'id' => '3', - 'api.website.get' => array( + 'api.website.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'contact_id' => '3', 'url' => 'http://civicrm.org', - ), - ), - ), - 'api.Contribution.get' => array( + ], + ], + ], + 'api.Contribution.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -190,24 +190,24 @@ function contact_get_expectedresult() { 'instrument_id' => '1', 'id' => '2', 'contribution_type_id' => '1', - ), - ), - ), - 'api.CustomValue.get' => array( + ], + ], + ], + 'api.CustomValue.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), - ), - 'api.Note.get' => array( + 'values' => [], + ], + 'api.Note.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), - ), - ), - ), - ); + 'values' => [], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/APIChainedArrayFormats.php b/api/v3/examples/Contact/APIChainedArrayFormats.php index 83f9f60cf9..a0c462fcee 100644 --- a/api/v3/examples/Contact/APIChainedArrayFormats.php +++ b/api/v3/examples/Contact/APIChainedArrayFormats.php @@ -9,16 +9,16 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'id' => 3, - 'api.website.getValue' => array( + 'api.website.getValue' => [ 'return' => 'url', - ), - 'api.Contribution.getCount' => array(), + ], + 'api.Contribution.getCount' => [], 'api.CustomValue.get' => 1, 'api.Note.get' => 1, - 'api.Membership.getCount' => array(), - ); + 'api.Membership.getCount' => [], + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -28,12 +28,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -47,13 +47,13 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -124,22 +124,22 @@ function contact_get_expectedresult() { 'id' => '3', 'api.website.getValue' => 'http://civicrm.org', 'api.Contribution.getCount' => 2, - 'api.CustomValue.get' => array( + 'api.CustomValue.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), - ), - 'api.Note.get' => array( + 'values' => [], + ], + 'api.Note.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), - ), + 'values' => [], + ], 'api.Membership.getCount' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php b/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php index cbc095d01c..555b0d3bc1 100644 --- a/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php +++ b/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php @@ -8,14 +8,14 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'id' => 3, - 'api.website.getValue' => array( + 'api.website.getValue' => [ 'return' => 'url', - ), - 'api.Contribution.getCount' => array(), + ], + 'api.Contribution.getCount' => [], 'api.CustomValue.get' => 1, - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -25,12 +25,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -121,67 +121,67 @@ function contact_get_expectedresult() { 'id' => '3', 'api.website.getValue' => 'http://civicrm.org', 'api.Contribution.getCount' => 2, - 'api.CustomValue.get' => array( + 'api.CustomValue.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 7, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'entity_id' => '3', 'entity_table' => 'Contact', 'latest' => 'value 4', 'id' => '1', - ), - '1' => array( + ], + '1' => [ 'entity_id' => '3', 'entity_table' => 'Contact', 'latest' => 'value 3', 'id' => '2', '1' => 'value 2', '2' => 'value 3', - ), - '2' => array( + ], + '2' => [ 'entity_id' => '3', 'entity_table' => 'Contact', 'latest' => '', 'id' => '3', '1' => 'warm beer', '2' => '', - ), - '3' => array( + ], + '3' => [ 'entity_id' => '3', 'entity_table' => 'Contact', 'latest' => '', 'id' => '4', '1' => '', '2' => '', - ), - '4' => array( + ], + '4' => [ 'entity_id' => '3', 'entity_table' => 'Contact', 'latest' => 'defaultValue', 'id' => '5', '1' => 'defaultValue', - ), - '5' => array( + ], + '5' => [ 'entity_id' => '3', 'entity_table' => 'Contact', 'latest' => 'vegemite', 'id' => '6', '1' => 'vegemite', - ), - '6' => array( + ], + '6' => [ 'entity_id' => '3', 'entity_table' => 'Contact', 'latest' => '', 'id' => '7', '1' => '', - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php b/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php index 6bca265586..91f2eae192 100644 --- a/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php +++ b/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php @@ -9,18 +9,18 @@ * API result array */ function contact_create_example() { - $params = array( + $params = [ 'display_name' => 'batman', 'contact_type' => 'Individual', - 'api.tag.create' => array( + 'api.tag.create' => [ 'name' => '$value.id', 'description' => '$value.display_name', 'format.only_id' => 1, - ), - 'api.entity_tag.create' => array( + ], + 'api.entity_tag.create' => [ 'tag_id' => '$value.api.tag.create', - ), - ); + ], + ]; try{ $result = civicrm_api3('Contact', 'create', $params); @@ -30,12 +30,12 @@ function contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -49,13 +49,13 @@ function contact_create_example() { */ function contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -106,15 +106,15 @@ function contact_create_expectedresult() { 'created_date' => '2013-07-28 08:49:19', 'modified_date' => '2012-11-14 16:02:35', 'api.tag.create' => 6, - 'api.entity_tag.create' => array( + 'api.entity_tag.create' => [ 'is_error' => 0, 'not_added' => 1, 'added' => 1, 'total_count' => 2, - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/ChainTwoWebsites.php b/api/v3/examples/Contact/ChainTwoWebsites.php index 0c1f887ed4..1d2d015967 100644 --- a/api/v3/examples/Contact/ChainTwoWebsites.php +++ b/api/v3/examples/Contact/ChainTwoWebsites.php @@ -8,12 +8,12 @@ * API result array */ function contact_create_example() { - $params = array( + $params = [ 'first_name' => 'abc3', 'last_name' => 'xyz3', 'contact_type' => 'Individual', 'email' => 'man3@yahoo.com', - 'api.contribution.create' => array( + 'api.contribution.create' => [ 'receive_date' => '2010-01-01', 'total_amount' => '100', 'financial_type_id' => 1, @@ -25,14 +25,14 @@ function contact_create_example() { 'invoice_id' => 67990, 'source' => 'SSF', 'contribution_status_id' => 1, - ), - 'api.website.create' => array( + ], + 'api.website.create' => [ 'url' => 'http://civicrm.org', - ), - 'api.website.create.2' => array( + ], + 'api.website.create.2' => [ 'url' => 'http://chained.org', - ), - ); + ], + ]; try{ $result = civicrm_api3('Contact', 'create', $params); @@ -42,12 +42,12 @@ function contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -61,13 +61,13 @@ function contact_create_example() { */ function contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -117,13 +117,13 @@ function contact_create_expectedresult() { 'user_unique_id' => '', 'created_date' => '2013-07-28 08:49:19', 'modified_date' => '2012-11-14 16:02:35', - 'api.contribution.create' => array( + 'api.contribution.create' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'contact_id' => '3', 'financial_type_id' => '1', @@ -154,40 +154,40 @@ function contact_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ), - 'api.website.create' => array( + ], + ], + ], + 'api.website.create' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'contact_id' => '3', 'url' => 'http://civicrm.org', 'website_type_id' => '', - ), - ), - ), - 'api.website.create.2' => array( + ], + ], + ], + 'api.website.create.2' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '2', 'contact_id' => '3', 'url' => 'http://chained.org', 'website_type_id' => '', - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php b/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php index f6ae673091..d3050a7b94 100644 --- a/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php +++ b/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php @@ -8,12 +8,12 @@ * API result array */ function contact_create_example() { - $params = array( + $params = [ 'first_name' => 'abc3', 'last_name' => 'xyz3', 'contact_type' => 'Individual', 'email' => 'man3@yahoo.com', - 'api.contribution.create' => array( + 'api.contribution.create' => [ 'receive_date' => '2010-01-01', 'total_amount' => '100', 'financial_type_id' => 1, @@ -25,17 +25,17 @@ function contact_create_example() { 'invoice_id' => 67890, 'source' => 'SSF', 'contribution_status_id' => 1, - ), - 'api.website.create' => array( - '0' => array( + ], + 'api.website.create' => [ + '0' => [ 'url' => 'http://civicrm.org', - ), - '1' => array( + ], + '1' => [ 'url' => 'http://chained.org', 'website_type_id' => 2, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Contact', 'create', $params); @@ -45,12 +45,12 @@ function contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -64,13 +64,13 @@ function contact_create_example() { */ function contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -120,13 +120,13 @@ function contact_create_expectedresult() { 'user_unique_id' => '', 'created_date' => '2013-07-28 08:49:19', 'modified_date' => '2012-11-14 16:02:35', - 'api.contribution.create' => array( + 'api.contribution.create' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'contact_id' => '3', 'financial_type_id' => '1', @@ -157,42 +157,42 @@ function contact_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ), - 'api.website.create' => array( - '0' => array( + ], + ], + ], + 'api.website.create' => [ + '0' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'contact_id' => '3', 'url' => 'http://civicrm.org', 'website_type_id' => '', - ), - ), - ), - '1' => array( + ], + ], + ], + '1' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '2', 'contact_id' => '3', 'url' => 'http://chained.org', 'website_type_id' => '2', - ), - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php b/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php index f69947ecc4..c38bd4708b 100644 --- a/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php +++ b/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php @@ -8,9 +8,9 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'id' => 'user_contact_id', - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -20,12 +20,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -113,9 +113,9 @@ function contact_get_expectedresult() { 'state_province' => '', 'country' => '', 'id' => '3', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/Create.php b/api/v3/examples/Contact/Create.php index 107c95ded3..a0727ef7e0 100644 --- a/api/v3/examples/Contact/Create.php +++ b/api/v3/examples/Contact/Create.php @@ -8,12 +8,12 @@ * API result array */ function contact_create_example() { - $params = array( + $params = [ 'first_name' => 'abc1', 'contact_type' => 'Individual', 'last_name' => 'xyz1', 'custom_1' => 'custom string', - ); + ]; try{ $result = civicrm_api3('Contact', 'create', $params); @@ -23,12 +23,12 @@ function contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function contact_create_example() { */ function contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -98,9 +98,9 @@ function contact_create_expectedresult() { 'user_unique_id' => '', 'created_date' => '2013-07-28 08:49:19', 'modified_date' => '2012-11-14 16:02:35', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/CreateParticipantPayment.php b/api/v3/examples/Contact/CreateParticipantPayment.php index 7a66c4277b..9cc9537ae8 100644 --- a/api/v3/examples/Contact/CreateParticipantPayment.php +++ b/api/v3/examples/Contact/CreateParticipantPayment.php @@ -9,25 +9,25 @@ * API result array */ function contact_create_example() { - $params = array( + $params = [ 'contact_type' => 'Individual', 'display_name' => 'dlobo', - 'api.participant' => array( + 'api.participant' => [ 'event_id' => 42, 'status_id' => 1, 'role_id' => 1, 'format.only_id' => 1, - ), - 'api.contribution.create' => array( + ], + 'api.contribution.create' => [ 'financial_type_id' => 1, 'total_amount' => 100, 'format.only_id' => 1, - ), - 'api.participant_payment.create' => array( + ], + 'api.participant_payment.create' => [ 'contribution_id' => '$value.api.contribution.create', 'participant_id' => '$value.api.participant', - ), - ); + ], + ]; try{ $result = civicrm_api3('Contact', 'create', $params); @@ -37,12 +37,12 @@ function contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -56,13 +56,13 @@ function contact_create_example() { */ function contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 5, - 'values' => array( - '5' => array( + 'values' => [ + '5' => [ 'id' => '5', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -114,22 +114,22 @@ function contact_create_expectedresult() { 'modified_date' => '2012-11-14 16:02:35', 'api.participant' => 4, 'api.contribution.create' => 1, - 'api.participant_payment.create' => array( + 'api.participant_payment.create' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'participant_id' => '4', 'contribution_id' => '1', - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/CustomFieldGet.php b/api/v3/examples/Contact/CustomFieldGet.php index 07e8ae1e6e..32e6c2218a 100644 --- a/api/v3/examples/Contact/CustomFieldGet.php +++ b/api/v3/examples/Contact/CustomFieldGet.php @@ -8,10 +8,10 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'return.custom_1' => 1, 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -21,12 +21,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,20 +40,20 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'civicrm_value_testgetwithcu_1_id' => '1', 'custom_1' => 'custom string', 'id' => '3', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php b/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php index c1e47702bf..4e130c6fbf 100644 --- a/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php +++ b/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php @@ -8,10 +8,10 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'return' => 'custom_1', 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -21,12 +21,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,20 +40,20 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'civicrm_value_testgetwithcu_1_id' => '1', 'custom_1' => 'custom string', 'id' => '3', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/Delete.php b/api/v3/examples/Contact/Delete.php index 1bb7f83feb..c6d0df354b 100644 --- a/api/v3/examples/Contact/Delete.php +++ b/api/v3/examples/Contact/Delete.php @@ -6,9 +6,9 @@ * API result array */ function contact_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Contact', 'delete', $params); @@ -18,12 +18,12 @@ function contact_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function contact_delete_example() { */ function contact_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/FormatIsSuccess_Fail.php b/api/v3/examples/Contact/FormatIsSuccess_Fail.php index add6872f4b..c0625de776 100644 --- a/api/v3/examples/Contact/FormatIsSuccess_Fail.php +++ b/api/v3/examples/Contact/FormatIsSuccess_Fail.php @@ -9,10 +9,10 @@ * API result array */ function contact_create_example() { - $params = array( + $params = [ 'id' => 500, 'format.is_success' => 1, - ); + ]; try{ $result = civicrm_api3('Contact', 'create', $params); @@ -22,12 +22,12 @@ function contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/Contact/FormatIsSuccess_True.php b/api/v3/examples/Contact/FormatIsSuccess_True.php index 9f46af903f..14d29195ea 100644 --- a/api/v3/examples/Contact/FormatIsSuccess_True.php +++ b/api/v3/examples/Contact/FormatIsSuccess_True.php @@ -9,10 +9,10 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'id' => 17, 'format.is_success' => 1, - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -22,12 +22,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/Contact/FormatOnlyID.php b/api/v3/examples/Contact/FormatOnlyID.php index e208faeddb..201111a312 100644 --- a/api/v3/examples/Contact/FormatOnlyID.php +++ b/api/v3/examples/Contact/FormatOnlyID.php @@ -10,10 +10,10 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'id' => 17, 'format.only_id' => 1, - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -23,12 +23,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/Contact/FormatSingleValue.php b/api/v3/examples/Contact/FormatSingleValue.php index 49d52becc1..fa3f23783e 100644 --- a/api/v3/examples/Contact/FormatSingleValue.php +++ b/api/v3/examples/Contact/FormatSingleValue.php @@ -10,10 +10,10 @@ * API result array */ function contact_getvalue_example() { - $params = array( + $params = [ 'id' => 17, 'return' => 'display_name', - ); + ]; try{ $result = civicrm_api3('Contact', 'getvalue', $params); @@ -23,12 +23,12 @@ function contact_getvalue_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/Contact/Get.php b/api/v3/examples/Contact/Get.php index 58120fefd2..17b6b62102 100644 --- a/api/v3/examples/Contact/Get.php +++ b/api/v3/examples/Contact/Get.php @@ -6,9 +6,9 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'email' => 'man2@yahoo.com', - ); + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -18,12 +18,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -112,9 +112,9 @@ function contact_get_expectedresult() { 'state_province' => '', 'country' => '', 'id' => '3', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/GetActions.php b/api/v3/examples/Contact/GetActions.php index 585e5e8dca..459b2e1e64 100644 --- a/api/v3/examples/Contact/GetActions.php +++ b/api/v3/examples/Contact/GetActions.php @@ -8,7 +8,7 @@ * API result array */ function contact_getactions_example() { - $params = array(); + $params = []; try{ $result = civicrm_api3('Contact', 'getactions', $params); @@ -18,12 +18,12 @@ function contact_getactions_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,11 +37,11 @@ function contact_getactions_example() { */ function contact_getactions_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 20, - 'values' => array( + 'values' => [ '0' => 'create', '1' => 'delete', '2' => 'duplicatecheck', @@ -62,13 +62,13 @@ function contact_getactions_expectedresult() { '17' => 'setvalue', '18' => 'update', '19' => 'validate', - ), - 'deprecated' => array( + ], + 'deprecated' => [ 'getquick' => 'The "getquick" action is deprecated in favor of "getlist".', 'setvalue' => 'The "setvalue" action is deprecated. Use "create" with an id instead.', 'update' => 'The "update" action is deprecated. Use "create" with an id instead.', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/GetCountContact.php b/api/v3/examples/Contact/GetCountContact.php index 7a775e80f2..5bffef16fc 100644 --- a/api/v3/examples/Contact/GetCountContact.php +++ b/api/v3/examples/Contact/GetCountContact.php @@ -9,9 +9,9 @@ * API result array */ function contact_getcount_example() { - $params = array( + $params = [ 'id' => 17, - ); + ]; try{ $result = civicrm_api3('Contact', 'getcount', $params); @@ -21,12 +21,12 @@ function contact_getcount_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/Contact/GetFieldsOptions.php b/api/v3/examples/Contact/GetFieldsOptions.php index 57972c5252..d800b72680 100644 --- a/api/v3/examples/Contact/GetFieldsOptions.php +++ b/api/v3/examples/Contact/GetFieldsOptions.php @@ -8,12 +8,12 @@ * API result array */ function contact_getfields_example() { - $params = array( - 'options' => array( + $params = [ + 'options' => [ 'get_options' => 'custom_1', - ), + ], 'action' => 'create', - ); + ]; try{ $result = civicrm_api3('Contact', 'getfields', $params); @@ -23,12 +23,12 @@ function contact_getfields_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,12 +42,12 @@ function contact_getfields_example() { */ function contact_getfields_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 55, - 'values' => array( - 'id' => array( + 'values' => [ + 'id' => [ 'name' => 'id', 'type' => 1, 'title' => 'Contact ID', @@ -60,11 +60,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'contact_id', - ), - ), - 'contact_type' => array( + ], + ], + 'contact_type' => [ 'name' => 'contact_type', 'type' => 2, 'title' => 'Contact Type', @@ -76,20 +76,20 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'maxlength' => 64, 'size' => 30, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ), + ], 'api.required' => 1, - ), - 'contact_sub_type' => array( + ], + 'contact_sub_type' => [ 'name' => 'contact_sub_type', 'type' => 2, 'title' => 'Contact Subtype', @@ -103,19 +103,19 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'maxlength' => 255, 'size' => 45, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', - ), - ), - 'do_not_email' => array( + ], + ], + 'do_not_email' => [ 'name' => 'do_not_email', 'type' => 16, 'title' => 'Do Not Email', @@ -127,11 +127,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'do_not_phone' => array( + ], + ], + 'do_not_phone' => [ 'name' => 'do_not_phone', 'type' => 16, 'title' => 'Do Not Phone', @@ -143,11 +143,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'do_not_mail' => array( + ], + ], + 'do_not_mail' => [ 'name' => 'do_not_mail', 'type' => 16, 'title' => 'Do Not Mail', @@ -159,11 +159,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'do_not_sms' => array( + ], + ], + 'do_not_sms' => [ 'name' => 'do_not_sms', 'type' => 16, 'title' => 'Do Not Sms', @@ -175,11 +175,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'do_not_trade' => array( + ], + ], + 'do_not_trade' => [ 'name' => 'do_not_trade', 'type' => 16, 'title' => 'Do Not Trade', @@ -191,11 +191,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'is_opt_out' => array( + ], + ], + 'is_opt_out' => [ 'name' => 'is_opt_out', 'type' => 16, 'title' => 'No Bulk Emails (User Opt Out)', @@ -207,11 +207,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'legal_identifier' => array( + ], + ], + 'legal_identifier' => [ 'name' => 'legal_identifier', 'type' => 2, 'title' => 'Legal Identifier', @@ -227,13 +227,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 32, 'size' => 20, - ), - ), - 'external_identifier' => array( + ], + ], + 'external_identifier' => [ 'name' => 'external_identifier', 'type' => 2, 'title' => 'External Identifier', @@ -248,13 +248,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 8, - ), - ), - 'sort_name' => array( + ], + ], + 'sort_name' => [ 'name' => 'sort_name', 'type' => 2, 'title' => 'Sort Name', @@ -266,13 +266,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, - ), - ), - 'display_name' => array( + ], + ], + 'display_name' => [ 'name' => 'display_name', 'type' => 2, 'title' => 'Display Name', @@ -284,13 +284,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, - ), - ), - 'nick_name' => array( + ], + ], + 'nick_name' => [ 'name' => 'nick_name', 'type' => 2, 'title' => 'Nickname', @@ -305,13 +305,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, - ), - ), - 'legal_name' => array( + ], + ], + 'legal_name' => [ 'name' => 'legal_name', 'type' => 2, 'title' => 'Legal Name', @@ -325,13 +325,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, - ), - ), - 'image_URL' => array( + ], + ], + 'image_URL' => [ 'name' => 'image_URL', 'type' => 32, 'title' => 'Image Url', @@ -342,13 +342,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'File', 'rows' => 2, 'cols' => 80, - ), - ), - 'preferred_communication_method' => array( + ], + ], + 'preferred_communication_method' => [ 'name' => 'preferred_communication_method', 'type' => 2, 'title' => 'Preferred Communication Method', @@ -363,17 +363,17 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'maxlength' => 255, 'size' => 45, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'preferred_communication_method', 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method', - ), - ), - 'preferred_language' => array( + ], + ], + 'preferred_language' => [ 'name' => 'preferred_language', 'type' => 2, 'title' => 'Preferred Language', @@ -387,18 +387,18 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'maxlength' => 5, 'size' => 6, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'languages', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/languages', - ), - ), - 'preferred_mail_format' => array( + ], + ], + 'preferred_mail_format' => [ 'name' => 'preferred_mail_format', 'type' => 2, 'title' => 'Preferred Mail Format', @@ -413,16 +413,16 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'maxlength' => 8, 'size' => 8, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::pmf', - ), - ), - 'hash' => array( + ], + ], + 'hash' => [ 'name' => 'hash', 'type' => 2, 'title' => 'Contact Hash', @@ -434,8 +434,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - ), - 'api_key' => array( + ], + 'api_key' => [ 'name' => 'api_key', 'type' => 2, 'title' => 'Api Key', @@ -445,8 +445,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - ), - 'first_name' => array( + ], + 'first_name' => [ 'name' => 'first_name', 'type' => 2, 'title' => 'First Name', @@ -461,13 +461,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, - ), - ), - 'middle_name' => array( + ], + ], + 'middle_name' => [ 'name' => 'middle_name', 'type' => 2, 'title' => 'Middle Name', @@ -482,13 +482,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, - ), - ), - 'last_name' => array( + ], + ], + 'last_name' => [ 'name' => 'last_name', 'type' => 2, 'title' => 'Last Name', @@ -503,13 +503,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, - ), - ), - 'prefix_id' => array( + ], + ], + 'prefix_id' => [ 'name' => 'prefix_id', 'type' => 1, 'title' => 'Individual Prefix', @@ -522,21 +522,21 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'individual_prefix', 'optionEditPath' => 'civicrm/admin/options/individual_prefix', - ), - 'api.aliases' => array( + ], + 'api.aliases' => [ '0' => 'individual_prefix', '1' => 'individual_prefix_id', - ), - ), - 'suffix_id' => array( + ], + ], + 'suffix_id' => [ 'name' => 'suffix_id', 'type' => 1, 'title' => 'Individual Suffix', @@ -549,21 +549,21 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'individual_suffix', 'optionEditPath' => 'civicrm/admin/options/individual_suffix', - ), - 'api.aliases' => array( + ], + 'api.aliases' => [ '0' => 'individual_suffix', '1' => 'individual_suffix_id', - ), - ), - 'formal_title' => array( + ], + ], + 'formal_title' => [ 'name' => 'formal_title', 'type' => 2, 'title' => 'Formal Title', @@ -577,13 +577,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, - ), - ), - 'communication_style_id' => array( + ], + ], + 'communication_style_id' => [ 'name' => 'communication_style_id', 'type' => 1, 'title' => 'Communication Style', @@ -593,17 +593,17 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'communication_style', 'optionEditPath' => 'civicrm/admin/options/communication_style', - ), - ), - 'email_greeting_id' => array( + ], + ], + 'email_greeting_id' => [ 'name' => 'email_greeting_id', 'type' => 1, 'title' => 'Email Greeting ID', @@ -611,8 +611,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - ), - 'email_greeting_custom' => array( + ], + 'email_greeting_custom' => [ 'name' => 'email_greeting_custom', 'type' => 2, 'title' => 'Email Greeting Custom', @@ -624,13 +624,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, - ), - ), - 'email_greeting_display' => array( + ], + ], + 'email_greeting_display' => [ 'name' => 'email_greeting_display', 'type' => 2, 'title' => 'Email Greeting', @@ -640,13 +640,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, - ), - ), - 'postal_greeting_id' => array( + ], + ], + 'postal_greeting_id' => [ 'name' => 'postal_greeting_id', 'type' => 1, 'title' => 'Postal Greeting ID', @@ -654,13 +654,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'size' => 6, 'maxlength' => 14, - ), - ), - 'postal_greeting_custom' => array( + ], + ], + 'postal_greeting_custom' => [ 'name' => 'postal_greeting_custom', 'type' => 2, 'title' => 'Postal Greeting Custom', @@ -672,13 +672,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, - ), - ), - 'postal_greeting_display' => array( + ], + ], + 'postal_greeting_display' => [ 'name' => 'postal_greeting_display', 'type' => 2, 'title' => 'Postal Greeting', @@ -688,13 +688,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, - ), - ), - 'addressee_id' => array( + ], + ], + 'addressee_id' => [ 'name' => 'addressee_id', 'type' => 1, 'title' => 'Addressee ID', @@ -702,8 +702,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - ), - 'addressee_custom' => array( + ], + 'addressee_custom' => [ 'name' => 'addressee_custom', 'type' => 2, 'title' => 'Addressee Custom', @@ -715,13 +715,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, - ), - ), - 'addressee_display' => array( + ], + ], + 'addressee_display' => [ 'name' => 'addressee_display', 'type' => 2, 'title' => 'Addressee', @@ -731,13 +731,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, - ), - ), - 'job_title' => array( + ], + ], + 'job_title' => [ 'name' => 'job_title', 'type' => 2, 'title' => 'Job Title', @@ -752,13 +752,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 30, - ), - ), - 'gender_id' => array( + ], + ], + 'gender_id' => [ 'name' => 'gender_id', 'type' => 1, 'title' => 'Gender', @@ -770,20 +770,20 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'gender', 'optionEditPath' => 'civicrm/admin/options/gender', - ), - 'api.aliases' => array( + ], + 'api.aliases' => [ '0' => 'gender', - ), - ), - 'birth_date' => array( + ], + ], + 'birth_date' => [ 'name' => 'birth_date', 'type' => 4, 'title' => 'Birth Date', @@ -796,12 +796,12 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'format' => 'birth', - ), - ), - 'is_deceased' => array( + ], + ], + 'is_deceased' => [ 'name' => 'is_deceased', 'type' => 16, 'title' => 'Deceased', @@ -812,11 +812,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), - ), - 'deceased_date' => array( + ], + ], + 'deceased_date' => [ 'name' => 'deceased_date', 'type' => 4, 'title' => 'Deceased Date', @@ -828,12 +828,12 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'format' => 'birth', - ), - ), - 'household_name' => array( + ], + ], + 'household_name' => [ 'name' => 'household_name', 'type' => 2, 'title' => 'Household Name', @@ -848,13 +848,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, - ), - ), - 'primary_contact_id' => array( + ], + ], + 'primary_contact_id' => [ 'name' => 'primary_contact_id', 'type' => 1, 'title' => 'Household Primary Contact ID', @@ -863,14 +863,14 @@ function contact_getfields_expectedresult() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), + ], 'FKApiName' => 'Contact', - ), - 'organization_name' => array( + ], + 'organization_name' => [ 'name' => 'organization_name', 'type' => 2, 'title' => 'Organization Name', @@ -885,13 +885,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, - ), - ), - 'sic_code' => array( + ], + ], + 'sic_code' => [ 'name' => 'sic_code', 'type' => 2, 'title' => 'Sic Code', @@ -905,13 +905,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 8, 'size' => 8, - ), - ), - 'user_unique_id' => array( + ], + ], + 'user_unique_id' => [ 'name' => 'user_unique_id', 'type' => 2, 'title' => 'Unique ID (OpenID)', @@ -927,13 +927,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, - ), - ), - 'created_date' => array( + ], + ], + 'created_date' => [ 'name' => 'created_date', 'type' => 256, 'title' => 'Created Date', @@ -945,8 +945,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - ), - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => 256, 'title' => 'Modified Date', @@ -958,8 +958,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - ), - 'source' => array( + ], + 'source' => [ 'name' => 'source', 'type' => 2, 'title' => 'Contact Source', @@ -973,14 +973,14 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 30, - ), + ], 'uniqueName' => 'contact_source', - ), - 'employer_id' => array( + ], + 'employer_id' => [ 'name' => 'employer_id', 'type' => 1, 'title' => 'Current Employer', @@ -991,15 +991,15 @@ function contact_getfields_expectedresult() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', 'size' => 6, 'maxlength' => 14, - ), + ], 'uniqueName' => 'current_employer_id', 'FKApiName' => 'Contact', - ), - 'is_deleted' => array( + ], + 'is_deleted' => [ 'name' => 'is_deleted', 'type' => 16, 'title' => 'Contact is in Trash', @@ -1009,12 +1009,12 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ), + ], 'uniqueName' => 'contact_is_deleted', - ), - 'custom_1' => array( + ], + 'custom_1' => [ 'label' => 'Our special field', 'groupTitle' => 'select_test_g', 'data_type' => 'String', @@ -1035,32 +1035,32 @@ function contact_getfields_expectedresult() { 'is_required' => '1', 'table_name' => 'civicrm_value_select_test_g_1', 'column_name' => 'our_special_field_1', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'our_special_field_20170207021937', 'optionEditPath' => 'civicrm/admin/options/our_special_field_20170207021937', - ), + ], 'name' => 'custom_1', 'title' => 'Our special field', 'type' => 2, - 'options' => array( + 'options' => [ '1' => 'Label1', '2' => 'Label2', - ), - ), - 'current_employer' => array( + ], + ], + 'current_employer' => [ 'title' => 'Current Employer', 'description' => 'Name of Current Employer', 'type' => 2, 'name' => 'current_employer', - ), - 'dupe_check' => array( + ], + 'dupe_check' => [ 'title' => 'Check for Duplicates', 'description' => 'Throw error if contact create matches dedupe rule', 'type' => 16, 'name' => 'dupe_check', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/GetOptions.php b/api/v3/examples/Contact/GetOptions.php index 454f7a78aa..352a2296ea 100644 --- a/api/v3/examples/Contact/GetOptions.php +++ b/api/v3/examples/Contact/GetOptions.php @@ -8,9 +8,9 @@ * API result array */ function contact_getoptions_example() { - $params = array( + $params = [ 'field' => 'custom_1', - ); + ]; try{ $result = civicrm_api3('Contact', 'getoptions', $params); @@ -20,12 +20,12 @@ function contact_getoptions_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,15 +39,15 @@ function contact_getoptions_example() { */ function contact_getoptions_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( + 'values' => [ '1' => 'Label1', '2' => 'Label2', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/GetSingleContact.php b/api/v3/examples/Contact/GetSingleContact.php index 3bc4f8750f..de75c962f4 100644 --- a/api/v3/examples/Contact/GetSingleContact.php +++ b/api/v3/examples/Contact/GetSingleContact.php @@ -10,9 +10,9 @@ * API result array */ function contact_getsingle_example() { - $params = array( + $params = [ 'id' => 17, - ); + ]; try{ $result = civicrm_api3('Contact', 'getsingle', $params); @@ -22,12 +22,12 @@ function contact_getsingle_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,7 +41,7 @@ function contact_getsingle_example() { */ function contact_getsingle_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'contact_id' => '17', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -110,7 +110,7 @@ function contact_getsingle_expectedresult() { 'state_province' => '', 'country' => '', 'id' => '17', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/GroupFilterUsingContactAPI.php b/api/v3/examples/Contact/GroupFilterUsingContactAPI.php index e341ce7035..43d22f067b 100644 --- a/api/v3/examples/Contact/GroupFilterUsingContactAPI.php +++ b/api/v3/examples/Contact/GroupFilterUsingContactAPI.php @@ -8,14 +8,14 @@ * API result array */ function contact_get_example() { - $params = array( - 'group' => array( - 'IN' => array( + $params = [ + 'group' => [ + 'IN' => [ '0' => 'Test group C', '1' => 'Test group D', - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -25,12 +25,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -119,9 +119,9 @@ function contact_get_expectedresult() { 'state_province' => '', 'country' => '', 'id' => '3', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contact/NestedReplaceEmail.php b/api/v3/examples/Contact/NestedReplaceEmail.php index f4ebd00471..753e3ffa78 100644 --- a/api/v3/examples/Contact/NestedReplaceEmail.php +++ b/api/v3/examples/Contact/NestedReplaceEmail.php @@ -8,38 +8,38 @@ * API result array */ function contact_get_example() { - $params = array( + $params = [ 'id' => 10, - 'api.email.replace' => array( - 'values' => array( - '0' => array( + 'api.email.replace' => [ + 'values' => [ + '0' => [ 'location_type_id' => 20, 'email' => '1-1@example.com', 'is_primary' => 1, - ), - '1' => array( + ], + '1' => [ 'location_type_id' => 20, 'email' => '1-2@example.com', 'is_primary' => 0, - ), - '2' => array( + ], + '2' => [ 'location_type_id' => 20, 'email' => '1-3@example.com', 'is_primary' => 0, - ), - '3' => array( + ], + '3' => [ 'location_type_id' => 21, 'email' => '2-1@example.com', 'is_primary' => 0, - ), - '4' => array( + ], + '4' => [ 'location_type_id' => 21, 'email' => '2-2@example.com', 'is_primary' => 0, - ), - ), - ), - ); + ], + ], + ], + ]; try{ $result = civicrm_api3('Contact', 'get', $params); @@ -49,12 +49,12 @@ function contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -68,13 +68,13 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 10, - 'values' => array( - '10' => array( + 'values' => [ + '10' => [ 'contact_id' => '10', 'contact_type' => 'Organization', 'contact_sub_type' => '', @@ -142,12 +142,12 @@ function contact_get_expectedresult() { 'state_province' => '', 'country' => '', 'id' => '10', - 'api.email.replace' => array( + 'api.email.replace' => [ 'is_error' => 0, 'version' => 3, 'count' => 5, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '18', 'contact_id' => '10', 'location_type_id' => '20', @@ -160,8 +160,8 @@ function contact_get_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '1' => array( + ], + '1' => [ 'id' => '19', 'contact_id' => '10', 'location_type_id' => '20', @@ -174,8 +174,8 @@ function contact_get_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '2' => array( + ], + '2' => [ 'id' => '20', 'contact_id' => '10', 'location_type_id' => '20', @@ -188,8 +188,8 @@ function contact_get_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '3' => array( + ], + '3' => [ 'id' => '21', 'contact_id' => '10', 'location_type_id' => '21', @@ -202,8 +202,8 @@ function contact_get_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '4' => array( + ], + '4' => [ 'id' => '22', 'contact_id' => '10', 'location_type_id' => '21', @@ -216,12 +216,12 @@ function contact_get_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php b/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php index 0ed2701530..fc33466272 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php +++ b/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php @@ -8,7 +8,7 @@ * API result array */ function contribution_create_example() { - $params = array( + $params = [ 'contact_id' => 28, 'receive_date' => '20120511', 'total_amount' => '100', @@ -19,7 +19,7 @@ function contribution_create_example() { 'source' => 'SSF', 'contribution_status_id' => 1, 'honor_contact_id' => 29, - ); + ]; try{ $result = civicrm_api3('Contribution', 'create', $params); @@ -29,12 +29,12 @@ function contribution_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -48,13 +48,13 @@ function contribution_create_example() { */ function contribution_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '28', 'financial_type_id' => '1', @@ -85,9 +85,9 @@ function contribution_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/ContributionCreateWithNote.php b/api/v3/examples/Contribution/ContributionCreateWithNote.php index 394b0c36ad..d9e863ea23 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithNote.php +++ b/api/v3/examples/Contribution/ContributionCreateWithNote.php @@ -8,7 +8,7 @@ * API result array */ function contribution_create_example() { - $params = array( + $params = [ 'contact_id' => 22, 'receive_date' => '2012-01-01', 'total_amount' => '100', @@ -22,7 +22,7 @@ function contribution_create_example() { 'source' => 'SSF', 'contribution_status_id' => 1, 'note' => 'my contribution note', - ); + ]; try{ $result = civicrm_api3('Contribution', 'create', $params); @@ -32,12 +32,12 @@ function contribution_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -51,13 +51,13 @@ function contribution_create_example() { */ function contribution_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '22', 'financial_type_id' => '1', @@ -88,9 +88,9 @@ function contribution_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php b/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php index a798c940b1..e8f3cf62b4 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php +++ b/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php @@ -8,7 +8,7 @@ * API result array */ function contribution_create_example() { - $params = array( + $params = [ 'contact_id' => 24, 'receive_date' => '20120511', 'total_amount' => '100', @@ -18,14 +18,14 @@ function contribution_create_example() { 'net_amount' => '95', 'source' => 'SSF', 'contribution_status_id' => 1, - 'soft_credit' => array( - '1' => array( + 'soft_credit' => [ + '1' => [ 'contact_id' => 25, 'amount' => 50, 'soft_credit_type_id' => 3, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Contribution', 'create', $params); @@ -35,12 +35,12 @@ function contribution_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -54,13 +54,13 @@ function contribution_create_example() { */ function contribution_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '24', 'financial_type_id' => '1', @@ -91,9 +91,9 @@ function contribution_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php b/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php index 5209aa9aea..9698b850e5 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php +++ b/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php @@ -8,7 +8,7 @@ * API result array */ function contribution_create_example() { - $params = array( + $params = [ 'contact_id' => 26, 'receive_date' => '20120511', 'total_amount' => '100', @@ -19,7 +19,7 @@ function contribution_create_example() { 'source' => 'SSF', 'contribution_status_id' => 1, 'soft_credit_to' => 27, - ); + ]; try{ $result = civicrm_api3('Contribution', 'create', $params); @@ -29,12 +29,12 @@ function contribution_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -48,13 +48,13 @@ function contribution_create_example() { */ function contribution_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '26', 'financial_type_id' => '1', @@ -85,9 +85,9 @@ function contribution_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/Create.php b/api/v3/examples/Contribution/Create.php index a1ffbf661b..df458f5908 100644 --- a/api/v3/examples/Contribution/Create.php +++ b/api/v3/examples/Contribution/Create.php @@ -6,7 +6,7 @@ * API result array */ function contribution_create_example() { - $params = array( + $params = [ 'contact_id' => 1, 'receive_date' => '20120511', 'total_amount' => '100', @@ -17,7 +17,7 @@ function contribution_create_example() { 'invoice_id' => 67890, 'source' => 'SSF', 'contribution_status_id' => 2, - ); + ]; try{ $result = civicrm_api3('Contribution', 'create', $params); @@ -27,12 +27,12 @@ function contribution_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -46,13 +46,13 @@ function contribution_create_example() { */ function contribution_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '1', 'financial_type_id' => '1', @@ -84,9 +84,9 @@ function contribution_create_expectedresult() { 'revenue_recognition_date' => '', 'contribution_type_id' => '1', 'invoice_number' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/CreateWithNestedLineItems.php b/api/v3/examples/Contribution/CreateWithNestedLineItems.php index 741e176397..dd23dd07a6 100644 --- a/api/v3/examples/Contribution/CreateWithNestedLineItems.php +++ b/api/v3/examples/Contribution/CreateWithNestedLineItems.php @@ -8,7 +8,7 @@ * API result array */ function contribution_create_example() { - $params = array( + $params = [ 'contact_id' => 11, 'receive_date' => '20120511', 'total_amount' => '100', @@ -22,21 +22,21 @@ function contribution_create_example() { 'source' => 'SSF', 'contribution_status_id' => 1, 'skipLineItem' => 1, - 'api.line_item.create' => array( - '0' => array( + 'api.line_item.create' => [ + '0' => [ 'price_field_id' => 1, 'qty' => 2, 'line_total' => '20', 'unit_price' => '10', - ), - '1' => array( + ], + '1' => [ 'price_field_id' => 1, 'qty' => 1, 'line_total' => '80', 'unit_price' => '80', - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Contribution', 'create', $params); @@ -46,12 +46,12 @@ function contribution_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -65,13 +65,13 @@ function contribution_create_example() { */ function contribution_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '11', 'financial_type_id' => '1', @@ -102,14 +102,14 @@ function contribution_create_expectedresult() { 'tax_amount' => 0, 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - 'api.line_item.create' => array( - '0' => array( + 'api.line_item.create' => [ + '0' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'entity_table' => 'civicrm_contribution', 'entity_id' => '1', @@ -124,16 +124,16 @@ function contribution_create_expectedresult() { 'financial_type_id' => '', 'non_deductible_amount' => '', 'tax_amount' => '', - ), - ), - ), - '1' => array( + ], + ], + ], + '1' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '2', 'entity_table' => 'civicrm_contribution', 'entity_id' => '1', @@ -148,13 +148,13 @@ function contribution_create_expectedresult() { 'financial_type_id' => '', 'non_deductible_amount' => '', 'tax_amount' => '', - ), - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/Delete.php b/api/v3/examples/Contribution/Delete.php index c22b1b102d..bb445f01b5 100644 --- a/api/v3/examples/Contribution/Delete.php +++ b/api/v3/examples/Contribution/Delete.php @@ -6,9 +6,9 @@ * API result array */ function contribution_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Contribution', 'delete', $params); @@ -18,12 +18,12 @@ function contribution_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,15 +37,15 @@ function contribution_delete_example() { */ function contribution_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( + 'values' => [ '1' => 1, - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Contribution/Get.php b/api/v3/examples/Contribution/Get.php index 0c5c06f58f..ee07a1ab53 100644 --- a/api/v3/examples/Contribution/Get.php +++ b/api/v3/examples/Contribution/Get.php @@ -6,9 +6,9 @@ * API result array */ function contribution_get_example() { - $params = array( + $params = [ 'contribution_id' => 1, - ); + ]; try{ $result = civicrm_api3('Contribution', 'get', $params); @@ -18,12 +18,12 @@ function contribution_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function contribution_get_example() { */ function contribution_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -93,9 +93,9 @@ function contribution_get_expectedresult() { 'check_number' => '', 'id' => '1', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionPage/Create.php b/api/v3/examples/ContributionPage/Create.php index 8139aa301a..2b18e3ffca 100644 --- a/api/v3/examples/ContributionPage/Create.php +++ b/api/v3/examples/ContributionPage/Create.php @@ -6,7 +6,7 @@ * API result array */ function contribution_page_create_example() { - $params = array( + $params = [ 'title' => 'Test Contribution Page', 'financial_type_id' => 1, 'currency' => 'NZD', @@ -16,7 +16,7 @@ function contribution_page_create_example() { 'is_email_receipt' => TRUE, 'receipt_from_email' => 'yourconscience@donate.com', 'receipt_from_name' => 'Ego Freud', - ); + ]; try{ $result = civicrm_api3('ContributionPage', 'create', $params); @@ -26,12 +26,12 @@ function contribution_page_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,13 +45,13 @@ function contribution_page_create_example() { */ function contribution_page_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'title' => 'Test Contribution Page', 'intro_text' => '', @@ -97,9 +97,9 @@ function contribution_page_create_expectedresult() { 'campaign_id' => '', 'is_share' => '', 'is_billing_required' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionPage/Delete.php b/api/v3/examples/ContributionPage/Delete.php index b0ffc33052..87221bb754 100644 --- a/api/v3/examples/ContributionPage/Delete.php +++ b/api/v3/examples/ContributionPage/Delete.php @@ -6,9 +6,9 @@ * API result array */ function contribution_page_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('ContributionPage', 'delete', $params); @@ -18,12 +18,12 @@ function contribution_page_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function contribution_page_delete_example() { */ function contribution_page_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionPage/Get.php b/api/v3/examples/ContributionPage/Get.php index 0a6b234e90..f5b2b365ba 100644 --- a/api/v3/examples/ContributionPage/Get.php +++ b/api/v3/examples/ContributionPage/Get.php @@ -6,10 +6,10 @@ * API result array */ function contribution_page_get_example() { - $params = array( + $params = [ 'currency' => 'NZD', 'financial_type_id' => 1, - ); + ]; try{ $result = civicrm_api3('ContributionPage', 'get', $params); @@ -19,12 +19,12 @@ function contribution_page_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function contribution_page_get_example() { */ function contribution_page_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'title' => 'Test Contribution Page', 'financial_type_id' => '1', @@ -68,9 +68,9 @@ function contribution_page_get_expectedresult() { 'is_share' => '1', 'is_billing_required' => 0, 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionPage/Submit.php b/api/v3/examples/ContributionPage/Submit.php index a1d8932776..e58d1ef989 100644 --- a/api/v3/examples/ContributionPage/Submit.php +++ b/api/v3/examples/ContributionPage/Submit.php @@ -8,11 +8,11 @@ * API result array */ function contribution_page_submit_example() { - $params = array( + $params = [ 'id' => 1, - 'pledge_amount' => array( + 'pledge_amount' => [ '2' => 1, - ), + ], 'billing_first_name' => 'Billy', 'billing_middle_name' => 'Goat', 'billing_last_name' => 'Gruff', @@ -20,10 +20,10 @@ function contribution_page_submit_example() { 'payment_processor_id' => 1, 'credit_card_number' => '4111111111111111', 'credit_card_type' => 'Visa', - 'credit_card_exp_date' => array( + 'credit_card_exp_date' => [ 'M' => 9, 'Y' => 2040, - ), + ], 'cvv2' => 123, 'pledge_id' => '1', 'cid' => '83', @@ -31,7 +31,7 @@ function contribution_page_submit_example() { 'amount' => '100', 'is_pledge' => TRUE, 'pledge_block_id' => 2, - ); + ]; try{ $result = civicrm_api3('ContributionPage', 'submit', $params); @@ -41,12 +41,12 @@ function contribution_page_submit_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -60,12 +60,12 @@ function contribution_page_submit_example() { */ function contribution_page_submit_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 0, 'values' => '', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionRecur/Create.php b/api/v3/examples/ContributionRecur/Create.php index fdfac34b8d..dc953c9d4f 100644 --- a/api/v3/examples/ContributionRecur/Create.php +++ b/api/v3/examples/ContributionRecur/Create.php @@ -6,7 +6,7 @@ * API result array */ function contribution_recur_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'installments' => '12', 'frequency_interval' => '1', @@ -15,7 +15,7 @@ function contribution_recur_create_example() { 'start_date' => '2012-01-01 00:00:00', 'currency' => 'USD', 'frequency_unit' => 'day', - ); + ]; try{ $result = civicrm_api3('ContributionRecur', 'create', $params); @@ -25,12 +25,12 @@ function contribution_recur_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function contribution_recur_create_example() { */ function contribution_recur_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '3', 'amount' => '500', @@ -79,9 +79,9 @@ function contribution_recur_create_expectedresult() { 'payment_instrument_id' => '', 'campaign_id' => '', 'is_email_receipt' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionRecur/Delete.php b/api/v3/examples/ContributionRecur/Delete.php index fba4f05850..d27fe4de88 100644 --- a/api/v3/examples/ContributionRecur/Delete.php +++ b/api/v3/examples/ContributionRecur/Delete.php @@ -6,9 +6,9 @@ * API result array */ function contribution_recur_delete_example() { - $params = array( + $params = [ 'id' => 4, - ); + ]; try{ $result = civicrm_api3('ContributionRecur', 'delete', $params); @@ -18,12 +18,12 @@ function contribution_recur_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function contribution_recur_delete_example() { */ function contribution_recur_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionRecur/Get.php b/api/v3/examples/ContributionRecur/Get.php index 44defa9ace..de3ae05666 100644 --- a/api/v3/examples/ContributionRecur/Get.php +++ b/api/v3/examples/ContributionRecur/Get.php @@ -6,9 +6,9 @@ * API result array */ function contribution_recur_get_example() { - $params = array( + $params = [ 'amount' => '500', - ); + ]; try{ $result = civicrm_api3('ContributionRecur', 'get', $params); @@ -18,12 +18,12 @@ function contribution_recur_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function contribution_recur_get_example() { */ function contribution_recur_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id' => '4', 'amount' => '500.00', @@ -60,9 +60,9 @@ function contribution_recur_get_expectedresult() { 'failure_count' => 0, 'auto_renew' => 0, 'is_email_receipt' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionSoft/Create.php b/api/v3/examples/ContributionSoft/Create.php index 8450990dfc..523683a58f 100644 --- a/api/v3/examples/ContributionSoft/Create.php +++ b/api/v3/examples/ContributionSoft/Create.php @@ -6,13 +6,13 @@ * API result array */ function contribution_soft_create_example() { - $params = array( + $params = [ 'contribution_id' => 6, 'contact_id' => 19, 'amount' => '10', 'currency' => 'USD', 'soft_credit_type_id' => 5, - ); + ]; try{ $result = civicrm_api3('ContributionSoft', 'create', $params); @@ -22,12 +22,12 @@ function contribution_soft_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function contribution_soft_create_example() { */ function contribution_soft_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 5, - 'values' => array( - '5' => array( + 'values' => [ + '5' => [ 'id' => '5', 'contribution_id' => '6', 'contact_id' => '19', @@ -58,9 +58,9 @@ function contribution_soft_create_expectedresult() { 'pcp_roll_nickname' => '', 'pcp_personal_note' => '', 'soft_credit_type_id' => '5', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ContributionSoft/Delete.php b/api/v3/examples/ContributionSoft/Delete.php index 0a6ccc5508..5c663ddaa4 100644 --- a/api/v3/examples/ContributionSoft/Delete.php +++ b/api/v3/examples/ContributionSoft/Delete.php @@ -6,9 +6,9 @@ * API result array */ function contribution_soft_delete_example() { - $params = array( + $params = [ 'id' => 7, - ); + ]; try{ $result = civicrm_api3('ContributionSoft', 'delete', $params); @@ -18,12 +18,12 @@ function contribution_soft_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/ContributionSoft/Get.php b/api/v3/examples/ContributionSoft/Get.php index 91f49635fa..00f58d7e95 100644 --- a/api/v3/examples/ContributionSoft/Get.php +++ b/api/v3/examples/ContributionSoft/Get.php @@ -6,9 +6,9 @@ * API result array */ function contribution_soft_get_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('ContributionSoft', 'get', $params); @@ -18,12 +18,12 @@ function contribution_soft_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function contribution_soft_get_example() { */ function contribution_soft_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contribution_id' => '1', 'contact_id' => '4', @@ -51,9 +51,9 @@ function contribution_soft_get_expectedresult() { 'currency' => 'USD', 'pcp_display_in_roll' => 0, 'soft_credit_type_id' => '4', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Country/Create.php b/api/v3/examples/Country/Create.php index 988b9bcfc9..1d76d52b87 100644 --- a/api/v3/examples/Country/Create.php +++ b/api/v3/examples/Country/Create.php @@ -6,11 +6,11 @@ * API result array */ function country_create_example() { - $params = array( + $params = [ 'name' => 'Made Up Land', 'iso_code' => 'ZZ', 'region_id' => 1, - ); + ]; try{ $result = civicrm_api3('Country', 'create', $params); @@ -20,12 +20,12 @@ function country_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function country_create_example() { */ function country_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1254, - 'values' => array( - '1254' => array( + 'values' => [ + '1254' => [ 'id' => '1254', 'name' => 'Made Up Land', 'iso_code' => 'ZZ', @@ -55,9 +55,9 @@ function country_create_expectedresult() { 'ndd_prefix' => '', 'region_id' => '1', 'is_province_abbreviated' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Country/Delete.php b/api/v3/examples/Country/Delete.php index 79fcb15348..07676caec1 100644 --- a/api/v3/examples/Country/Delete.php +++ b/api/v3/examples/Country/Delete.php @@ -6,9 +6,9 @@ * API result array */ function country_delete_example() { - $params = array( + $params = [ 'id' => 1255, - ); + ]; try{ $result = civicrm_api3('Country', 'delete', $params); @@ -18,12 +18,12 @@ function country_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function country_delete_example() { */ function country_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Country/Get.php b/api/v3/examples/Country/Get.php index dcd4d4431e..7ff1292414 100644 --- a/api/v3/examples/Country/Get.php +++ b/api/v3/examples/Country/Get.php @@ -6,9 +6,9 @@ * API result array */ function country_get_example() { - $params = array( + $params = [ 'iso_code' => 'ZZ', - ); + ]; try{ $result = civicrm_api3('Country', 'get', $params); @@ -18,12 +18,12 @@ function country_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,21 +37,21 @@ function country_get_example() { */ function country_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1256, - 'values' => array( - '1256' => array( + 'values' => [ + '1256' => [ 'id' => '1256', 'name' => 'Made Up Land', 'iso_code' => 'ZZ', 'region_id' => '1', 'is_province_abbreviated' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomField/Create.php b/api/v3/examples/CustomField/Create.php index 5316d37f61..a29f9842cb 100644 --- a/api/v3/examples/CustomField/Create.php +++ b/api/v3/examples/CustomField/Create.php @@ -6,7 +6,7 @@ * API result array */ function custom_field_create_example() { - $params = array( + $params = [ 'custom_group_id' => 1, 'name' => 'test_textfield2', 'label' => 'Name1', @@ -17,7 +17,7 @@ function custom_field_create_example() { 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1, - ); + ]; try{ $result = civicrm_api3('CustomField', 'create', $params); @@ -27,12 +27,12 @@ function custom_field_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -46,13 +46,13 @@ function custom_field_create_example() { */ function custom_field_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'custom_group_id' => '1', 'name' => 'test_textfield2', @@ -83,9 +83,9 @@ function custom_field_create_expectedresult() { 'option_group_id' => '', 'filter' => '', 'in_selector' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomField/Delete.php b/api/v3/examples/CustomField/Delete.php index ed130904d7..90c6985ef0 100644 --- a/api/v3/examples/CustomField/Delete.php +++ b/api/v3/examples/CustomField/Delete.php @@ -6,9 +6,9 @@ * API result array */ function custom_field_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('CustomField', 'delete', $params); @@ -18,12 +18,12 @@ function custom_field_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function custom_field_delete_example() { */ function custom_field_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomGroup/Create.php b/api/v3/examples/CustomGroup/Create.php index 5a29551feb..950622f0ea 100644 --- a/api/v3/examples/CustomGroup/Create.php +++ b/api/v3/examples/CustomGroup/Create.php @@ -6,19 +6,19 @@ * API result array */ function custom_group_create_example() { - $params = array( + $params = [ 'title' => 'Test_Group_1', 'name' => 'test_group_1', - 'extends' => array( + 'extends' => [ '0' => 'Individual', - ), + ], 'weight' => 4, 'collapse_display' => 1, 'style' => 'Inline', 'help_pre' => 'This is Pre Help For Test Group 1', 'help_post' => 'This is Post Help For Test Group 1', 'is_active' => 1, - ); + ]; try{ $result = civicrm_api3('CustomGroup', 'create', $params); @@ -28,12 +28,12 @@ function custom_group_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -47,13 +47,13 @@ function custom_group_create_example() { */ function custom_group_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => 'test_group_1', 'title' => 'Test_Group_1', @@ -74,9 +74,9 @@ function custom_group_create_expectedresult() { 'created_id' => '', 'created_date' => '', 'is_reserved' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomGroup/Delete.php b/api/v3/examples/CustomGroup/Delete.php index db517f083f..d05b071399 100644 --- a/api/v3/examples/CustomGroup/Delete.php +++ b/api/v3/examples/CustomGroup/Delete.php @@ -6,9 +6,9 @@ * API result array */ function custom_group_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('CustomGroup', 'delete', $params); @@ -18,12 +18,12 @@ function custom_group_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function custom_group_delete_example() { */ function custom_group_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomGroup/Get.php b/api/v3/examples/CustomGroup/Get.php index 3a8a90a800..1ed12b4930 100644 --- a/api/v3/examples/CustomGroup/Get.php +++ b/api/v3/examples/CustomGroup/Get.php @@ -6,7 +6,7 @@ * API result array */ function custom_group_get_example() { - $params = array(); + $params = []; try{ $result = civicrm_api3('CustomGroup', 'get', $params); @@ -16,12 +16,12 @@ function custom_group_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -35,13 +35,13 @@ function custom_group_get_example() { */ function custom_group_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => 'test_group_1', 'title' => 'Test_Group_1', @@ -56,9 +56,9 @@ function custom_group_get_expectedresult() { 'is_multiple' => 0, 'collapse_adv_display' => 0, 'is_reserved' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomValue/Create.php b/api/v3/examples/CustomValue/Create.php index f53d3a0f18..966133dacd 100644 --- a/api/v3/examples/CustomValue/Create.php +++ b/api/v3/examples/CustomValue/Create.php @@ -6,10 +6,10 @@ * API result array */ function custom_value_create_example() { - $params = array( + $params = [ 'custom_1' => 'customString', 'entity_id' => 3, - ); + ]; try{ $result = civicrm_api3('CustomValue', 'create', $params); @@ -19,11 +19,11 @@ function custom_value_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function custom_value_create_example() { */ function custom_value_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => TRUE, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomValue/FormatFieldName.php b/api/v3/examples/CustomValue/FormatFieldName.php index 8aab39ddf9..b901dade8a 100644 --- a/api/v3/examples/CustomValue/FormatFieldName.php +++ b/api/v3/examples/CustomValue/FormatFieldName.php @@ -8,11 +8,11 @@ * API result array */ function custom_value_get_example() { - $params = array( + $params = [ 'id' => 2, 'entity_id' => 2, 'format.field_names' => 1, - ); + ]; try{ $result = civicrm_api3('CustomValue', 'get', $params); @@ -22,11 +22,11 @@ function custom_value_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,60 +40,60 @@ function custom_value_get_example() { */ function custom_value_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 7, - 'values' => array( - 'mySingleField' => array( + 'values' => [ + 'mySingleField' => [ 'entity_id' => '2', 'latest' => 'value 1', 'id' => 'mySingleField', - ), - 'field_12' => array( + ], + 'field_12' => [ 'entity_id' => '2', 'latest' => 'value 3', 'id' => 'field_12', '1' => 'value 2', '2' => 'value 3', - ), - 'field_22' => array( + ], + 'field_22' => [ 'entity_id' => '2', 'latest' => '', 'id' => 'field_22', '1' => 'warm beer', '2' => '', - ), - 'field_32' => array( + ], + 'field_32' => [ 'entity_id' => '2', 'latest' => '', 'id' => 'field_32', '1' => 'fl* w*', '2' => '', - ), - 'field_13' => array( + ], + 'field_13' => [ 'entity_id' => '2', 'latest' => 'coffee', 'id' => 'field_13', '1' => 'defaultValue', '2' => 'coffee', - ), - 'field_23' => array( + ], + 'field_23' => [ 'entity_id' => '2', 'latest' => 'value 4', 'id' => 'field_23', '1' => '', '2' => 'value 4', - ), - 'field_33' => array( + ], + 'field_33' => [ 'entity_id' => '2', 'latest' => '', 'id' => 'field_33', '1' => 'vegemite', '2' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/CustomValue/Get.php b/api/v3/examples/CustomValue/Get.php index 578f5a3e51..126b6e350f 100644 --- a/api/v3/examples/CustomValue/Get.php +++ b/api/v3/examples/CustomValue/Get.php @@ -8,10 +8,10 @@ * API result array */ function custom_value_get_example() { - $params = array( + $params = [ 'id' => 2, 'entity_id' => 2, - ); + ]; try{ $result = civicrm_api3('CustomValue', 'get', $params); @@ -21,11 +21,11 @@ function custom_value_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,60 +39,60 @@ function custom_value_get_example() { */ function custom_value_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 7, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'entity_id' => '2', 'latest' => 'value 1', 'id' => '1', - ), - '2' => array( + ], + '2' => [ 'entity_id' => '2', 'latest' => 'value 3', 'id' => '2', '1' => 'value 2', '2' => 'value 3', - ), - '3' => array( + ], + '3' => [ 'entity_id' => '2', 'latest' => '', 'id' => '3', '1' => 'warm beer', '2' => '', - ), - '4' => array( + ], + '4' => [ 'entity_id' => '2', 'latest' => '', 'id' => '4', '1' => 'fl* w*', '2' => '', - ), - '5' => array( + ], + '5' => [ 'entity_id' => '2', 'latest' => 'coffee', 'id' => '5', '1' => 'defaultValue', '2' => 'coffee', - ), - '6' => array( + ], + '6' => [ 'entity_id' => '2', 'latest' => 'value 4', 'id' => '6', '1' => '', '2' => 'value 4', - ), - '7' => array( + ], + '7' => [ 'entity_id' => '2', 'latest' => '', 'id' => '7', '1' => 'vegemite', '2' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Domain/Create.php b/api/v3/examples/Domain/Create.php index 71fc08495c..328446478e 100644 --- a/api/v3/examples/Domain/Create.php +++ b/api/v3/examples/Domain/Create.php @@ -6,12 +6,12 @@ * API result array */ function domain_create_example() { - $params = array( + $params = [ 'name' => 'A-team domain', 'description' => 'domain of chaos', 'domain_version' => '4.2', 'contact_id' => 6, - ); + ]; try{ $result = civicrm_api3('Domain', 'create', $params); @@ -21,12 +21,12 @@ function domain_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function domain_create_example() { */ function domain_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'name' => 'A-team domain', 'description' => 'domain of chaos', @@ -55,9 +55,9 @@ function domain_create_expectedresult() { 'locales' => '', 'locale_custom_strings' => '', 'domain_version' => '4.2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Domain/Get.php b/api/v3/examples/Domain/Get.php index 2867d850ca..8ea402bbaa 100644 --- a/api/v3/examples/Domain/Get.php +++ b/api/v3/examples/Domain/Get.php @@ -6,9 +6,9 @@ * API result array */ function domain_get_example() { - $params = array( + $params = [ 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('Domain', 'get', $params); @@ -18,12 +18,12 @@ function domain_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,23 +37,23 @@ function domain_get_example() { */ function domain_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'name' => 'Default Domain Name', 'version' => '4.6.alpha1', 'contact_id' => '3', 'locale_custom_strings' => 'a:1:{s:5:\"en_US\";a:0:{}}', 'domain_email' => 'my@email.com', - 'domain_phone' => array( + 'domain_phone' => [ 'phone_type' => 'Phone', 'phone' => '456-456', - ), - 'domain_address' => array( + ], + 'domain_address' => [ 'street_address' => '45 Penny Lane', 'supplemental_address_1' => '', 'supplemental_address_2' => '', @@ -64,22 +64,22 @@ function domain_get_expectedresult() { 'country_id' => '', 'geo_code_1' => '', 'geo_code_2' => '', - ), + ], 'from_email' => 'info@EXAMPLE.ORG', 'from_name' => 'FIXME', 'domain_version' => '4.6.alpha1', - ), - '1' => array( + ], + '1' => [ 'id' => '2', 'name' => 'Second Domain', 'version' => '4.6.alpha1', 'contact_id' => '2', 'domain_email' => '\"Domain Email\" ', - 'domain_phone' => array( + 'domain_phone' => [ 'phone_type' => 'Phone', 'phone' => '204 555-1001', - ), - 'domain_address' => array( + ], + 'domain_address' => [ 'street_address' => '15 Main St', 'supplemental_address_1' => '', 'supplemental_address_2' => '', @@ -90,13 +90,13 @@ function domain_get_expectedresult() { 'country_id' => '1228', 'geo_code_1' => '41.8328', 'geo_code_2' => '-72.9253', - ), + ], 'from_email' => 'info@EXAMPLE.ORG', 'from_name' => 'FIXME', 'domain_version' => '4.6.alpha1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Email/Create.php b/api/v3/examples/Email/Create.php index aa7b3f24e7..98abb059d1 100644 --- a/api/v3/examples/Email/Create.php +++ b/api/v3/examples/Email/Create.php @@ -6,12 +6,12 @@ * API result array */ function email_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'location_type_id' => 6, 'email' => 'api@a-team.com', 'is_primary' => 1, - ); + ]; try{ $result = civicrm_api3('Email', 'create', $params); @@ -21,12 +21,12 @@ function email_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function email_create_example() { */ function email_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'contact_id' => '3', 'location_type_id' => '6', @@ -59,9 +59,9 @@ function email_create_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Email/Delete.php b/api/v3/examples/Email/Delete.php index fa65dd94ae..4f10a208cb 100644 --- a/api/v3/examples/Email/Delete.php +++ b/api/v3/examples/Email/Delete.php @@ -6,9 +6,9 @@ * API result array */ function email_delete_example() { - $params = array( + $params = [ 'id' => 11, - ); + ]; try{ $result = civicrm_api3('Email', 'delete', $params); @@ -18,12 +18,12 @@ function email_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function email_delete_example() { */ function email_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Email/Replace.php b/api/v3/examples/Email/Replace.php index 650709d46f..f85feea547 100644 --- a/api/v3/examples/Email/Replace.php +++ b/api/v3/examples/Email/Replace.php @@ -6,36 +6,36 @@ * API result array */ function email_replace_example() { - $params = array( + $params = [ 'contact_id' => 9, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'location_type_id' => 18, 'email' => '1-1@example.com', 'is_primary' => 1, - ), - '1' => array( + ], + '1' => [ 'location_type_id' => 18, 'email' => '1-2@example.com', 'is_primary' => 0, - ), - '2' => array( + ], + '2' => [ 'location_type_id' => 18, 'email' => '1-3@example.com', 'is_primary' => 0, - ), - '3' => array( + ], + '3' => [ 'location_type_id' => 19, 'email' => '2-1@example.com', 'is_primary' => 0, - ), - '4' => array( + ], + '4' => [ 'location_type_id' => 19, 'email' => '2-2@example.com', 'is_primary' => 0, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Email', 'replace', $params); @@ -45,12 +45,12 @@ function email_replace_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -64,12 +64,12 @@ function email_replace_example() { */ function email_replace_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 5, - 'values' => array( - '12' => array( + 'values' => [ + '12' => [ 'id' => '12', 'contact_id' => '9', 'location_type_id' => '18', @@ -82,8 +82,8 @@ function email_replace_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '13' => array( + ], + '13' => [ 'id' => '13', 'contact_id' => '9', 'location_type_id' => '18', @@ -96,8 +96,8 @@ function email_replace_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '14' => array( + ], + '14' => [ 'id' => '14', 'contact_id' => '9', 'location_type_id' => '18', @@ -110,8 +110,8 @@ function email_replace_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '15' => array( + ], + '15' => [ 'id' => '15', 'contact_id' => '9', 'location_type_id' => '19', @@ -124,8 +124,8 @@ function email_replace_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - '16' => array( + ], + '16' => [ 'id' => '16', 'contact_id' => '9', 'location_type_id' => '19', @@ -138,9 +138,9 @@ function email_replace_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/EntityBatch/Create.php b/api/v3/examples/EntityBatch/Create.php index 85486c61e0..71bf9bbf30 100644 --- a/api/v3/examples/EntityBatch/Create.php +++ b/api/v3/examples/EntityBatch/Create.php @@ -6,11 +6,11 @@ * API result array */ function entity_batch_create_example() { - $params = array( + $params = [ 'entity_id' => 1, 'batch_id' => 1, 'entity_table' => 'civicrm_financial_trxn', - ); + ]; try{ $result = civicrm_api3('EntityBatch', 'create', $params); @@ -20,12 +20,12 @@ function entity_batch_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function entity_batch_create_example() { */ function entity_batch_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'entity_table' => 'civicrm_financial_trxn', 'entity_id' => '1', 'batch_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/EntityBatch/Delete.php b/api/v3/examples/EntityBatch/Delete.php index ed94376e3f..af39a1564b 100644 --- a/api/v3/examples/EntityBatch/Delete.php +++ b/api/v3/examples/EntityBatch/Delete.php @@ -6,9 +6,9 @@ * API result array */ function entity_batch_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('EntityBatch', 'delete', $params); @@ -18,12 +18,12 @@ function entity_batch_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function entity_batch_delete_example() { */ function entity_batch_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/EntityBatch/Get.php b/api/v3/examples/EntityBatch/Get.php index d1aa10a3e1..fbe65d197a 100644 --- a/api/v3/examples/EntityBatch/Get.php +++ b/api/v3/examples/EntityBatch/Get.php @@ -6,11 +6,11 @@ * API result array */ function entity_batch_get_example() { - $params = array( + $params = [ 'entity_id' => 2, 'batch_id' => 2, 'entity_table' => 'civicrm_financial_trxn', - ); + ]; try{ $result = civicrm_api3('EntityBatch', 'get', $params); @@ -20,12 +20,12 @@ function entity_batch_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function entity_batch_get_example() { */ function entity_batch_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'entity_table' => 'civicrm_financial_trxn', 'entity_id' => '2', 'batch_id' => '2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/EntityTag/Create.php b/api/v3/examples/EntityTag/Create.php index e114b9fbe6..d819a96e80 100644 --- a/api/v3/examples/EntityTag/Create.php +++ b/api/v3/examples/EntityTag/Create.php @@ -6,10 +6,10 @@ * API result array */ function entity_tag_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'tag_id' => '6', - ); + ]; try{ $result = civicrm_api3('EntityTag', 'create', $params); @@ -19,11 +19,11 @@ function entity_tag_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function entity_tag_create_example() { */ function entity_tag_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'not_added' => 0, 'added' => 1, 'total_count' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/EntityTag/Delete.php b/api/v3/examples/EntityTag/Delete.php index 83d812b1bf..f79f4925ef 100644 --- a/api/v3/examples/EntityTag/Delete.php +++ b/api/v3/examples/EntityTag/Delete.php @@ -6,10 +6,10 @@ * API result array */ function entity_tag_delete_example() { - $params = array( + $params = [ 'contact_id_h' => 31, 'tag_id' => '15', - ); + ]; try{ $result = civicrm_api3('EntityTag', 'delete', $params); @@ -19,12 +19,12 @@ function entity_tag_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,12 +38,12 @@ function entity_tag_delete_example() { */ function entity_tag_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'not_removed' => 0, 'removed' => 1, 'total_count' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/EntityTag/Get.php b/api/v3/examples/EntityTag/Get.php index d3b1392145..94bb042ccc 100644 --- a/api/v3/examples/EntityTag/Get.php +++ b/api/v3/examples/EntityTag/Get.php @@ -6,9 +6,9 @@ * API result array */ function entity_tag_get_example() { - $params = array( + $params = [ 'contact_id' => 15, - ); + ]; try{ $result = civicrm_api3('EntityTag', 'get', $params); @@ -18,12 +18,12 @@ function entity_tag_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,20 +37,20 @@ function entity_tag_get_example() { */ function entity_tag_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 5, - 'values' => array( - '5' => array( + 'values' => [ + '5' => [ 'id' => '5', 'entity_table' => 'civicrm_contact', 'entity_id' => '15', 'tag_id' => '10', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Event/ContactRefCustomField.php b/api/v3/examples/Event/ContactRefCustomField.php index 77adb0b8f7..776dcc35a7 100644 --- a/api/v3/examples/Event/ContactRefCustomField.php +++ b/api/v3/examples/Event/ContactRefCustomField.php @@ -8,10 +8,10 @@ * API result array */ function event_get_example() { - $params = array( + $params = [ 'return.custom_2' => 1, 'custom_2' => 4, - ); + ]; try{ $result = civicrm_api3('Event', 'get', $params); @@ -21,12 +21,12 @@ function event_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function event_get_example() { */ function event_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'title' => 'My test event.', 'event_title' => 'My test event.', @@ -79,9 +79,9 @@ function event_get_expectedresult() { 'custom_1' => 'defaultValue', 'custom_2_id' => '4', 'custom_2' => 'Contact, Test', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Event/Create.php b/api/v3/examples/Event/Create.php index d5f0bb942a..b94693c427 100644 --- a/api/v3/examples/Event/Create.php +++ b/api/v3/examples/Event/Create.php @@ -6,7 +6,7 @@ * API result array */ function event_create_example() { - $params = array( + $params = [ 'title' => 'Annual CiviCRM meet', 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', @@ -22,7 +22,7 @@ function event_create_example() { 'is_monetary' => 0, 'is_active' => 1, 'is_show_location' => 0, - ); + ]; try{ $result = civicrm_api3('Event', 'create', $params); @@ -32,12 +32,12 @@ function event_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -51,13 +51,13 @@ function event_create_example() { */ function event_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'title' => 'Annual CiviCRM meet', 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', @@ -127,9 +127,9 @@ function event_create_expectedresult() { 'slot_label_id' => '', 'dedupe_rule_group_id' => '', 'is_billing_required' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Event/Delete.php b/api/v3/examples/Event/Delete.php index 9f12de13c0..9e50397cca 100644 --- a/api/v3/examples/Event/Delete.php +++ b/api/v3/examples/Event/Delete.php @@ -6,9 +6,9 @@ * API result array */ function event_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Event', 'delete', $params); @@ -18,12 +18,12 @@ function event_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function event_delete_example() { */ function event_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Event/Get.php b/api/v3/examples/Event/Get.php index 68637fc4c9..a616f289f2 100644 --- a/api/v3/examples/Event/Get.php +++ b/api/v3/examples/Event/Get.php @@ -6,10 +6,10 @@ * API result array */ function event_get_example() { - $params = array( + $params = [ 'event_title' => 'Annual CiviCRM meet', 'sequential' => TRUE, - ); + ]; try{ $result = civicrm_api3('Event', 'get', $params); @@ -19,12 +19,12 @@ function event_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function event_get_example() { */ function event_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'title' => 'Annual CiviCRM meet', 'event_title' => 'Annual CiviCRM meet', @@ -74,9 +74,9 @@ function event_get_expectedresult() { 'is_share' => '1', 'is_confirm_enabled' => '1', 'is_billing_required' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Event/IsCurrentOption.php b/api/v3/examples/Event/IsCurrentOption.php index 9d60d43064..1c3cc7f06b 100644 --- a/api/v3/examples/Event/IsCurrentOption.php +++ b/api/v3/examples/Event/IsCurrentOption.php @@ -8,9 +8,9 @@ * API result array */ function event_get_example() { - $params = array( + $params = [ 'isCurrent' => 1, - ); + ]; try{ $result = civicrm_api3('Event', 'get', $params); @@ -20,12 +20,12 @@ function event_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function event_get_example() { */ function event_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'title' => 'Annual CiviCRM meet 2', 'event_title' => 'Annual CiviCRM meet 2', @@ -82,9 +82,9 @@ function event_get_expectedresult() { 'is_share' => '1', 'is_confirm_enabled' => '1', 'is_billing_required' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Event/IsFullOption.php b/api/v3/examples/Event/IsFullOption.php index 556e307c48..4afe21ddc2 100644 --- a/api/v3/examples/Event/IsFullOption.php +++ b/api/v3/examples/Event/IsFullOption.php @@ -8,10 +8,10 @@ * API result array */ function event_getsingle_example() { - $params = array( + $params = [ 'id' => 1, 'return.is_full' => 1, - ); + ]; try{ $result = civicrm_api3('Event', 'getsingle', $params); @@ -21,12 +21,12 @@ function event_getsingle_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,7 +40,7 @@ function event_getsingle_example() { */ function event_getsingle_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'id' => '1', 'title' => 'Annual CiviCRM meet', 'event_title' => 'Annual CiviCRM meet', @@ -73,7 +73,7 @@ function event_getsingle_expectedresult() { 'is_billing_required' => 0, 'available_places' => 0, 'is_full' => '1', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Grant/Create.php b/api/v3/examples/Grant/Create.php index f968d9a2a4..ceb0dd71ce 100644 --- a/api/v3/examples/Grant/Create.php +++ b/api/v3/examples/Grant/Create.php @@ -6,7 +6,7 @@ * API result array */ function grant_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'application_received_date' => 'now', 'decision_date' => 'next Monday', @@ -15,7 +15,7 @@ function grant_create_example() { 'rationale' => 'Just Because', 'currency' => 'USD', 'grant_type_id' => 1, - ); + ]; try{ $result = civicrm_api3('Grant', 'create', $params); @@ -25,12 +25,12 @@ function grant_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function grant_create_example() { */ function grant_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '3', 'application_received_date' => '20130728084957', @@ -66,9 +66,9 @@ function grant_create_expectedresult() { 'rationale' => 'Just Because', 'status_id' => '1', 'financial_type_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Grant/Delete.php b/api/v3/examples/Grant/Delete.php index de116031e3..4c0222a01e 100644 --- a/api/v3/examples/Grant/Delete.php +++ b/api/v3/examples/Grant/Delete.php @@ -6,9 +6,9 @@ * API result array */ function grant_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Grant', 'delete', $params); @@ -18,12 +18,12 @@ function grant_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function grant_delete_example() { */ function grant_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Grant/Get.php b/api/v3/examples/Grant/Get.php index 7892098871..a85ffc2317 100644 --- a/api/v3/examples/Grant/Get.php +++ b/api/v3/examples/Grant/Get.php @@ -6,9 +6,9 @@ * API result array */ function grant_get_example() { - $params = array( + $params = [ 'rationale' => 'Just Because', - ); + ]; try{ $result = civicrm_api3('Grant', 'get', $params); @@ -18,12 +18,12 @@ function grant_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function grant_get_example() { */ function grant_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '5', 'application_received_date' => '20130728084957', @@ -53,9 +53,9 @@ function grant_get_expectedresult() { 'currency' => 'USD', 'rationale' => 'Just Because', 'status_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Group/Get.php b/api/v3/examples/Group/Get.php index ca31ca89fc..9c6f7c0e14 100644 --- a/api/v3/examples/Group/Get.php +++ b/api/v3/examples/Group/Get.php @@ -6,9 +6,9 @@ * API result array */ function group_get_example() { - $params = array( + $params = [ 'name' => 'Test Group 1', - ); + ]; try{ $result = civicrm_api3('Group', 'get', $params); @@ -18,12 +18,12 @@ function group_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function group_get_example() { */ function group_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 4, - 'values' => array( - '4' => array( + 'values' => [ + '4' => [ 'id' => '4', 'name' => 'Test Group 1', 'title' => 'New Test Group Created', @@ -53,15 +53,15 @@ function group_get_expectedresult() { 'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) ) ', 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}', 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}', - 'group_type' => array( + 'group_type' => [ '0' => '1', '1' => '2', - ), + ], 'is_hidden' => 0, 'is_reserved' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Group/GetFields.php b/api/v3/examples/Group/GetFields.php index 0247cb3e9e..a93b6f8754 100644 --- a/api/v3/examples/Group/GetFields.php +++ b/api/v3/examples/Group/GetFields.php @@ -8,9 +8,9 @@ * API result array */ function group_getfields_example() { - $params = array( + $params = [ 'action' => 'create', - ); + ]; try{ $result = civicrm_api3('Group', 'getfields', $params); @@ -20,12 +20,12 @@ function group_getfields_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,12 +39,12 @@ function group_getfields_example() { */ function group_getfields_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 20, - 'values' => array( - 'id' => array( + 'values' => [ + 'id' => [ 'name' => 'id', 'type' => 1, 'title' => 'Group ID', @@ -53,11 +53,11 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'group_id', - ), - ), - 'name' => array( + ], + ], + 'name' => [ 'name' => 'name', 'type' => 2, 'title' => 'Group Name', @@ -67,8 +67,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => 2, 'title' => 'Group Title', @@ -79,8 +79,8 @@ function group_getfields_expectedresult() { 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'api.required' => 1, - ), - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => 32, 'title' => 'Group Description', @@ -90,13 +90,13 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - 'html' => array( + 'html' => [ 'type' => 'TextArea', 'rows' => 2, 'cols' => 60, - ), - ), - 'source' => array( + ], + ], + 'source' => [ 'name' => 'source', 'type' => 2, 'title' => 'Group Source', @@ -106,8 +106,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'saved_search_id' => array( + ], + 'saved_search_id' => [ 'name' => 'saved_search_id', 'type' => 1, 'title' => 'Saved Search ID', @@ -117,8 +117,8 @@ function group_getfields_expectedresult() { 'bao' => 'CRM_Contact_BAO_Group', 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', 'FKApiName' => 'SavedSearch', - ), - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => 16, 'title' => 'Group Enabled', @@ -127,8 +127,8 @@ function group_getfields_expectedresult() { 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'api.default' => 1, - ), - 'visibility' => array( + ], + 'visibility' => [ 'name' => 'visibility', 'type' => 2, 'title' => 'Group Visibility Setting', @@ -139,16 +139,16 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - 'html' => array( + 'html' => [ 'type' => 'Select', 'maxlength' => 24, 'size' => 20, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupVisibility', - ), - ), - 'where_clause' => array( + ], + ], + 'where_clause' => [ 'name' => 'where_clause', 'type' => 32, 'title' => 'Group Where Clause', @@ -156,8 +156,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'select_tables' => array( + ], + 'select_tables' => [ 'name' => 'select_tables', 'type' => 32, 'title' => 'Tables For Select Clause', @@ -165,8 +165,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'where_tables' => array( + ], + 'where_tables' => [ 'name' => 'where_tables', 'type' => 32, 'title' => 'Tables For Where Clause', @@ -174,8 +174,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'group_type' => array( + ], + 'group_type' => [ 'name' => 'group_type', 'type' => 2, 'title' => 'Group Type', @@ -185,12 +185,12 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'group_type', 'optionEditPath' => 'civicrm/admin/options/group_type', - ), - ), - 'cache_date' => array( + ], + ], + 'cache_date' => [ 'name' => 'cache_date', 'type' => 256, 'title' => 'Group Cache Date', @@ -199,8 +199,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'refresh_date' => array( + ], + 'refresh_date' => [ 'name' => 'refresh_date', 'type' => 256, 'title' => 'Next Group Refresh Time', @@ -209,8 +209,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'parents' => array( + ], + 'parents' => [ 'name' => 'parents', 'type' => 32, 'title' => 'Group Parents', @@ -218,8 +218,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'children' => array( + ], + 'children' => [ 'name' => 'children', 'type' => 32, 'title' => 'Group Children', @@ -227,8 +227,8 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'is_hidden' => array( + ], + 'is_hidden' => [ 'name' => 'is_hidden', 'type' => 16, 'title' => 'Group is Hidden', @@ -236,16 +236,16 @@ function group_getfields_expectedresult() { 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => 16, 'title' => 'Group is Reserved', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', - ), - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => 1, 'title' => 'Group Created By', @@ -255,8 +255,8 @@ function group_getfields_expectedresult() { 'bao' => 'CRM_Contact_BAO_Group', 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ), - 'modified_id' => array( + ], + 'modified_id' => [ 'name' => 'modified_id', 'type' => 1, 'title' => 'Group Modified By', @@ -266,9 +266,9 @@ function group_getfields_expectedresult() { 'bao' => 'CRM_Contact_BAO_Group', 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupContact/Create.php b/api/v3/examples/GroupContact/Create.php index 515848316a..4f8eff192c 100644 --- a/api/v3/examples/GroupContact/Create.php +++ b/api/v3/examples/GroupContact/Create.php @@ -6,11 +6,11 @@ * API result array */ function group_contact_create_example() { - $params = array( + $params = [ 'contact_id' => 8, 'contact_id.2' => 9, 'group_id' => 11, - ); + ]; try{ $result = civicrm_api3('GroupContact', 'create', $params); @@ -20,12 +20,12 @@ function group_contact_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,7 +39,7 @@ function group_contact_create_example() { */ function group_contact_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, @@ -47,7 +47,7 @@ function group_contact_create_expectedresult() { 'total_count' => 2, 'added' => 1, 'not_added' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupContact/Delete.php b/api/v3/examples/GroupContact/Delete.php index f0118e15e9..b87de53d2a 100644 --- a/api/v3/examples/GroupContact/Delete.php +++ b/api/v3/examples/GroupContact/Delete.php @@ -6,10 +6,10 @@ * API result array */ function group_contact_delete_example() { - $params = array( + $params = [ 'id' => 9, 'skip_undelete' => TRUE, - ); + ]; try{ $result = civicrm_api3('GroupContact', 'delete', $params); @@ -19,12 +19,12 @@ function group_contact_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,7 +38,7 @@ function group_contact_delete_example() { */ function group_contact_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, @@ -46,7 +46,7 @@ function group_contact_delete_expectedresult() { 'total_count' => 1, 'removed' => 0, 'not_removed' => 0, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupContact/Get.php b/api/v3/examples/GroupContact/Get.php index 47511c3dea..a8dda828c6 100644 --- a/api/v3/examples/GroupContact/Get.php +++ b/api/v3/examples/GroupContact/Get.php @@ -6,9 +6,9 @@ * API result array */ function group_contact_get_example() { - $params = array( + $params = [ 'contact_id' => 3, - ); + ]; try{ $result = civicrm_api3('GroupContact', 'get', $params); @@ -18,12 +18,12 @@ function group_contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function group_contact_get_example() { */ function group_contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'group_id' => '1', 'title' => 'New Test Group Created', @@ -51,9 +51,9 @@ function group_contact_get_expectedresult() { 'is_hidden' => 0, 'in_date' => '2013-07-28 08:50:19', 'in_method' => 'API', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupContact/GetWithGroupID.php b/api/v3/examples/GroupContact/GetWithGroupID.php index 3fa9f14035..e60f16df58 100644 --- a/api/v3/examples/GroupContact/GetWithGroupID.php +++ b/api/v3/examples/GroupContact/GetWithGroupID.php @@ -8,11 +8,11 @@ * API result array */ function group_contact_get_example() { - $params = array( + $params = [ 'group_id' => 3, 'api.group.get' => 1, 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('GroupContact', 'get', $params); @@ -22,12 +22,12 @@ function group_contact_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,24 +41,24 @@ function group_contact_get_example() { */ function group_contact_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '2', 'group_id' => '3', 'contact_id' => '4', 'status' => 'Added', - 'api.group.get' => array( + 'api.group.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '3', 'name' => 'Test Group 1', 'title' => 'New Test Group Created', @@ -68,18 +68,18 @@ function group_contact_get_expectedresult() { 'where_clause' => ' ( `civicrm_group_contact-3`.group_id IN ( 3 ) ) ', 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}', 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}', - 'group_type' => array( + 'group_type' => [ '0' => '1', '1' => '2', - ), + ], 'is_hidden' => 0, 'is_reserved' => 0, - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupNesting/Create.php b/api/v3/examples/GroupNesting/Create.php index 149dd02864..f450996409 100644 --- a/api/v3/examples/GroupNesting/Create.php +++ b/api/v3/examples/GroupNesting/Create.php @@ -6,10 +6,10 @@ * API result array */ function group_nesting_create_example() { - $params = array( + $params = [ 'parent_group_id' => 1, 'child_group_id' => 3, - ); + ]; try{ $result = civicrm_api3('GroupNesting', 'create', $params); @@ -19,12 +19,12 @@ function group_nesting_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,15 +38,15 @@ function group_nesting_create_example() { */ function group_nesting_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 'is_error', - 'values' => array( + 'values' => [ 'is_error' => 0, - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupNesting/Delete.php b/api/v3/examples/GroupNesting/Delete.php index 7a8ab837ae..baaea1baaa 100644 --- a/api/v3/examples/GroupNesting/Delete.php +++ b/api/v3/examples/GroupNesting/Delete.php @@ -6,9 +6,9 @@ * API result array */ function group_nesting_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('GroupNesting', 'delete', $params); @@ -18,12 +18,12 @@ function group_nesting_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function group_nesting_delete_example() { */ function group_nesting_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupNesting/Get.php b/api/v3/examples/GroupNesting/Get.php index 3683dad770..3e19ef53b1 100644 --- a/api/v3/examples/GroupNesting/Get.php +++ b/api/v3/examples/GroupNesting/Get.php @@ -6,10 +6,10 @@ * API result array */ function group_nesting_get_example() { - $params = array( + $params = [ 'parent_group_id' => 1, 'child_group_id' => 2, - ); + ]; try{ $result = civicrm_api3('GroupNesting', 'get', $params); @@ -19,12 +19,12 @@ function group_nesting_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,19 +38,19 @@ function group_nesting_get_example() { */ function group_nesting_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'child_group_id' => '2', 'parent_group_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupOrganization/Create.php b/api/v3/examples/GroupOrganization/Create.php index 4ebee078ed..1a66937578 100644 --- a/api/v3/examples/GroupOrganization/Create.php +++ b/api/v3/examples/GroupOrganization/Create.php @@ -6,10 +6,10 @@ * API result array */ function group_organization_create_example() { - $params = array( + $params = [ 'organization_id' => 8, 'group_id' => 6, - ); + ]; try{ $result = civicrm_api3('GroupOrganization', 'create', $params); @@ -19,12 +19,12 @@ function group_organization_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,17 +38,17 @@ function group_organization_create_example() { */ function group_organization_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 3, 'id' => 3, - 'values' => array( + 'values' => [ 'id' => '3', 'group_id' => '6', 'organization_id' => '8', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupOrganization/Delete.php b/api/v3/examples/GroupOrganization/Delete.php index ad41dc6cad..79f776f3b0 100644 --- a/api/v3/examples/GroupOrganization/Delete.php +++ b/api/v3/examples/GroupOrganization/Delete.php @@ -6,9 +6,9 @@ * API result array */ function group_organization_delete_example() { - $params = array( + $params = [ 'id' => 5, - ); + ]; try{ $result = civicrm_api3('GroupOrganization', 'delete', $params); @@ -18,12 +18,12 @@ function group_organization_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function group_organization_delete_example() { */ function group_organization_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 'Deleted Group Organization successfully', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/GroupOrganization/Get.php b/api/v3/examples/GroupOrganization/Get.php index 696179d9a7..1ebfc68c3f 100644 --- a/api/v3/examples/GroupOrganization/Get.php +++ b/api/v3/examples/GroupOrganization/Get.php @@ -6,9 +6,9 @@ * API result array */ function group_organization_get_example() { - $params = array( + $params = [ 'organization_id' => 1, - ); + ]; try{ $result = civicrm_api3('GroupOrganization', 'get', $params); @@ -18,12 +18,12 @@ function group_organization_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function group_organization_get_example() { */ function group_organization_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), - ); + 'values' => [], + ]; return $expectedResult; } diff --git a/api/v3/examples/Im/Create.php b/api/v3/examples/Im/Create.php index 440e89a0af..c32a2ea5f8 100644 --- a/api/v3/examples/Im/Create.php +++ b/api/v3/examples/Im/Create.php @@ -6,12 +6,12 @@ * API result array */ function im_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'name' => 'My Yahoo IM Handle', 'location_type_id' => 1, 'provider_id' => 1, - ); + ]; try{ $result = civicrm_api3('Im', 'create', $params); @@ -21,12 +21,12 @@ function im_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function im_create_example() { */ function im_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '3', 'location_type_id' => '1', @@ -54,9 +54,9 @@ function im_create_expectedresult() { 'provider_id' => '1', 'is_primary' => '', 'is_billing' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Im/Delete.php b/api/v3/examples/Im/Delete.php index c1d2e2b091..81438d7302 100644 --- a/api/v3/examples/Im/Delete.php +++ b/api/v3/examples/Im/Delete.php @@ -6,9 +6,9 @@ * API result array */ function im_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Im', 'delete', $params); @@ -18,12 +18,12 @@ function im_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function im_delete_example() { */ function im_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Im/Get.php b/api/v3/examples/Im/Get.php index b1daaeaee2..90d23fe359 100644 --- a/api/v3/examples/Im/Get.php +++ b/api/v3/examples/Im/Get.php @@ -6,12 +6,12 @@ * API result array */ function im_get_example() { - $params = array( + $params = [ 'contact_id' => 4, 'name' => 'My Yahoo IM Handle', 'location_type_id' => 1, 'provider_id' => 1, - ); + ]; try{ $result = civicrm_api3('Im', 'get', $params); @@ -21,12 +21,12 @@ function im_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function im_get_example() { */ function im_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id' => '4', 'location_type_id' => '1', @@ -54,9 +54,9 @@ function im_get_expectedresult() { 'provider_id' => '1', 'is_primary' => 0, 'is_billing' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Job/Create.php b/api/v3/examples/Job/Create.php index 1060d3ccf7..3e64c91d75 100644 --- a/api/v3/examples/Job/Create.php +++ b/api/v3/examples/Job/Create.php @@ -6,7 +6,7 @@ * API result array */ function job_create_example() { - $params = array( + $params = [ 'sequential' => 1, 'name' => 'API_Test_Job', 'description' => 'A long description written by hand in cursive', @@ -15,7 +15,7 @@ function job_create_example() { 'api_action' => 'apitestaction', 'parameters' => 'Semi-formal explanation of runtime job parameters', 'is_active' => 1, - ); + ]; try{ $result = civicrm_api3('Job', 'create', $params); @@ -25,12 +25,12 @@ function job_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function job_create_example() { */ function job_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 30, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '30', 'domain_id' => '1', 'run_frequency' => 'Daily', @@ -62,9 +62,9 @@ function job_create_expectedresult() { 'api_action' => 'apitestaction', 'parameters' => 'Semi-formal explanation of runtime job parameters', 'is_active' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Job/Delete.php b/api/v3/examples/Job/Delete.php index 40264b4c11..3fb1143598 100644 --- a/api/v3/examples/Job/Delete.php +++ b/api/v3/examples/Job/Delete.php @@ -6,9 +6,9 @@ * API result array */ function job_delete_example() { - $params = array( + $params = [ 'id' => 31, - ); + ]; try{ $result = civicrm_api3('Job', 'delete', $params); @@ -18,12 +18,12 @@ function job_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/LineItem/Create.php b/api/v3/examples/LineItem/Create.php index 761cd1c264..44d2276096 100644 --- a/api/v3/examples/LineItem/Create.php +++ b/api/v3/examples/LineItem/Create.php @@ -6,7 +6,7 @@ * API result array */ function line_item_create_example() { - $params = array( + $params = [ 'price_field_value_id' => 1, 'price_field_id' => 1, 'entity_table' => 'civicrm_contribution', @@ -15,7 +15,7 @@ function line_item_create_example() { 'unit_price' => 50, 'line_total' => 50, 'debug' => 1, - ); + ]; try{ $result = civicrm_api3('LineItem', 'create', $params); @@ -25,12 +25,12 @@ function line_item_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function line_item_create_example() { */ function line_item_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'entity_table' => 'civicrm_contribution', 'entity_id' => '1', @@ -65,9 +65,9 @@ function line_item_create_expectedresult() { 'financial_type_id' => '', 'non_deductible_amount' => '', 'tax_amount' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/LineItem/Delete.php b/api/v3/examples/LineItem/Delete.php index 98c0496723..2381abb562 100644 --- a/api/v3/examples/LineItem/Delete.php +++ b/api/v3/examples/LineItem/Delete.php @@ -6,9 +6,9 @@ * API result array */ function line_item_delete_example() { - $params = array( + $params = [ 'id' => 4, - ); + ]; try{ $result = civicrm_api3('LineItem', 'delete', $params); @@ -18,12 +18,12 @@ function line_item_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function line_item_delete_example() { */ function line_item_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/LineItem/Get.php b/api/v3/examples/LineItem/Get.php index f1f8756091..68a319605b 100644 --- a/api/v3/examples/LineItem/Get.php +++ b/api/v3/examples/LineItem/Get.php @@ -6,9 +6,9 @@ * API result array */ function line_item_get_example() { - $params = array( + $params = [ 'entity_table' => 'civicrm_contribution', - ); + ]; try{ $result = civicrm_api3('LineItem', 'get', $params); @@ -18,12 +18,12 @@ function line_item_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function line_item_get_example() { */ function line_item_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'entity_table' => 'civicrm_contribution', 'entity_id' => '2', @@ -57,9 +57,9 @@ function line_item_get_expectedresult() { 'financial_type_id' => '1', 'non_deductible_amount' => '0.00', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/LocBlock/Create.php b/api/v3/examples/LocBlock/Create.php index 328cec565f..723137931c 100644 --- a/api/v3/examples/LocBlock/Create.php +++ b/api/v3/examples/LocBlock/Create.php @@ -8,11 +8,11 @@ * API result array */ function loc_block_create_example() { - $params = array( + $params = [ 'address_id' => 2, 'phone_id' => 2, 'email_id' => 3, - ); + ]; try{ $result = civicrm_api3('LocBlock', 'create', $params); @@ -22,12 +22,12 @@ function loc_block_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function loc_block_create_example() { */ function loc_block_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'address_id' => '2', 'email_id' => '3', @@ -57,9 +57,9 @@ function loc_block_create_expectedresult() { 'email_2_id' => '', 'phone_2_id' => '', 'im_2_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/LocBlock/CreateEntities.php b/api/v3/examples/LocBlock/CreateEntities.php index 4af4802789..2cb6213339 100644 --- a/api/v3/examples/LocBlock/CreateEntities.php +++ b/api/v3/examples/LocBlock/CreateEntities.php @@ -8,24 +8,24 @@ * API result array */ function loc_block_create_example() { - $params = array( - 'email' => array( + $params = [ + 'email' => [ 'location_type_id' => 1, 'email' => 'test2@loc.block', - ), - 'phone' => array( + ], + 'phone' => [ 'location_type_id' => 1, 'phone' => '987654321', - ), - 'phone_2' => array( + ], + 'phone_2' => [ 'location_type_id' => 1, 'phone' => '456-7890', - ), - 'address' => array( + ], + 'address' => [ 'location_type_id' => 1, 'street_address' => '987654321', - ), - ); + ], + ]; try{ $result = civicrm_api3('LocBlock', 'create', $params); @@ -35,12 +35,12 @@ function loc_block_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -54,22 +54,22 @@ function loc_block_create_example() { */ function loc_block_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( - 'address' => array( + 'values' => [ + '3' => [ + 'address' => [ 'id' => '3', 'location_type_id' => '1', 'is_primary' => 0, 'is_billing' => 0, 'street_address' => '987654321', 'manual_geo_code' => 0, - ), - 'email' => array( + ], + 'email' => [ 'id' => '4', 'contact_id' => '', 'location_type_id' => '1', @@ -82,8 +82,8 @@ function loc_block_create_expectedresult() { 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', - ), - 'phone' => array( + ], + 'phone' => [ 'id' => '3', 'contact_id' => '', 'location_type_id' => '1', @@ -94,8 +94,8 @@ function loc_block_create_expectedresult() { 'phone_ext' => '', 'phone_numeric' => '', 'phone_type_id' => '', - ), - 'phone_2' => array( + ], + 'phone_2' => [ 'id' => '4', 'contact_id' => '', 'location_type_id' => '1', @@ -106,7 +106,7 @@ function loc_block_create_expectedresult() { 'phone_ext' => '', 'phone_numeric' => '', 'phone_type_id' => '', - ), + ], 'id' => '3', 'address_id' => '3', 'email_id' => '4', @@ -116,9 +116,9 @@ function loc_block_create_expectedresult() { 'email_2_id' => '', 'phone_2_id' => '4', 'im_2_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/LocBlock/Get.php b/api/v3/examples/LocBlock/Get.php index c323e43fb7..dccde31f7b 100644 --- a/api/v3/examples/LocBlock/Get.php +++ b/api/v3/examples/LocBlock/Get.php @@ -8,10 +8,10 @@ * API result array */ function loc_block_get_example() { - $params = array( + $params = [ 'id' => 3, 'return' => 'all', - ); + ]; try{ $result = civicrm_api3('LocBlock', 'get', $params); @@ -21,12 +21,12 @@ function loc_block_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,27 +40,27 @@ function loc_block_get_example() { */ function loc_block_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'address_id' => '3', 'email_id' => '4', 'phone_id' => '3', 'phone_2_id' => '4', - 'address' => array( + 'address' => [ 'id' => '3', 'location_type_id' => '1', 'is_primary' => 0, 'is_billing' => 0, 'street_address' => '987654321', 'manual_geo_code' => 0, - ), - 'email' => array( + ], + 'email' => [ 'id' => '4', 'location_type_id' => '1', 'email' => 'test2@loc.block', @@ -68,26 +68,26 @@ function loc_block_get_expectedresult() { 'is_billing' => 0, 'on_hold' => 0, 'is_bulkmail' => 0, - ), - 'phone' => array( + ], + 'phone' => [ 'id' => '3', 'location_type_id' => '1', 'is_primary' => 0, 'is_billing' => 0, 'phone' => '987654321', 'phone_numeric' => '987654321', - ), - 'phone_2' => array( + ], + 'phone_2' => [ 'id' => '4', 'location_type_id' => '1', 'is_primary' => 0, 'is_billing' => 0, 'phone' => '456-7890', 'phone_numeric' => '4567890', - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Logging/Get.php b/api/v3/examples/Logging/Get.php index 0e95cdaf50..f6d921898b 100644 --- a/api/v3/examples/Logging/Get.php +++ b/api/v3/examples/Logging/Get.php @@ -6,9 +6,9 @@ * API result array */ function logging_get_example() { - $params = array( + $params = [ 'log_conn_id' => 'wooty wop wop', - ); + ]; try{ $result = civicrm_api3('Logging', 'get', $params); @@ -18,12 +18,12 @@ function logging_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function logging_get_example() { */ function logging_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 17, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'action' => 'Update', 'id' => '3', 'field' => 'sort_name', @@ -51,8 +51,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_contact', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '1' => array( + ], + '1' => [ 'action' => 'Update', 'id' => '3', 'field' => 'display_name', @@ -61,8 +61,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_contact', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '2' => array( + ], + '2' => [ 'action' => 'Update', 'id' => '3', 'field' => 'first_name', @@ -71,8 +71,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_contact', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '3' => array( + ], + '3' => [ 'action' => 'Update', 'id' => '3', 'field' => 'last_name', @@ -81,8 +81,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_contact', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '4' => array( + ], + '4' => [ 'action' => 'Update', 'id' => '3', 'field' => 'modified_date', @@ -91,8 +91,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_contact', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '5' => array( + ], + '5' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'id', @@ -101,8 +101,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '6' => array( + ], + '6' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'contact_id', @@ -111,8 +111,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '7' => array( + ], + '7' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'location_type_id', @@ -121,8 +121,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '8' => array( + ], + '8' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'email', @@ -131,8 +131,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '9' => array( + ], + '9' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'is_primary', @@ -141,8 +141,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '10' => array( + ], + '10' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'is_billing', @@ -151,8 +151,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '11' => array( + ], + '11' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'on_hold', @@ -161,8 +161,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '12' => array( + ], + '12' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'is_bulkmail', @@ -171,8 +171,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '13' => array( + ], + '13' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'hold_date', @@ -181,8 +181,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '14' => array( + ], + '14' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'reset_date', @@ -191,8 +191,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '15' => array( + ], + '15' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'signature_text', @@ -201,8 +201,8 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - '16' => array( + ], + '16' => [ 'action' => 'Insert', 'id' => '2', 'field' => 'signature_html', @@ -211,9 +211,9 @@ function logging_get_expectedresult() { 'table' => 'civicrm_email', 'log_date' => '2017-02-07 02:36:46', 'log_conn_id' => 'wooty wop wop', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Logging/Revert.php b/api/v3/examples/Logging/Revert.php index c085b4497c..01642fc870 100644 --- a/api/v3/examples/Logging/Revert.php +++ b/api/v3/examples/Logging/Revert.php @@ -6,10 +6,10 @@ * API result array */ function logging_revert_example() { - $params = array( + $params = [ 'log_conn_id' => 'woot', 'log_date' => '2017-02-07 02:35:06', - ); + ]; try{ $result = civicrm_api3('Logging', 'revert', $params); @@ -19,12 +19,12 @@ function logging_revert_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,12 +38,12 @@ function logging_revert_example() { */ function logging_revert_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/MailSettings/ChainedGetDelete.php b/api/v3/examples/MailSettings/ChainedGetDelete.php index 39840638f0..966d269684 100644 --- a/api/v3/examples/MailSettings/ChainedGetDelete.php +++ b/api/v3/examples/MailSettings/ChainedGetDelete.php @@ -8,10 +8,10 @@ * API result array */ function mail_settings_get_example() { - $params = array( + $params = [ 'title' => 'MailSettings title', 'api.MailSettings.delete' => 1, - ); + ]; try{ $result = civicrm_api3('MailSettings', 'get', $params); @@ -21,12 +21,12 @@ function mail_settings_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,25 +40,25 @@ function mail_settings_get_example() { */ function mail_settings_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'domain_id' => '1', 'name' => 'default', 'is_default' => 0, 'domain' => 'EXAMPLE.ORG', - 'api.MailSettings.delete' => array( + 'api.MailSettings.delete' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ), - ), - '6' => array( + ], + ], + '6' => [ 'id' => '6', 'domain_id' => '1', 'name' => 'my mail setting', @@ -68,15 +68,15 @@ function mail_settings_get_expectedresult() { 'username' => 'sue', 'password' => 'pass', 'is_ssl' => 0, - 'api.MailSettings.delete' => array( + 'api.MailSettings.delete' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MailSettings/Create.php b/api/v3/examples/MailSettings/Create.php index 1542f116dd..43fbf43856 100644 --- a/api/v3/examples/MailSettings/Create.php +++ b/api/v3/examples/MailSettings/Create.php @@ -6,7 +6,7 @@ * API result array */ function mail_settings_create_example() { - $params = array( + $params = [ 'domain_id' => 1, 'name' => 'my mail setting', 'domain' => 'setting.com', @@ -15,7 +15,7 @@ function mail_settings_create_example() { 'username' => 'sue', 'password' => 'pass', 'is_default' => 1, - ); + ]; try{ $result = civicrm_api3('MailSettings', 'create', $params); @@ -25,12 +25,12 @@ function mail_settings_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function mail_settings_create_example() { */ function mail_settings_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 5, - 'values' => array( - '5' => array( + 'values' => [ + '5' => [ 'id' => '5', 'domain_id' => '1', 'name' => 'my mail setting', @@ -65,9 +65,9 @@ function mail_settings_create_expectedresult() { 'password' => 'pass', 'is_ssl' => '', 'source' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MailSettings/Delete.php b/api/v3/examples/MailSettings/Delete.php index ffd138fc2d..a1cc7a50b4 100644 --- a/api/v3/examples/MailSettings/Delete.php +++ b/api/v3/examples/MailSettings/Delete.php @@ -6,9 +6,9 @@ * API result array */ function mail_settings_delete_example() { - $params = array( + $params = [ 'id' => 5, - ); + ]; try{ $result = civicrm_api3('MailSettings', 'delete', $params); @@ -18,12 +18,12 @@ function mail_settings_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function mail_settings_delete_example() { */ function mail_settings_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/MailSettings/Get.php b/api/v3/examples/MailSettings/Get.php index 53c8b81cb6..19c75bb4be 100644 --- a/api/v3/examples/MailSettings/Get.php +++ b/api/v3/examples/MailSettings/Get.php @@ -6,7 +6,7 @@ * API result array */ function mail_settings_get_example() { - $params = array( + $params = [ 'domain_id' => 1, 'name' => 'my mail setting', 'domain' => 'setting.com', @@ -15,7 +15,7 @@ function mail_settings_get_example() { 'username' => 'sue', 'password' => 'pass', 'is_default' => 1, - ); + ]; try{ $result = civicrm_api3('MailSettings', 'get', $params); @@ -25,12 +25,12 @@ function mail_settings_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function mail_settings_get_example() { */ function mail_settings_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 4, - 'values' => array( - '4' => array( + 'values' => [ + '4' => [ 'id' => '4', 'domain_id' => '1', 'name' => 'my mail setting', @@ -60,9 +60,9 @@ function mail_settings_get_expectedresult() { 'username' => 'sue', 'password' => 'pass', 'is_ssl' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MailSettings/GetOptions.php b/api/v3/examples/MailSettings/GetOptions.php index ae99328f23..5a8de53942 100644 --- a/api/v3/examples/MailSettings/GetOptions.php +++ b/api/v3/examples/MailSettings/GetOptions.php @@ -6,9 +6,9 @@ * API result array */ function mail_settings_getoptions_example() { - $params = array( + $params = [ 'field' => 'protocol', - ); + ]; try{ $result = civicrm_api3('MailSettings', 'getoptions', $params); @@ -18,12 +18,12 @@ function mail_settings_getoptions_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,17 +37,17 @@ function mail_settings_getoptions_example() { */ function mail_settings_getoptions_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 4, - 'values' => array( + 'values' => [ '1' => 'IMAP', '2' => 'Maildir', '3' => 'POP3', '4' => 'Localdir', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Mailing/Clone.php b/api/v3/examples/Mailing/Clone.php index c91b47714f..7d5c86c2c5 100644 --- a/api/v3/examples/Mailing/Clone.php +++ b/api/v3/examples/Mailing/Clone.php @@ -6,9 +6,9 @@ * API result array */ function mailing_clone_example() { - $params = array( + $params = [ 'id' => 21, - ); + ]; try{ $result = civicrm_api3('Mailing', 'clone', $params); @@ -18,12 +18,12 @@ function mailing_clone_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function mailing_clone_example() { */ function mailing_clone_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 22, - 'values' => array( - '22' => array( + 'values' => [ + '22' => [ 'id' => '22', 'domain_id' => '1', 'header_id' => '1', @@ -88,9 +88,9 @@ https://civicrm.org 'location_type_id' => '', 'email_selection_method' => 'automatic', 'language' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Mailing/Create.php b/api/v3/examples/Mailing/Create.php index b07b4fdb56..026d9fc2c1 100644 --- a/api/v3/examples/Mailing/Create.php +++ b/api/v3/examples/Mailing/Create.php @@ -6,7 +6,7 @@ * API result array */ function mailing_create_example() { - $params = array( + $params = [ 'subject' => 'Hello {contact.display_name}', 'body_text' => 'This is {contact.display_name}. https://civicrm.org @@ -16,32 +16,32 @@ https://civicrm.org 'created_id' => 3, 'header_id' => '', 'footer_id' => '', - 'groups' => array( - 'include' => array( + 'groups' => [ + 'include' => [ '0' => 2, - ), - 'exclude' => array( + ], + 'exclude' => [ '0' => 3, - ), - ), - 'mailings' => array( - 'include' => array(), - 'exclude' => array(), - ), - 'options' => array( + ], + ], + 'mailings' => [ + 'include' => [], + 'exclude' => [], + ], + 'options' => [ 'force_rollback' => 1, - ), + ], 'api.mailing_job.create' => 1, - 'api.MailingRecipients.get' => array( + 'api.MailingRecipients.get' => [ 'mailing_id' => '$value.id', - 'api.contact.getvalue' => array( + 'api.contact.getvalue' => [ 'return' => 'display_name', - ), - 'api.email.getvalue' => array( + ], + 'api.email.getvalue' => [ 'return' => 'email', - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Mailing', 'create', $params); @@ -51,12 +51,12 @@ https://civicrm.org $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -70,13 +70,13 @@ https://civicrm.org */ function mailing_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'domain_id' => '1', 'header_id' => '', @@ -121,13 +121,13 @@ https://civicrm.org 'location_type_id' => '', 'email_selection_method' => '', 'language' => '', - 'api.mailing_job.create' => array( + 'api.mailing_job.create' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'mailing_id' => '1', 'scheduled_date' => '20130728085413', @@ -139,28 +139,28 @@ https://civicrm.org 'parent_id' => '', 'job_offset' => '', 'job_limit' => '', - ), - ), - ), - 'api.MailingRecipients.get' => array( + ], + ], + ], + 'api.MailingRecipients.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'mailing_id' => '1', 'contact_id' => '4', 'email_id' => '4', 'api.contact.getvalue' => 'Mr. Includer Person II', 'api.email.getvalue' => 'include.me@example.org', - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Mailing/Delete.php b/api/v3/examples/Mailing/Delete.php index b7f02cbc76..b2df37d02a 100644 --- a/api/v3/examples/Mailing/Delete.php +++ b/api/v3/examples/Mailing/Delete.php @@ -6,9 +6,9 @@ * API result array */ function mailing_delete_example() { - $params = array( + $params = [ 'id' => 20, - ); + ]; try{ $result = civicrm_api3('Mailing', 'delete', $params); @@ -18,12 +18,12 @@ function mailing_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function mailing_delete_example() { */ function mailing_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Mailing/GetTokens.php b/api/v3/examples/Mailing/GetTokens.php index 6192348596..856e279527 100644 --- a/api/v3/examples/Mailing/GetTokens.php +++ b/api/v3/examples/Mailing/GetTokens.php @@ -9,12 +9,12 @@ * API result array */ function mailing_gettokens_example() { - $params = array( - 'entity' => array( + $params = [ + 'entity' => [ '0' => 'Contact', '1' => 'Mailing', - ), - ); + ], + ]; try{ $result = civicrm_api3('Mailing', 'gettokens', $params); @@ -24,12 +24,12 @@ function mailing_gettokens_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,11 +43,11 @@ function mailing_gettokens_example() { */ function mailing_gettokens_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 82, - 'values' => array( + 'values' => [ '{action.unsubscribe}' => 'Unsubscribe via email', '{action.unsubscribeUrl}' => 'Unsubscribe via web page', '{action.resubscribe}' => 'Resubscribe via email', @@ -131,8 +131,8 @@ function mailing_gettokens_expectedresult() { '{contact.url}' => 'Website', '{contact.checksum}' => 'Checksum', '{contact.contact_id}' => 'Internal Contact ID', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Mailing/Submit.php b/api/v3/examples/Mailing/Submit.php index ffaae8983d..d2971de198 100644 --- a/api/v3/examples/Mailing/Submit.php +++ b/api/v3/examples/Mailing/Submit.php @@ -6,11 +6,11 @@ * API result array */ function mailing_submit_example() { - $params = array( + $params = [ 'scheduled_date' => '2014-12-13 10:00:00', 'approval_date' => '2014-12-13 00:00:00', 'id' => 18, - ); + ]; try{ $result = civicrm_api3('Mailing', 'submit', $params); @@ -20,12 +20,12 @@ function mailing_submit_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function mailing_submit_example() { */ function mailing_submit_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 18, - 'values' => array( - '18' => array( + 'values' => [ + '18' => [ 'id' => '18', 'domain_id' => '1', 'header_id' => '', @@ -90,9 +90,9 @@ https://civicrm.org 'location_type_id' => '', 'email_selection_method' => 'automatic', 'language' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MailingAB/Create.php b/api/v3/examples/MailingAB/Create.php index c7ac42c59d..735ad9ca37 100644 --- a/api/v3/examples/MailingAB/Create.php +++ b/api/v3/examples/MailingAB/Create.php @@ -6,7 +6,7 @@ * API result array */ function mailing_a_b_create_example() { - $params = array( + $params = [ 'mailing_id_a' => 1, 'mailing_id_b' => 2, 'mailing_id_c' => 3, @@ -14,7 +14,7 @@ function mailing_a_b_create_example() { 'winner_criteria' => 'open', 'declare_winning_time' => '+2 days', 'group_percentage' => 10, - ); + ]; try{ $result = civicrm_api3('MailingAB', 'create', $params); @@ -24,12 +24,12 @@ function mailing_a_b_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function mailing_a_b_create_example() { */ function mailing_a_b_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => '', 'status' => '', @@ -64,9 +64,9 @@ function mailing_a_b_create_expectedresult() { 'group_percentage' => '10', 'created_id' => '3', 'created_date' => '2013-07-28 08:49:19', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MailingEventSubscribe/Create.php b/api/v3/examples/MailingEventSubscribe/Create.php index 0af6130cd2..a36db91cb5 100644 --- a/api/v3/examples/MailingEventSubscribe/Create.php +++ b/api/v3/examples/MailingEventSubscribe/Create.php @@ -6,13 +6,13 @@ * API result array */ function mailing_event_subscribe_create_example() { - $params = array( + $params = [ 'email' => 'test@test.test', 'group_id' => 2, 'contact_id' => 3, 'hash' => 'b15de8b64e2cec34', 'time_stamp' => '20101212121212', - ); + ]; try{ $result = civicrm_api3('MailingEventSubscribe', 'create', $params); @@ -22,12 +22,12 @@ function mailing_event_subscribe_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,19 +41,19 @@ function mailing_event_subscribe_create_example() { */ function mailing_event_subscribe_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'contact_id' => '3', 'subscribe_id' => '1', 'hash' => '67eac7789eaee00', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MailingGroup/Subscribe.php b/api/v3/examples/MailingGroup/Subscribe.php index 4903a339cc..50c0a7ab9c 100644 --- a/api/v3/examples/MailingGroup/Subscribe.php +++ b/api/v3/examples/MailingGroup/Subscribe.php @@ -7,13 +7,13 @@ * API result array */ function mailing_group_subscribe_example() { - $params = array( + $params = [ 'email' => 'test@test.test', 'group_id' => 2, 'contact_id' => 3, 'hash' => 'b15de8b64e2cec34', 'time_stamp' => '20101212121212', - ); + ]; try{ $result = civicrm_api3('mailing_group', 'subscribe', $params); @@ -23,11 +23,11 @@ function mailing_group_subscribe_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,19 +41,19 @@ function mailing_group_subscribe_example() { */ function mailing_group_subscribe_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'contact_id' => '3', 'subscribe_id' => '1', 'hash' => '67eac7789eaee00', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Mapping/Create.php b/api/v3/examples/Mapping/Create.php index 50459e16fd..cfeb6060a5 100644 --- a/api/v3/examples/Mapping/Create.php +++ b/api/v3/examples/Mapping/Create.php @@ -6,11 +6,11 @@ * API result array */ function mapping_create_example() { - $params = array( + $params = [ 'name' => 'Mapping name', 'description' => 'Mapping description', 'mapping_type_id' => 7, - ); + ]; try{ $result = civicrm_api3('Mapping', 'create', $params); @@ -20,12 +20,12 @@ function mapping_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function mapping_create_example() { */ function mapping_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => 'Mapping name', 'description' => 'Mapping description', 'mapping_type_id' => '7', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Mapping/Delete.php b/api/v3/examples/Mapping/Delete.php index cf598f7072..41b355bb33 100644 --- a/api/v3/examples/Mapping/Delete.php +++ b/api/v3/examples/Mapping/Delete.php @@ -6,9 +6,9 @@ * API result array */ function mapping_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Mapping', 'delete', $params); @@ -18,12 +18,12 @@ function mapping_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function mapping_delete_example() { */ function mapping_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Mapping/Get.php b/api/v3/examples/Mapping/Get.php index f338822689..2235f5075e 100644 --- a/api/v3/examples/Mapping/Get.php +++ b/api/v3/examples/Mapping/Get.php @@ -6,11 +6,11 @@ * API result array */ function mapping_get_example() { - $params = array( + $params = [ 'name' => 'Mapping name', 'description' => 'Mapping description', 'mapping_type_id' => 7, - ); + ]; try{ $result = civicrm_api3('Mapping', 'get', $params); @@ -20,12 +20,12 @@ function mapping_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function mapping_get_example() { */ function mapping_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'name' => 'Mapping name', 'description' => 'Mapping description', 'mapping_type_id' => '7', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MappingField/Create.php b/api/v3/examples/MappingField/Create.php index 9b80b2722f..093863a69b 100644 --- a/api/v3/examples/MappingField/Create.php +++ b/api/v3/examples/MappingField/Create.php @@ -6,13 +6,13 @@ * API result array */ function mapping_field_create_example() { - $params = array( + $params = [ 'mapping_id' => 1, 'name' => 'last_name', 'contact_type' => 'Individual', 'column_number' => 2, 'grouping' => 1, - ); + ]; try{ $result = civicrm_api3('MappingField', 'create', $params); @@ -22,12 +22,12 @@ function mapping_field_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function mapping_field_create_example() { */ function mapping_field_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'mapping_id' => '1', 'name' => 'last_name', @@ -62,9 +62,9 @@ function mapping_field_create_expectedresult() { 'grouping' => '1', 'operator' => '', 'value' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MappingField/Delete.php b/api/v3/examples/MappingField/Delete.php index ef27c0f18e..ddc050529d 100644 --- a/api/v3/examples/MappingField/Delete.php +++ b/api/v3/examples/MappingField/Delete.php @@ -6,9 +6,9 @@ * API result array */ function mapping_field_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('MappingField', 'delete', $params); @@ -18,12 +18,12 @@ function mapping_field_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function mapping_field_delete_example() { */ function mapping_field_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/MappingField/Get.php b/api/v3/examples/MappingField/Get.php index 09d1f7df7b..8fac202097 100644 --- a/api/v3/examples/MappingField/Get.php +++ b/api/v3/examples/MappingField/Get.php @@ -6,13 +6,13 @@ * API result array */ function mapping_field_get_example() { - $params = array( + $params = [ 'mapping_id' => 2, 'name' => 'last_name', 'contact_type' => 'Individual', 'column_number' => 2, 'grouping' => 1, - ); + ]; try{ $result = civicrm_api3('MappingField', 'get', $params); @@ -22,12 +22,12 @@ function mapping_field_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,22 +41,22 @@ function mapping_field_get_example() { */ function mapping_field_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'mapping_id' => '2', 'name' => 'last_name', 'contact_type' => 'Individual', 'column_number' => '2', 'grouping' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Membership/Create.php b/api/v3/examples/Membership/Create.php index 107c3cc7c3..7285304133 100644 --- a/api/v3/examples/Membership/Create.php +++ b/api/v3/examples/Membership/Create.php @@ -6,7 +6,7 @@ * API result array */ function membership_create_example() { - $params = array( + $params = [ 'contact_id' => 79, 'membership_type_id' => 47, 'join_date' => '2006-01-21', @@ -15,7 +15,7 @@ function membership_create_example() { 'source' => 'Payment', 'is_override' => 1, 'status_id' => 30, - ); + ]; try{ $result = civicrm_api3('Membership', 'create', $params); @@ -25,12 +25,12 @@ function membership_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function membership_create_example() { */ function membership_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '79', 'membership_type_id' => '47', @@ -66,9 +66,9 @@ function membership_create_expectedresult() { 'is_pay_later' => '', 'contribution_recur_id' => '', 'campaign_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Membership/CreateWithCustomData.php b/api/v3/examples/Membership/CreateWithCustomData.php index 42fa4d5b8b..13651a3c95 100644 --- a/api/v3/examples/Membership/CreateWithCustomData.php +++ b/api/v3/examples/Membership/CreateWithCustomData.php @@ -6,7 +6,7 @@ * API result array */ function membership_create_example() { - $params = array( + $params = [ 'contact_id' => 91, 'membership_type_id' => 55, 'join_date' => '2009-01-21', @@ -16,7 +16,7 @@ function membership_create_example() { 'is_override' => 1, 'status_id' => 34, 'custom_1' => 'custom string', - ); + ]; try{ $result = civicrm_api3('Membership', 'create', $params); @@ -26,12 +26,12 @@ function membership_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,13 +45,13 @@ function membership_create_example() { */ function membership_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '91', 'membership_type_id' => '55', @@ -67,9 +67,9 @@ function membership_create_expectedresult() { 'is_pay_later' => '', 'contribution_recur_id' => '', 'campaign_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Membership/Delete.php b/api/v3/examples/Membership/Delete.php index 953ecbffe6..75e9066122 100644 --- a/api/v3/examples/Membership/Delete.php +++ b/api/v3/examples/Membership/Delete.php @@ -6,10 +6,10 @@ * API result array */ function membership_delete_example() { - $params = array( + $params = [ 'id' => 1, 'preserve_contribution' => 1, - ); + ]; try{ $result = civicrm_api3('Membership', 'delete', $params); @@ -19,12 +19,12 @@ function membership_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,12 +38,12 @@ function membership_delete_example() { */ function membership_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => TRUE, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Membership/FilterIsCurrent.php b/api/v3/examples/Membership/FilterIsCurrent.php index 92109b857a..6ab53bdccf 100644 --- a/api/v3/examples/Membership/FilterIsCurrent.php +++ b/api/v3/examples/Membership/FilterIsCurrent.php @@ -8,12 +8,12 @@ * API result array */ function membership_get_example() { - $params = array( + $params = [ 'contact_id' => 47, - 'filters' => array( + 'filters' => [ 'is_current' => 1, - ), - ); + ], + ]; try{ $result = civicrm_api3('Membership', 'get', $params); @@ -23,12 +23,12 @@ function membership_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function membership_get_example() { */ function membership_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '47', 'membership_type_id' => '29', @@ -62,9 +62,9 @@ function membership_get_expectedresult() { 'is_pay_later' => 0, 'membership_name' => 'General', 'relationship_name' => 'Child of', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Membership/Get.php b/api/v3/examples/Membership/Get.php index 8c4fb2aed6..cb6c5aa4bb 100644 --- a/api/v3/examples/Membership/Get.php +++ b/api/v3/examples/Membership/Get.php @@ -6,9 +6,9 @@ * API result array */ function membership_get_example() { - $params = array( + $params = [ 'membership_type_id' => 23, - ); + ]; try{ $result = civicrm_api3('Membership', 'get', $params); @@ -18,12 +18,12 @@ function membership_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function membership_get_example() { */ function membership_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '38', 'membership_type_id' => '23', @@ -59,9 +59,9 @@ function membership_get_expectedresult() { 'membership_name' => 'General', 'relationship_name' => 'Child of', 'custom_1_1' => 'custom string', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Membership/SearchWithCustomData.php b/api/v3/examples/Membership/SearchWithCustomData.php index 79ebb5a9c2..be147d722d 100644 --- a/api/v3/examples/Membership/SearchWithCustomData.php +++ b/api/v3/examples/Membership/SearchWithCustomData.php @@ -6,7 +6,7 @@ * API result array */ function membership_create_example() { - $params = array( + $params = [ 'contact_id' => 94, 'membership_type_id' => 57, 'join_date' => '2009-01-21', @@ -15,7 +15,7 @@ function membership_create_example() { 'source' => 'Payment', 'is_override' => 1, 'status_id' => 35, - ); + ]; try{ $result = civicrm_api3('Membership', 'create', $params); @@ -25,12 +25,12 @@ function membership_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function membership_create_example() { */ function membership_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '94', 'membership_type_id' => '57', @@ -66,9 +66,9 @@ function membership_create_expectedresult() { 'is_pay_later' => '', 'contribution_recur_id' => '', 'campaign_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Membership/UpdateCustomData.php b/api/v3/examples/Membership/UpdateCustomData.php index f93f9d1bcd..2a10b8e713 100644 --- a/api/v3/examples/Membership/UpdateCustomData.php +++ b/api/v3/examples/Membership/UpdateCustomData.php @@ -6,7 +6,7 @@ * API result array */ function membership_create_example() { - $params = array( + $params = [ 'contact_id' => 112, 'membership_type_id' => 69, 'join_date' => '2009-01-21', @@ -16,7 +16,7 @@ function membership_create_example() { 'is_override' => 1, 'status_id' => 41, 'custom_1' => 'custom string', - ); + ]; try{ $result = civicrm_api3('Membership', 'create', $params); @@ -26,12 +26,12 @@ function membership_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,13 +45,13 @@ function membership_create_example() { */ function membership_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '112', 'membership_type_id' => '69', @@ -67,9 +67,9 @@ function membership_create_expectedresult() { 'is_pay_later' => '', 'contribution_recur_id' => '', 'campaign_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MembershipPayment/Create.php b/api/v3/examples/MembershipPayment/Create.php index 15f17ed82d..1df477999a 100644 --- a/api/v3/examples/MembershipPayment/Create.php +++ b/api/v3/examples/MembershipPayment/Create.php @@ -6,10 +6,10 @@ * API result array */ function membership_payment_create_example() { - $params = array( + $params = [ 'contribution_id' => 2, 'membership_id' => 1, - ); + ]; try{ $result = civicrm_api3('MembershipPayment', 'create', $params); @@ -19,12 +19,12 @@ function membership_payment_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,19 +38,19 @@ function membership_payment_create_example() { */ function membership_payment_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'membership_id' => '1', 'contribution_id' => '2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MembershipPayment/Get.php b/api/v3/examples/MembershipPayment/Get.php index b93156fd3d..86dfa26b05 100644 --- a/api/v3/examples/MembershipPayment/Get.php +++ b/api/v3/examples/MembershipPayment/Get.php @@ -6,10 +6,10 @@ * API result array */ function membership_payment_get_example() { - $params = array( + $params = [ 'contribution_id' => 4, 'membership_id' => 2, - ); + ]; try{ $result = civicrm_api3('MembershipPayment', 'get', $params); @@ -19,12 +19,12 @@ function membership_payment_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,19 +38,19 @@ function membership_payment_get_example() { */ function membership_payment_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'membership_id' => '2', 'contribution_id' => '4', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MembershipStatus/Create.php b/api/v3/examples/MembershipStatus/Create.php index 1bfd08c1e7..614c84415c 100644 --- a/api/v3/examples/MembershipStatus/Create.php +++ b/api/v3/examples/MembershipStatus/Create.php @@ -6,9 +6,9 @@ * API result array */ function membership_status_create_example() { - $params = array( + $params = [ 'name' => 'test membership status', - ); + ]; try{ $result = civicrm_api3('MembershipStatus', 'create', $params); @@ -18,12 +18,12 @@ function membership_status_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function membership_status_create_example() { */ function membership_status_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 15, - 'values' => array( - '15' => array( + 'values' => [ + '15' => [ 'id' => '15', 'name' => 'test membership status', 'label' => 'test membership status', @@ -59,9 +59,9 @@ function membership_status_create_expectedresult() { 'is_default' => '', 'is_active' => '', 'is_reserved' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MembershipStatus/Get.php b/api/v3/examples/MembershipStatus/Get.php index 0291fdb620..396a9a68ca 100644 --- a/api/v3/examples/MembershipStatus/Get.php +++ b/api/v3/examples/MembershipStatus/Get.php @@ -6,9 +6,9 @@ * API result array */ function membership_status_get_example() { - $params = array( + $params = [ 'name' => 'test status', - ); + ]; try{ $result = civicrm_api3('MembershipStatus', 'get', $params); @@ -18,12 +18,12 @@ function membership_status_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function membership_status_get_example() { */ function membership_status_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 9, - 'values' => array( - '9' => array( + 'values' => [ + '9' => [ 'id' => '9', 'name' => 'test status', 'label' => 'test status', @@ -54,9 +54,9 @@ function membership_status_get_expectedresult() { 'is_default' => 0, 'is_active' => '1', 'is_reserved' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MembershipType/Create.php b/api/v3/examples/MembershipType/Create.php index 1a01818506..f78351a900 100644 --- a/api/v3/examples/MembershipType/Create.php +++ b/api/v3/examples/MembershipType/Create.php @@ -6,7 +6,7 @@ * API result array */ function membership_type_create_example() { - $params = array( + $params = [ 'name' => '40+ Membership', 'description' => 'people above 40 are given health instructions', 'member_of_contact_id' => 7, @@ -17,7 +17,7 @@ function membership_type_create_example() { 'duration_interval' => '10', 'period_type' => 'rolling', 'visibility' => 'public', - ); + ]; try{ $result = civicrm_api3('MembershipType', 'create', $params); @@ -27,12 +27,12 @@ function membership_type_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -46,13 +46,13 @@ function membership_type_create_example() { */ function membership_type_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'domain_id' => '1', 'name' => '40+ Membership', @@ -75,9 +75,9 @@ function membership_type_create_expectedresult() { 'auto_renew' => '', 'is_active' => '1', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MembershipType/Delete.php b/api/v3/examples/MembershipType/Delete.php index 2c08431368..59200470d9 100644 --- a/api/v3/examples/MembershipType/Delete.php +++ b/api/v3/examples/MembershipType/Delete.php @@ -6,9 +6,9 @@ * API result array */ function membership_type_delete_example() { - $params = array( + $params = [ 'id' => 4, - ); + ]; try{ $result = civicrm_api3('MembershipType', 'delete', $params); @@ -18,12 +18,12 @@ function membership_type_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function membership_type_delete_example() { */ function membership_type_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/MembershipType/Get.php b/api/v3/examples/MembershipType/Get.php index e9904be804..232ad99518 100644 --- a/api/v3/examples/MembershipType/Get.php +++ b/api/v3/examples/MembershipType/Get.php @@ -6,9 +6,9 @@ * API result array */ function membership_type_get_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('MembershipType', 'get', $params); @@ -18,12 +18,12 @@ function membership_type_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function membership_type_get_example() { */ function membership_type_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'domain_id' => '1', 'name' => 'General', @@ -57,9 +57,9 @@ function membership_type_get_expectedresult() { 'auto_renew' => 0, 'is_active' => '1', 'contribution_type_id' => '2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MessageTemplate/Create.php b/api/v3/examples/MessageTemplate/Create.php index 7f2f51393b..16a8b53f25 100644 --- a/api/v3/examples/MessageTemplate/Create.php +++ b/api/v3/examples/MessageTemplate/Create.php @@ -6,7 +6,7 @@ * API result array */ function message_template_create_example() { - $params = array( + $params = [ 'msg_title' => 'msg_title_284', 'msg_subject' => 'msg_subject_284', 'msg_text' => 'msg_text_284', @@ -14,7 +14,7 @@ function message_template_create_example() { 'workflow_id' => 284, 'is_default' => '1', 'is_reserved' => 1, - ); + ]; try{ $result = civicrm_api3('MessageTemplate', 'create', $params); @@ -24,12 +24,12 @@ function message_template_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function message_template_create_example() { */ function message_template_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 69, - 'values' => array( - '69' => array( + 'values' => [ + '69' => [ 'id' => '69', 'msg_title' => 'msg_title_284', 'msg_subject' => 'msg_subject_284', @@ -61,9 +61,9 @@ function message_template_create_expectedresult() { 'is_reserved' => '1', 'is_sms' => '', 'pdf_format_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/MessageTemplate/Delete.php b/api/v3/examples/MessageTemplate/Delete.php index 388e12c2ae..70f769ff0d 100644 --- a/api/v3/examples/MessageTemplate/Delete.php +++ b/api/v3/examples/MessageTemplate/Delete.php @@ -6,9 +6,9 @@ * API result array */ function message_template_delete_example() { - $params = array( + $params = [ 'id' => 72, - ); + ]; try{ $result = civicrm_api3('MessageTemplate', 'delete', $params); @@ -18,12 +18,12 @@ function message_template_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function message_template_delete_example() { */ function message_template_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/MessageTemplate/Get.php b/api/v3/examples/MessageTemplate/Get.php index 318d8aada3..d29e2073f7 100644 --- a/api/v3/examples/MessageTemplate/Get.php +++ b/api/v3/examples/MessageTemplate/Get.php @@ -6,7 +6,7 @@ * API result array */ function message_template_get_example() { - $params = array( + $params = [ 'msg_title' => 'msg_title_285', 'msg_subject' => 'msg_subject_285', 'msg_text' => 'msg_text_285', @@ -14,7 +14,7 @@ function message_template_get_example() { 'workflow_id' => 285, 'is_default' => '1', 'is_reserved' => 1, - ); + ]; try{ $result = civicrm_api3('MessageTemplate', 'get', $params); @@ -24,12 +24,12 @@ function message_template_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function message_template_get_example() { */ function message_template_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 70, - 'values' => array( - '70' => array( + 'values' => [ + '70' => [ 'id' => '70', 'msg_title' => 'msg_title_285', 'msg_subject' => 'msg_subject_285', @@ -61,9 +61,9 @@ function message_template_get_expectedresult() { 'is_reserved' => '1', 'is_sms' => '1', 'pdf_format_id' => '285', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Note/Create.php b/api/v3/examples/Note/Create.php index 949de28248..89166d5ee3 100644 --- a/api/v3/examples/Note/Create.php +++ b/api/v3/examples/Note/Create.php @@ -6,14 +6,14 @@ * API result array */ function note_create_example() { - $params = array( + $params = [ 'entity_table' => 'civicrm_contact', 'entity_id' => 9, 'note' => 'Hello!!! m testing Note', 'contact_id' => 9, 'modified_date' => '2011-01-31', 'subject' => 'Test Note', - ); + ]; try{ $result = civicrm_api3('Note', 'create', $params); @@ -23,12 +23,12 @@ function note_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function note_create_example() { */ function note_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 8, - 'values' => array( - '8' => array( + 'values' => [ + '8' => [ 'id' => '8', 'entity_table' => 'civicrm_contact', 'entity_id' => '9', @@ -57,9 +57,9 @@ function note_create_expectedresult() { 'modified_date' => '2012-11-14 16:02:35', 'subject' => 'Test Note', 'privacy' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Note/Delete.php b/api/v3/examples/Note/Delete.php index 43d8b4f7f1..7fdca70af5 100644 --- a/api/v3/examples/Note/Delete.php +++ b/api/v3/examples/Note/Delete.php @@ -6,9 +6,9 @@ * API result array */ function note_delete_example() { - $params = array( + $params = [ 'id' => 19, - ); + ]; try{ $result = civicrm_api3('Note', 'delete', $params); @@ -18,12 +18,12 @@ function note_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function note_delete_example() { */ function note_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Note/Get.php b/api/v3/examples/Note/Get.php index 8fea36b90b..f045d610ab 100644 --- a/api/v3/examples/Note/Get.php +++ b/api/v3/examples/Note/Get.php @@ -6,10 +6,10 @@ * API result array */ function note_get_example() { - $params = array( + $params = [ 'entity_table' => 'civicrm_contact', 'entity_id' => 3, - ); + ]; try{ $result = civicrm_api3('Note', 'get', $params); @@ -19,12 +19,12 @@ function note_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,12 +38,12 @@ function note_get_example() { */ function note_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), - ); + 'values' => [], + ]; return $expectedResult; } diff --git a/api/v3/examples/OpenID/Create.php b/api/v3/examples/OpenID/Create.php index aeba330a1f..39cfeb0161 100644 --- a/api/v3/examples/OpenID/Create.php +++ b/api/v3/examples/OpenID/Create.php @@ -6,11 +6,11 @@ * API result array */ function open_i_d_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'openid' => 'My OpenID handle', 'location_type_id' => 1, - ); + ]; try{ $result = civicrm_api3('OpenID', 'create', $params); @@ -20,12 +20,12 @@ function open_i_d_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,22 +39,22 @@ function open_i_d_create_example() { */ function open_i_d_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '3', 'location_type_id' => '1', 'openid' => 'My OpenID handle', 'allowed_to_login' => '', 'is_primary' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/OpenID/Delete.php b/api/v3/examples/OpenID/Delete.php index 9f6d1cebd3..291dbbc592 100644 --- a/api/v3/examples/OpenID/Delete.php +++ b/api/v3/examples/OpenID/Delete.php @@ -6,9 +6,9 @@ * API result array */ function open_i_d_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('OpenID', 'delete', $params); @@ -18,12 +18,12 @@ function open_i_d_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function open_i_d_delete_example() { */ function open_i_d_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/OpenID/Get.php b/api/v3/examples/OpenID/Get.php index ec8eb8c425..4ebf7f556d 100644 --- a/api/v3/examples/OpenID/Get.php +++ b/api/v3/examples/OpenID/Get.php @@ -6,11 +6,11 @@ * API result array */ function open_i_d_get_example() { - $params = array( + $params = [ 'contact_id' => 4, 'openid' => 'My OpenID handle', 'location_type_id' => 1, - ); + ]; try{ $result = civicrm_api3('OpenID', 'get', $params); @@ -20,12 +20,12 @@ function open_i_d_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,22 +39,22 @@ function open_i_d_get_example() { */ function open_i_d_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id' => '4', 'location_type_id' => '1', 'openid' => 'My OpenID handle', 'allowed_to_login' => 0, 'is_primary' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/OptionGroup/Create.php b/api/v3/examples/OptionGroup/Create.php index cee25ba50b..b44190696a 100644 --- a/api/v3/examples/OptionGroup/Create.php +++ b/api/v3/examples/OptionGroup/Create.php @@ -6,19 +6,19 @@ * API result array */ function option_group_create_example() { - $params = array( + $params = [ 'sequential' => 1, 'name' => 'civicrm_event.amount.560', 'is_reserved' => 1, 'is_active' => 1, - 'api.OptionValue.create' => array( + 'api.OptionValue.create' => [ 'label' => 'workshop', 'value' => 35, 'is_default' => 1, 'is_active' => 1, 'format.only_id' => 1, - ), - ); + ], + ]; try{ $result = civicrm_api3('OptionGroup', 'create', $params); @@ -28,12 +28,12 @@ function option_group_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -47,13 +47,13 @@ function option_group_create_example() { */ function option_group_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 92, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '92', 'name' => 'civicrm_event.amount.560', 'title' => '', @@ -63,9 +63,9 @@ function option_group_create_expectedresult() { 'is_active' => '1', 'is_locked' => '', 'api.OptionValue.create' => 849, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/OptionGroup/Delete.php b/api/v3/examples/OptionGroup/Delete.php index 20839505b8..953f4eb760 100644 --- a/api/v3/examples/OptionGroup/Delete.php +++ b/api/v3/examples/OptionGroup/Delete.php @@ -6,9 +6,9 @@ * API result array */ function option_group_delete_example() { - $params = array( + $params = [ 'id' => 97, - ); + ]; try{ $result = civicrm_api3('OptionGroup', 'delete', $params); @@ -18,12 +18,12 @@ function option_group_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function option_group_delete_example() { */ function option_group_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/OptionGroup/Get.php b/api/v3/examples/OptionGroup/Get.php index 0b24c9013e..396906a3fc 100644 --- a/api/v3/examples/OptionGroup/Get.php +++ b/api/v3/examples/OptionGroup/Get.php @@ -6,9 +6,9 @@ * API result array */ function option_group_get_example() { - $params = array( + $params = [ 'name' => 'preferred_communication_method', - ); + ]; try{ $result = civicrm_api3('OptionGroup', 'get', $params); @@ -18,12 +18,12 @@ function option_group_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,22 +37,22 @@ function option_group_get_example() { */ function option_group_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => 'preferred_communication_method', 'title' => 'Preferred Communication Method', 'is_reserved' => '1', 'is_active' => '1', 'is_locked' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/OptionValue/Get.php b/api/v3/examples/OptionValue/Get.php index 964c41ffdc..9fc467248e 100644 --- a/api/v3/examples/OptionValue/Get.php +++ b/api/v3/examples/OptionValue/Get.php @@ -6,9 +6,9 @@ * API result array */ function option_value_get_example() { - $params = array( + $params = [ 'option_group_id' => 1, - ); + ]; try{ $result = civicrm_api3('OptionValue', 'get', $params); @@ -18,12 +18,12 @@ function option_value_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function option_value_get_example() { */ function option_value_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 5, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'option_group_id' => '1', 'label' => 'Phone', @@ -53,8 +53,8 @@ function option_value_get_expectedresult() { 'is_optgroup' => 0, 'is_reserved' => 0, 'is_active' => '1', - ), - '2' => array( + ], + '2' => [ 'id' => '2', 'option_group_id' => '1', 'label' => 'Email', @@ -65,8 +65,8 @@ function option_value_get_expectedresult() { 'is_optgroup' => 0, 'is_reserved' => 0, 'is_active' => '1', - ), - '3' => array( + ], + '3' => [ 'id' => '3', 'option_group_id' => '1', 'label' => 'Postal Mail', @@ -77,8 +77,8 @@ function option_value_get_expectedresult() { 'is_optgroup' => 0, 'is_reserved' => 0, 'is_active' => '1', - ), - '4' => array( + ], + '4' => [ 'id' => '4', 'option_group_id' => '1', 'label' => 'SMS', @@ -89,8 +89,8 @@ function option_value_get_expectedresult() { 'is_optgroup' => 0, 'is_reserved' => 0, 'is_active' => '1', - ), - '5' => array( + ], + '5' => [ 'id' => '5', 'option_group_id' => '1', 'label' => 'Fax', @@ -101,9 +101,9 @@ function option_value_get_expectedresult() { 'is_optgroup' => 0, 'is_reserved' => 0, 'is_active' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/OptionValue/SortOption.php b/api/v3/examples/OptionValue/SortOption.php index b7253c8ef4..bc4bbcd61b 100644 --- a/api/v3/examples/OptionValue/SortOption.php +++ b/api/v3/examples/OptionValue/SortOption.php @@ -8,13 +8,13 @@ * API result array */ function option_value_getsingle_example() { - $params = array( + $params = [ 'option_group_id' => 1, - 'options' => array( + 'options' => [ 'sort' => 'label DESC', 'limit' => 1, - ), - ); + ], + ]; try{ $result = civicrm_api3('OptionValue', 'getsingle', $params); @@ -24,12 +24,12 @@ function option_value_getsingle_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,7 +43,7 @@ function option_value_getsingle_example() { */ function option_value_getsingle_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'id' => '4', 'option_group_id' => '1', 'label' => 'SMS', @@ -54,7 +54,7 @@ function option_value_getsingle_expectedresult() { 'is_optgroup' => 0, 'is_reserved' => 0, 'is_active' => '1', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Order/Cancel.php b/api/v3/examples/Order/Cancel.php index 2e6ea262ca..eef34ecfae 100644 --- a/api/v3/examples/Order/Cancel.php +++ b/api/v3/examples/Order/Cancel.php @@ -6,9 +6,9 @@ * API result array */ function order_cancel_example() { - $params = array( + $params = [ 'contribution_id' => 1, - ); + ]; try{ $result = civicrm_api3('Order', 'cancel', $params); @@ -18,12 +18,12 @@ function order_cancel_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function order_cancel_example() { */ function order_cancel_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '16', 'financial_type_id' => '1', @@ -74,9 +74,9 @@ function order_cancel_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Order/Create.php b/api/v3/examples/Order/Create.php index 264b1493bd..8ab83214d1 100644 --- a/api/v3/examples/Order/Create.php +++ b/api/v3/examples/Order/Create.php @@ -6,16 +6,16 @@ * API result array */ function order_create_example() { - $params = array( + $params = [ 'contact_id' => 8, 'receive_date' => '2010-01-20', 'total_amount' => 200, 'financial_type_id' => 1, 'contribution_status_id' => 1, - 'line_items' => array( - '0' => array( - 'line_item' => array( - '0' => array( + 'line_items' => [ + '0' => [ + 'line_item' => [ + '0' => [ 'price_field_id' => '4', 'price_field_value_id' => '5', 'label' => 'Price Field 2', @@ -26,9 +26,9 @@ function order_create_example() { 'financial_type_id' => '4', 'entity_table' => 'civicrm_membership', 'membership_type_id' => 1, - ), - ), - 'params' => array( + ], + ], + 'params' => [ 'contact_id' => 8, 'membership_type_id' => 2, 'join_date' => '2006-01-21', @@ -37,10 +37,10 @@ function order_create_example() { 'source' => 'Payment', 'is_override' => 1, 'status_id' => 1, - ), - ), - ), - ); + ], + ], + ], + ]; try{ $result = civicrm_api3('Order', 'create', $params); @@ -50,12 +50,12 @@ function order_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -69,13 +69,13 @@ function order_create_example() { */ function order_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '8', 'financial_type_id' => '1', @@ -106,9 +106,9 @@ function order_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Order/CreateOrderParticipant.php b/api/v3/examples/Order/CreateOrderParticipant.php index b1a8a10401..6baee2a729 100644 --- a/api/v3/examples/Order/CreateOrderParticipant.php +++ b/api/v3/examples/Order/CreateOrderParticipant.php @@ -8,16 +8,16 @@ * API result array */ function order_create_example() { - $params = array( + $params = [ 'contact_id' => 11, 'receive_date' => '2010-01-20', 'total_amount' => 300, 'financial_type_id' => 1, 'contribution_status_id' => 1, - 'line_items' => array( - '0' => array( - 'line_item' => array( - '2' => array( + 'line_items' => [ + '0' => [ + 'line_item' => [ + '2' => [ 'price_field_id' => '2', 'price_field_value_id' => '2', 'label' => 'Price Field 1', @@ -27,8 +27,8 @@ function order_create_example() { 'line_total' => '100', 'financial_type_id' => '4', 'entity_table' => 'civicrm_participant', - ), - '3' => array( + ], + '3' => [ 'price_field_id' => '2', 'price_field_value_id' => '3', 'label' => 'Price Field 2', @@ -38,19 +38,19 @@ function order_create_example() { 'line_total' => '200', 'financial_type_id' => '4', 'entity_table' => 'civicrm_participant', - ), - ), - 'params' => array( + ], + ], + 'params' => [ 'contact_id' => 11, 'event_id' => 1, 'status_id' => 1, 'role_id' => 1, 'register_date' => '2007-07-21 00:00:00', 'source' => 'Online Event Registration: API Testing', - ), - ), - ), - ); + ], + ], + ], + ]; try{ $result = civicrm_api3('Order', 'create', $params); @@ -60,12 +60,12 @@ function order_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -79,13 +79,13 @@ function order_create_example() { */ function order_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '11', 'financial_type_id' => '1', @@ -116,9 +116,9 @@ function order_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Order/Delete.php b/api/v3/examples/Order/Delete.php index 9021a479a8..a1ba94375e 100644 --- a/api/v3/examples/Order/Delete.php +++ b/api/v3/examples/Order/Delete.php @@ -6,9 +6,9 @@ * API result array */ function order_delete_example() { - $params = array( + $params = [ 'contribution_id' => 1, - ); + ]; try{ $result = civicrm_api3('Order', 'delete', $params); @@ -18,12 +18,12 @@ function order_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,15 +37,15 @@ function order_delete_example() { */ function order_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( + 'values' => [ '1' => 1, - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Order/Get.php b/api/v3/examples/Order/Get.php index 720596c3d7..32ef1a23b7 100644 --- a/api/v3/examples/Order/Get.php +++ b/api/v3/examples/Order/Get.php @@ -6,9 +6,9 @@ * API result array */ function order_get_example() { - $params = array( + $params = [ 'contribution_id' => 1, - ); + ]; try{ $result = civicrm_api3('Order', 'get', $params); @@ -18,12 +18,12 @@ function order_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function order_get_example() { */ function order_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -93,8 +93,8 @@ function order_get_expectedresult() { 'check_number' => '', 'id' => '1', 'contribution_type_id' => '1', - 'line_items' => array( - '0' => array( + 'line_items' => [ + '0' => [ 'id' => '1', 'entity_table' => 'civicrm_contribution', 'entity_id' => '1', @@ -108,11 +108,11 @@ function order_get_expectedresult() { 'financial_type_id' => '1', 'non_deductible_amount' => '0.00', 'contribution_type_id' => '1', - ), - ), - ), - ), - ); + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Participant/Create.php b/api/v3/examples/Participant/Create.php index 15aa07367e..a6a714208d 100644 --- a/api/v3/examples/Participant/Create.php +++ b/api/v3/examples/Participant/Create.php @@ -6,7 +6,7 @@ * API result array */ function participant_create_example() { - $params = array( + $params = [ 'contact_id' => 2, 'event_id' => 2, 'status_id' => 1, @@ -14,7 +14,7 @@ function participant_create_example() { 'register_date' => '2007-07-21 00:00:00', 'source' => 'Online Event Registration: API Testing', 'custom_1' => 'custom string', - ); + ]; try{ $result = civicrm_api3('Participant', 'create', $params); @@ -24,12 +24,12 @@ function participant_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function participant_create_example() { */ function participant_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 4, - 'values' => array( - '4' => array( + 'values' => [ + '4' => [ 'id' => '4', 'contact_id' => '2', 'event_id' => '2', @@ -69,9 +69,9 @@ function participant_create_expectedresult() { 'cart_id' => '', 'must_wait' => '', 'transferred_to_contact_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Participant/Get.php b/api/v3/examples/Participant/Get.php index 52ad6116ac..0734b19708 100644 --- a/api/v3/examples/Participant/Get.php +++ b/api/v3/examples/Participant/Get.php @@ -6,9 +6,9 @@ * API result array */ function participant_get_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Participant', 'get', $params); @@ -18,12 +18,12 @@ function participant_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function participant_get_example() { */ function participant_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'contact_id' => '2', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -71,9 +71,9 @@ function participant_get_expectedresult() { 'participant_discount_name' => '', 'participant_campaign_id' => '', 'id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Participant/NestedDelete.php b/api/v3/examples/Participant/NestedDelete.php index 37555e4beb..8f098e52c3 100644 --- a/api/v3/examples/Participant/NestedDelete.php +++ b/api/v3/examples/Participant/NestedDelete.php @@ -8,10 +8,10 @@ * API result array */ function participant_get_example() { - $params = array( + $params = [ 'contact_id' => 4, 'api.participant.delete' => 1, - ); + ]; try{ $result = civicrm_api3('Participant', 'get', $params); @@ -21,12 +21,12 @@ function participant_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,12 +40,12 @@ function participant_get_example() { */ function participant_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'contact_id' => '4', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -73,14 +73,14 @@ function participant_get_expectedresult() { 'participant_discount_name' => '', 'participant_campaign_id' => '', 'id' => '2', - 'api.participant.delete' => array( + 'api.participant.delete' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ), - ), - '3' => array( + ], + ], + '3' => [ 'contact_id' => '4', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -108,15 +108,15 @@ function participant_get_expectedresult() { 'participant_discount_name' => '', 'participant_campaign_id' => '', 'id' => '3', - 'api.participant.delete' => array( + 'api.participant.delete' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Participant/NestedEventGet.php b/api/v3/examples/Participant/NestedEventGet.php index c6b335e63d..75bd573d5e 100644 --- a/api/v3/examples/Participant/NestedEventGet.php +++ b/api/v3/examples/Participant/NestedEventGet.php @@ -8,10 +8,10 @@ * API result array */ function participant_get_example() { - $params = array( + $params = [ 'id' => 1, 'api.event.get' => 1, - ); + ]; try{ $result = civicrm_api3('Participant', 'get', $params); @@ -21,12 +21,12 @@ function participant_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function participant_get_example() { */ function participant_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'contact_id' => '2', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -74,13 +74,13 @@ function participant_get_expectedresult() { 'participant_discount_name' => '', 'participant_campaign_id' => '', 'id' => '1', - 'api.event.get' => array( + 'api.event.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 7, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '7', 'title' => 'Annual CiviCRM meet', 'event_title' => 'Annual CiviCRM meet', @@ -117,12 +117,12 @@ function participant_get_expectedresult() { 'is_share' => '1', 'is_confirm_enabled' => '1', 'is_billing_required' => 0, - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ParticipantPayment/Create.php b/api/v3/examples/ParticipantPayment/Create.php index 5dca9fe9f3..9374697c02 100644 --- a/api/v3/examples/ParticipantPayment/Create.php +++ b/api/v3/examples/ParticipantPayment/Create.php @@ -6,10 +6,10 @@ * API result array */ function participant_payment_create_example() { - $params = array( + $params = [ 'participant_id' => 13, 'contribution_id' => 1, - ); + ]; try{ $result = civicrm_api3('ParticipantPayment', 'create', $params); @@ -19,12 +19,12 @@ function participant_payment_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,19 +38,19 @@ function participant_payment_create_example() { */ function participant_payment_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'participant_id' => '13', 'contribution_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ParticipantPayment/Delete.php b/api/v3/examples/ParticipantPayment/Delete.php index c7e48e4eef..4bf80353ac 100644 --- a/api/v3/examples/ParticipantPayment/Delete.php +++ b/api/v3/examples/ParticipantPayment/Delete.php @@ -6,9 +6,9 @@ * API result array */ function participant_payment_delete_example() { - $params = array( + $params = [ 'id' => 5, - ); + ]; try{ $result = civicrm_api3('ParticipantPayment', 'delete', $params); @@ -18,12 +18,12 @@ function participant_payment_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function participant_payment_delete_example() { */ function participant_payment_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ParticipantPayment/Get.php b/api/v3/examples/ParticipantPayment/Get.php index eaf18755b8..be2f52c535 100644 --- a/api/v3/examples/ParticipantPayment/Get.php +++ b/api/v3/examples/ParticipantPayment/Get.php @@ -6,10 +6,10 @@ * API result array */ function participant_payment_get_example() { - $params = array( + $params = [ 'participant_id' => 64, 'contribution_id' => 6, - ); + ]; try{ $result = civicrm_api3('ParticipantPayment', 'get', $params); @@ -19,12 +19,12 @@ function participant_payment_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,19 +38,19 @@ function participant_payment_get_example() { */ function participant_payment_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 6, - 'values' => array( - '6' => array( + 'values' => [ + '6' => [ 'id' => '6', 'participant_id' => '64', 'contribution_id' => '6', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ParticipantStatusType/Create.php b/api/v3/examples/ParticipantStatusType/Create.php index 9059a8b322..44a13f7418 100644 --- a/api/v3/examples/ParticipantStatusType/Create.php +++ b/api/v3/examples/ParticipantStatusType/Create.php @@ -6,7 +6,7 @@ * API result array */ function participant_status_type_create_example() { - $params = array( + $params = [ 'name' => 'test status', 'label' => 'I am a test', 'class' => 'Positive', @@ -15,7 +15,7 @@ function participant_status_type_create_example() { 'is_counted' => 1, 'visibility_id' => 1, 'weight' => 10, - ); + ]; try{ $result = civicrm_api3('ParticipantStatusType', 'create', $params); @@ -25,12 +25,12 @@ function participant_status_type_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function participant_status_type_create_example() { */ function participant_status_type_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 18, - 'values' => array( - '18' => array( + 'values' => [ + '18' => [ 'id' => '18', 'name' => 'test status', 'label' => 'I am a test', @@ -60,9 +60,9 @@ function participant_status_type_create_expectedresult() { 'is_counted' => '1', 'weight' => '10', 'visibility_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ParticipantStatusType/Delete.php b/api/v3/examples/ParticipantStatusType/Delete.php index ae4fa45657..4c1567d175 100644 --- a/api/v3/examples/ParticipantStatusType/Delete.php +++ b/api/v3/examples/ParticipantStatusType/Delete.php @@ -6,9 +6,9 @@ * API result array */ function participant_status_type_delete_example() { - $params = array( + $params = [ 'id' => 19, - ); + ]; try{ $result = civicrm_api3('ParticipantStatusType', 'delete', $params); @@ -18,12 +18,12 @@ function participant_status_type_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function participant_status_type_delete_example() { */ function participant_status_type_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => TRUE, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ParticipantStatusType/Get.php b/api/v3/examples/ParticipantStatusType/Get.php index 7eb41e6d0f..70bd8a9d24 100644 --- a/api/v3/examples/ParticipantStatusType/Get.php +++ b/api/v3/examples/ParticipantStatusType/Get.php @@ -6,7 +6,7 @@ * API result array */ function participant_status_type_get_example() { - $params = array( + $params = [ 'name' => 'test status', 'label' => 'I am a test', 'class' => 'Positive', @@ -15,7 +15,7 @@ function participant_status_type_get_example() { 'is_counted' => 1, 'visibility_id' => 1, 'weight' => 10, - ); + ]; try{ $result = civicrm_api3('ParticipantStatusType', 'get', $params); @@ -25,12 +25,12 @@ function participant_status_type_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function participant_status_type_get_example() { */ function participant_status_type_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 18, - 'values' => array( - '18' => array( + 'values' => [ + '18' => [ 'id' => '18', 'name' => 'test status', 'label' => 'I am a test', @@ -60,9 +60,9 @@ function participant_status_type_get_expectedresult() { 'is_counted' => '1', 'weight' => '10', 'visibility_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Payment/Cancel.php b/api/v3/examples/Payment/Cancel.php index 84e18f4407..c923220323 100644 --- a/api/v3/examples/Payment/Cancel.php +++ b/api/v3/examples/Payment/Cancel.php @@ -6,10 +6,10 @@ * API result array */ function payment_cancel_example() { - $params = array( + $params = [ 'id' => 2, 'check_permissions' => TRUE, - ); + ]; try{ $result = civicrm_api3('Payment', 'cancel', $params); @@ -19,12 +19,12 @@ function payment_cancel_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function payment_cancel_example() { */ function payment_cancel_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => 3, 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', @@ -58,9 +58,9 @@ function payment_cancel_expectedresult() { 'trxn_result_code' => '', 'status_id' => '7', 'payment_processor_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Payment/Create.php b/api/v3/examples/Payment/Create.php index 6ece14b33a..335945660b 100644 --- a/api/v3/examples/Payment/Create.php +++ b/api/v3/examples/Payment/Create.php @@ -6,10 +6,10 @@ * API result array */ function payment_create_example() { - $params = array( + $params = [ 'contribution_id' => 1, 'total_amount' => 50, - ); + ]; try{ $result = civicrm_api3('Payment', 'create', $params); @@ -19,12 +19,12 @@ function payment_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function payment_create_example() { */ function payment_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', @@ -58,9 +58,9 @@ function payment_create_expectedresult() { 'trxn_result_code' => '', 'status_id' => '1', 'payment_processor_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Payment/CreatePaymentWithLineItems.php b/api/v3/examples/Payment/CreatePaymentWithLineItems.php index f2b1613a61..7d2c3fdb15 100644 --- a/api/v3/examples/Payment/CreatePaymentWithLineItems.php +++ b/api/v3/examples/Payment/CreatePaymentWithLineItems.php @@ -8,18 +8,18 @@ * API result array */ function payment_create_example() { - $params = array( + $params = [ 'contribution_id' => 1, 'total_amount' => 50, - 'line_item' => array( - '0' => array( + 'line_item' => [ + '0' => [ '1' => 10, - ), - '1' => array( + ], + '1' => [ '2' => 40, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Payment', 'create', $params); @@ -29,12 +29,12 @@ function payment_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -48,13 +48,13 @@ function payment_create_example() { */ function payment_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', @@ -68,9 +68,9 @@ function payment_create_expectedresult() { 'trxn_result_code' => '', 'status_id' => '1', 'payment_processor_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Payment/Delete.php b/api/v3/examples/Payment/Delete.php index 51bc8727f9..99c75f8b2c 100644 --- a/api/v3/examples/Payment/Delete.php +++ b/api/v3/examples/Payment/Delete.php @@ -6,10 +6,10 @@ * API result array */ function payment_delete_example() { - $params = array( + $params = [ 'id' => 2, 'check_permissions' => TRUE, - ); + ]; try{ $result = civicrm_api3('Payment', 'delete', $params); @@ -19,12 +19,12 @@ function payment_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,12 +38,12 @@ function payment_delete_example() { */ function payment_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Payment/Get.php b/api/v3/examples/Payment/Get.php index ac1263d504..d21df61552 100644 --- a/api/v3/examples/Payment/Get.php +++ b/api/v3/examples/Payment/Get.php @@ -6,10 +6,10 @@ * API result array */ function payment_get_example() { - $params = array( + $params = [ 'contribution_id' => 1, 'check_permissions' => TRUE, - ); + ]; try{ $result = civicrm_api3('Payment', 'get', $params); @@ -19,12 +19,12 @@ function payment_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function payment_get_example() { */ function payment_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'to_financial_account_id' => '6', 'trxn_date' => '2010-01-20 00:00:00', @@ -57,9 +57,9 @@ function payment_get_expectedresult() { 'status_id' => '1', 'payment_instrument_id' => '4', 'contribution_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Payment/UpdatePayment.php b/api/v3/examples/Payment/UpdatePayment.php index 81e017e223..38b15474bf 100644 --- a/api/v3/examples/Payment/UpdatePayment.php +++ b/api/v3/examples/Payment/UpdatePayment.php @@ -8,12 +8,12 @@ * API result array */ function payment_create_example() { - $params = array( + $params = [ 'contribution_id' => 1, 'total_amount' => 100, 'id' => 3, 'check_permissions' => TRUE, - ); + ]; try{ $result = civicrm_api3('Payment', 'create', $params); @@ -23,12 +23,12 @@ function payment_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function payment_create_example() { */ function payment_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 5, - 'values' => array( - '5' => array( + 'values' => [ + '5' => [ 'id' => '5', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', @@ -62,9 +62,9 @@ function payment_create_expectedresult() { 'trxn_result_code' => '', 'status_id' => '1', 'payment_processor_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PaymentProcessor/Create.php b/api/v3/examples/PaymentProcessor/Create.php index aa481f9fbc..cb1794f201 100644 --- a/api/v3/examples/PaymentProcessor/Create.php +++ b/api/v3/examples/PaymentProcessor/Create.php @@ -6,13 +6,13 @@ * API result array */ function payment_processor_create_example() { - $params = array( + $params = [ 'name' => 'API Test PP', 'payment_processor_type_id' => 1, 'class_name' => 'CRM_Core_Payment_APITest', 'is_recur' => 0, 'domain_id' => 1, - ); + ]; try{ $result = civicrm_api3('PaymentProcessor', 'create', $params); @@ -22,12 +22,12 @@ function payment_processor_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function payment_processor_create_example() { */ function payment_processor_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'domain_id' => '1', 'name' => 'API Test PP', @@ -70,9 +70,9 @@ function payment_processor_create_expectedresult() { 'payment_type' => '1', 'payment_instrument_id' => '1', 'accepted_credit_cards' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PaymentProcessor/Delete.php b/api/v3/examples/PaymentProcessor/Delete.php index a633f4c4bf..4ee4993aa1 100644 --- a/api/v3/examples/PaymentProcessor/Delete.php +++ b/api/v3/examples/PaymentProcessor/Delete.php @@ -6,9 +6,9 @@ * API result array */ function payment_processor_delete_example() { - $params = array( + $params = [ 'id' => 2, - ); + ]; try{ $result = civicrm_api3('PaymentProcessor', 'delete', $params); @@ -18,12 +18,12 @@ function payment_processor_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function payment_processor_delete_example() { */ function payment_processor_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/PaymentProcessorType/Create.php b/api/v3/examples/PaymentProcessorType/Create.php index d6fc4c1e14..80acce7330 100644 --- a/api/v3/examples/PaymentProcessorType/Create.php +++ b/api/v3/examples/PaymentProcessorType/Create.php @@ -6,14 +6,14 @@ * API result array */ function payment_processor_type_create_example() { - $params = array( + $params = [ 'sequential' => 1, 'name' => 'API_Test_PP', 'title' => 'API Test Payment Processor', 'class_name' => 'CRM_Core_Payment_APITest', 'billing_mode' => 'form', 'is_recur' => 0, - ); + ]; try{ $result = civicrm_api3('PaymentProcessorType', 'create', $params); @@ -23,12 +23,12 @@ function payment_processor_type_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function payment_processor_type_create_example() { */ function payment_processor_type_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 13, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '13', 'name' => 'API_Test_PP', 'title' => 'API Test Payment Processor', @@ -72,9 +72,9 @@ function payment_processor_type_create_expectedresult() { 'is_recur' => 0, 'payment_type' => '', 'payment_instrument_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PaymentProcessorType/Delete.php b/api/v3/examples/PaymentProcessorType/Delete.php index d5a6c6d5b0..3126ca7a3d 100644 --- a/api/v3/examples/PaymentProcessorType/Delete.php +++ b/api/v3/examples/PaymentProcessorType/Delete.php @@ -6,9 +6,9 @@ * API result array */ function payment_processor_type_delete_example() { - $params = array( + $params = [ 'id' => 15, - ); + ]; try{ $result = civicrm_api3('PaymentProcessorType', 'delete', $params); @@ -18,12 +18,12 @@ function payment_processor_type_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function payment_processor_type_delete_example() { */ function payment_processor_type_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => TRUE, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/PaymentToken/Create.php b/api/v3/examples/PaymentToken/Create.php index 854c185c46..5df14cd19e 100644 --- a/api/v3/examples/PaymentToken/Create.php +++ b/api/v3/examples/PaymentToken/Create.php @@ -9,12 +9,12 @@ * API result array */ function payment_token_create_example() { - $params = array( + $params = [ 'token' => 'fancy-token-xxxx', 'contact_id' => 3, 'created_id' => 3, 'payment_processor_id' => 1, - ); + ]; try{ $result = civicrm_api3('PaymentToken', 'create', $params); @@ -24,12 +24,12 @@ function payment_token_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function payment_token_create_example() { */ function payment_token_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '3', 'payment_processor_id' => '1', @@ -63,9 +63,9 @@ function payment_token_create_expectedresult() { 'billing_last_name' => '', 'masked_account_number' => '', 'ip_address' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PaymentToken/Delete.php b/api/v3/examples/PaymentToken/Delete.php index 460d6ad136..c7f368838f 100644 --- a/api/v3/examples/PaymentToken/Delete.php +++ b/api/v3/examples/PaymentToken/Delete.php @@ -6,9 +6,9 @@ * API result array */ function payment_token_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('PaymentToken', 'delete', $params); @@ -18,12 +18,12 @@ function payment_token_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function payment_token_delete_example() { */ function payment_token_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/PaymentToken/Get.php b/api/v3/examples/PaymentToken/Get.php index 101c847b40..43ae1e7202 100644 --- a/api/v3/examples/PaymentToken/Get.php +++ b/api/v3/examples/PaymentToken/Get.php @@ -6,12 +6,12 @@ * API result array */ function payment_token_get_example() { - $params = array( + $params = [ 'token' => 'fancy-token-xxxx', 'contact_id' => 4, 'created_id' => 4, 'payment_processor_id' => 2, - ); + ]; try{ $result = civicrm_api3('PaymentToken', 'get', $params); @@ -21,12 +21,12 @@ function payment_token_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,22 +40,22 @@ function payment_token_get_example() { */ function payment_token_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id' => '4', 'payment_processor_id' => '2', 'token' => 'fancy-token-xxxx', 'created_date' => '2013-07-28 08:49:19', 'created_id' => '4', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Pcp/Create.php b/api/v3/examples/Pcp/Create.php index d3481c70a9..dc659cce38 100644 --- a/api/v3/examples/Pcp/Create.php +++ b/api/v3/examples/Pcp/Create.php @@ -6,12 +6,12 @@ * API result array */ function pcp_create_example() { - $params = array( + $params = [ 'title' => 'Pcp title', 'contact_id' => 1, 'page_id' => 1, 'pcp_block_id' => 1, - ); + ]; try{ $result = civicrm_api3('Pcp', 'create', $params); @@ -21,12 +21,12 @@ function pcp_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function pcp_create_example() { */ function pcp_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '1', 'status_id' => 0, @@ -63,9 +63,9 @@ function pcp_create_expectedresult() { 'currency' => 'USD', 'is_active' => '', 'is_notify' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Phone/Create.php b/api/v3/examples/Phone/Create.php index 384cf28e1f..8f2a0c2178 100644 --- a/api/v3/examples/Phone/Create.php +++ b/api/v3/examples/Phone/Create.php @@ -6,13 +6,13 @@ * API result array */ function phone_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'location_type_id' => 6, 'phone' => '(123) 456-7890', 'is_primary' => 1, 'phone_type_id' => 1, - ); + ]; try{ $result = civicrm_api3('Phone', 'create', $params); @@ -22,12 +22,12 @@ function phone_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function phone_create_example() { */ function phone_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id' => '3', 'location_type_id' => '6', @@ -58,9 +58,9 @@ function phone_create_expectedresult() { 'phone_ext' => '', 'phone_numeric' => '', 'phone_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Phone/Delete.php b/api/v3/examples/Phone/Delete.php index 6f4b97e22a..07bb8a2353 100644 --- a/api/v3/examples/Phone/Delete.php +++ b/api/v3/examples/Phone/Delete.php @@ -6,9 +6,9 @@ * API result array */ function phone_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Phone', 'delete', $params); @@ -18,12 +18,12 @@ function phone_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function phone_delete_example() { */ function phone_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Phone/Get.php b/api/v3/examples/Phone/Get.php index ef1a0794c9..40571916fc 100644 --- a/api/v3/examples/Phone/Get.php +++ b/api/v3/examples/Phone/Get.php @@ -6,10 +6,10 @@ * API result array */ function phone_get_example() { - $params = array( + $params = [ 'contact_id' => 7, 'phone' => '(123) 456-7890', - ); + ]; try{ $result = civicrm_api3('Phone', 'get', $params); @@ -19,12 +19,12 @@ function phone_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function phone_get_example() { */ function phone_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 4, - 'values' => array( - '4' => array( + 'values' => [ + '4' => [ 'id' => '4', 'contact_id' => '7', 'location_type_id' => '10', @@ -53,9 +53,9 @@ function phone_get_expectedresult() { 'phone' => '(123) 456-7890', 'phone_numeric' => '1234567890', 'phone_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Phone/GetOptions.php b/api/v3/examples/Phone/GetOptions.php index 777f4a7ada..1b7cd959b9 100644 --- a/api/v3/examples/Phone/GetOptions.php +++ b/api/v3/examples/Phone/GetOptions.php @@ -6,9 +6,9 @@ * API result array */ function phone_getoptions_example() { - $params = array( + $params = [ 'field' => 'phone_type_id', - ); + ]; try{ $result = civicrm_api3('Phone', 'getoptions', $params); @@ -18,12 +18,12 @@ function phone_getoptions_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,18 +37,18 @@ function phone_getoptions_example() { */ function phone_getoptions_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 5, - 'values' => array( + 'values' => [ '1' => 'Phone', '2' => 'Mobile', '3' => 'Fax', '4' => 'Pager', '5' => 'Voicemail', - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Pledge/Create.php b/api/v3/examples/Pledge/Create.php index c138d72251..e524f20c89 100644 --- a/api/v3/examples/Pledge/Create.php +++ b/api/v3/examples/Pledge/Create.php @@ -6,7 +6,7 @@ * API result array */ function pledge_create_example() { - $params = array( + $params = [ 'contact_id' => 11, 'pledge_create_date' => '20170207', 'start_date' => '20170207', @@ -20,7 +20,7 @@ function pledge_create_example() { 'frequency_day' => 15, 'installments' => 5, 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('Pledge', 'create', $params); @@ -30,12 +30,12 @@ function pledge_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -49,13 +49,13 @@ function pledge_create_example() { */ function pledge_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'contact_id' => '11', 'financial_type_id' => '1', @@ -79,9 +79,9 @@ function pledge_create_expectedresult() { 'status_id' => '2', 'is_test' => '', 'campaign_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Pledge/Delete.php b/api/v3/examples/Pledge/Delete.php index 17e4780458..7b6e86458f 100644 --- a/api/v3/examples/Pledge/Delete.php +++ b/api/v3/examples/Pledge/Delete.php @@ -6,9 +6,9 @@ * API result array */ function pledge_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Pledge', 'delete', $params); @@ -18,12 +18,12 @@ function pledge_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,15 +37,15 @@ function pledge_delete_example() { */ function pledge_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 'id', - 'values' => array( + 'values' => [ 'id' => 1, - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Pledge/Get.php b/api/v3/examples/Pledge/Get.php index 541ca67466..7f75449bd0 100644 --- a/api/v3/examples/Pledge/Get.php +++ b/api/v3/examples/Pledge/Get.php @@ -6,9 +6,9 @@ * API result array */ function pledge_get_example() { - $params = array( + $params = [ 'pledge_id' => 1, - ); + ]; try{ $result = civicrm_api3('Pledge', 'get', $params); @@ -18,12 +18,12 @@ function pledge_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function pledge_get_example() { */ function pledge_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'contact_id' => '5', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -66,9 +66,9 @@ function pledge_get_expectedresult() { 'pledge_campaign_id' => '', 'pledge_currency' => 'USD', 'id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Pledge/GetFilterHighDate.php b/api/v3/examples/Pledge/GetFilterHighDate.php index 64b6b3ce57..c567d852e9 100644 --- a/api/v3/examples/Pledge/GetFilterHighDate.php +++ b/api/v3/examples/Pledge/GetFilterHighDate.php @@ -8,9 +8,9 @@ * API result array */ function pledge_get_example() { - $params = array( + $params = [ 'pledge_start_date_high' => '20170205024740', - ); + ]; try{ $result = civicrm_api3('Pledge', 'get', $params); @@ -20,12 +20,12 @@ function pledge_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function pledge_get_example() { */ function pledge_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'contact_id' => '8', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -68,9 +68,9 @@ function pledge_get_expectedresult() { 'pledge_campaign_id' => '', 'pledge_currency' => 'USD', 'id' => '2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PledgePayment/Create.php b/api/v3/examples/PledgePayment/Create.php index bfbe8f64fa..07070f6a61 100644 --- a/api/v3/examples/PledgePayment/Create.php +++ b/api/v3/examples/PledgePayment/Create.php @@ -6,13 +6,13 @@ * API result array */ function pledge_payment_create_example() { - $params = array( + $params = [ 'contact_id' => 1, 'pledge_id' => 1, 'contribution_id' => 1, 'status_id' => 1, 'actual_amount' => 20, - ); + ]; try{ $result = civicrm_api3('PledgePayment', 'create', $params); @@ -22,12 +22,12 @@ function pledge_payment_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function pledge_payment_create_example() { */ function pledge_payment_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'pledge_id' => '1', 'contribution_id' => '1', @@ -58,9 +58,9 @@ function pledge_payment_create_expectedresult() { 'reminder_date' => '', 'reminder_count' => '', 'status_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PledgePayment/Delete.php b/api/v3/examples/PledgePayment/Delete.php index 3a0faa1372..ce498be4ef 100644 --- a/api/v3/examples/PledgePayment/Delete.php +++ b/api/v3/examples/PledgePayment/Delete.php @@ -6,9 +6,9 @@ * API result array */ function pledge_payment_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('PledgePayment', 'delete', $params); @@ -18,12 +18,12 @@ function pledge_payment_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,15 +37,15 @@ function pledge_payment_delete_example() { */ function pledge_payment_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 'id', - 'values' => array( + 'values' => [ 'id' => 1, - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PledgePayment/Get.php b/api/v3/examples/PledgePayment/Get.php index 20018f0088..3d42d7ba84 100644 --- a/api/v3/examples/PledgePayment/Get.php +++ b/api/v3/examples/PledgePayment/Get.php @@ -6,7 +6,7 @@ * API result array */ function pledge_payment_get_example() { - $params = array(); + $params = []; try{ $result = civicrm_api3('PledgePayment', 'get', $params); @@ -16,12 +16,12 @@ function pledge_payment_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -35,12 +35,12 @@ function pledge_payment_get_example() { */ function pledge_payment_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 5, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'pledge_id' => '1', 'scheduled_amount' => '20.00', @@ -48,8 +48,8 @@ function pledge_payment_get_expectedresult() { 'scheduled_date' => '20130728085413', 'reminder_count' => 0, 'status_id' => '2', - ), - '2' => array( + ], + '2' => [ 'id' => '2', 'pledge_id' => '1', 'scheduled_amount' => '20.00', @@ -57,8 +57,8 @@ function pledge_payment_get_expectedresult() { 'scheduled_date' => '20130728085413', 'reminder_count' => 0, 'status_id' => '2', - ), - '3' => array( + ], + '3' => [ 'id' => '3', 'pledge_id' => '1', 'scheduled_amount' => '20.00', @@ -66,8 +66,8 @@ function pledge_payment_get_expectedresult() { 'scheduled_date' => '20130728085413', 'reminder_count' => 0, 'status_id' => '2', - ), - '4' => array( + ], + '4' => [ 'id' => '4', 'pledge_id' => '1', 'scheduled_amount' => '20.00', @@ -75,8 +75,8 @@ function pledge_payment_get_expectedresult() { 'scheduled_date' => '20130728085413', 'reminder_count' => 0, 'status_id' => '2', - ), - '5' => array( + ], + '5' => [ 'id' => '5', 'pledge_id' => '1', 'scheduled_amount' => '20.00', @@ -84,9 +84,9 @@ function pledge_payment_get_expectedresult() { 'scheduled_date' => '20130728085413', 'reminder_count' => 0, 'status_id' => '2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PledgePayment/Update.php b/api/v3/examples/PledgePayment/Update.php index 202ba48ac8..b9dc6999d7 100644 --- a/api/v3/examples/PledgePayment/Update.php +++ b/api/v3/examples/PledgePayment/Update.php @@ -6,10 +6,10 @@ * API result array */ function pledge_payment_update_example() { - $params = array( + $params = [ 'id' => 1, 'status_id' => 1, - ); + ]; try{ $result = civicrm_api3('PledgePayment', 'update', $params); @@ -19,12 +19,12 @@ function pledge_payment_update_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function pledge_payment_update_example() { */ function pledge_payment_update_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'pledge_id' => '1', 'contribution_id' => '1', @@ -55,9 +55,9 @@ function pledge_payment_update_expectedresult() { 'reminder_date' => '', 'reminder_count' => 0, 'status_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceField/Create.php b/api/v3/examples/PriceField/Create.php index 054a7a65fb..c25152293b 100644 --- a/api/v3/examples/PriceField/Create.php +++ b/api/v3/examples/PriceField/Create.php @@ -6,14 +6,14 @@ * API result array */ function price_field_create_example() { - $params = array( + $params = [ 'price_set_id' => 3, 'name' => 'grassvariety', 'label' => 'Grass Variety', 'html_type' => 'Text', 'is_enter_qty' => 1, 'is_active' => 1, - ); + ]; try{ $result = civicrm_api3('PriceField', 'create', $params); @@ -23,12 +23,12 @@ function price_field_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,13 +42,13 @@ function price_field_create_example() { */ function price_field_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'price_set_id' => '3', 'name' => 'grassvariety', @@ -66,9 +66,9 @@ function price_field_create_expectedresult() { 'expire_on' => '', 'javascript' => '', 'visibility_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceField/Delete.php b/api/v3/examples/PriceField/Delete.php index 2e1f037fff..51213fe012 100644 --- a/api/v3/examples/PriceField/Delete.php +++ b/api/v3/examples/PriceField/Delete.php @@ -6,9 +6,9 @@ * API result array */ function price_field_delete_example() { - $params = array( + $params = [ 'id' => 4, - ); + ]; try{ $result = civicrm_api3('PriceField', 'delete', $params); @@ -18,12 +18,12 @@ function price_field_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function price_field_delete_example() { */ function price_field_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceField/Get.php b/api/v3/examples/PriceField/Get.php index c3da7002da..5ea6fe86b8 100644 --- a/api/v3/examples/PriceField/Get.php +++ b/api/v3/examples/PriceField/Get.php @@ -6,9 +6,9 @@ * API result array */ function price_field_get_example() { - $params = array( + $params = [ 'name' => 'contribution_amount', - ); + ]; try{ $result = civicrm_api3('PriceField', 'get', $params); @@ -18,12 +18,12 @@ function price_field_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function price_field_get_example() { */ function price_field_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'price_set_id' => '1', 'name' => 'contribution_amount', @@ -56,9 +56,9 @@ function price_field_get_expectedresult() { 'is_active' => '1', 'is_required' => '1', 'visibility_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceFieldValue/Create.php b/api/v3/examples/PriceFieldValue/Create.php index a833aa785e..e6332aa8a0 100644 --- a/api/v3/examples/PriceFieldValue/Create.php +++ b/api/v3/examples/PriceFieldValue/Create.php @@ -6,7 +6,7 @@ * API result array */ function price_field_value_create_example() { - $params = array( + $params = [ 'price_field_id' => 13, 'membership_type_id' => 5, 'name' => 'memType1', @@ -15,7 +15,7 @@ function price_field_value_create_example() { 'membership_num_terms' => 2, 'is_active' => 1, 'financial_type_id' => 2, - ); + ]; try{ $result = civicrm_api3('PriceFieldValue', 'create', $params); @@ -25,12 +25,12 @@ function price_field_value_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function price_field_value_create_example() { */ function price_field_value_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 10, - 'values' => array( - '10' => array( + 'values' => [ + '10' => [ 'id' => '10', 'price_field_id' => '13', 'name' => 'memType1', @@ -69,9 +69,9 @@ function price_field_value_create_expectedresult() { 'financial_type_id' => '2', 'non_deductible_amount' => '', 'contribution_type_id' => '2', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceFieldValue/Delete.php b/api/v3/examples/PriceFieldValue/Delete.php index 084aac721b..b258473c78 100644 --- a/api/v3/examples/PriceFieldValue/Delete.php +++ b/api/v3/examples/PriceFieldValue/Delete.php @@ -6,9 +6,9 @@ * API result array */ function price_field_value_delete_example() { - $params = array( + $params = [ 'id' => 7, - ); + ]; try{ $result = civicrm_api3('PriceFieldValue', 'delete', $params); @@ -18,12 +18,12 @@ function price_field_value_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function price_field_value_delete_example() { */ function price_field_value_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceFieldValue/Get.php b/api/v3/examples/PriceFieldValue/Get.php index 9443533d1c..6a949c384e 100644 --- a/api/v3/examples/PriceFieldValue/Get.php +++ b/api/v3/examples/PriceFieldValue/Get.php @@ -6,9 +6,9 @@ * API result array */ function price_field_value_get_example() { - $params = array( + $params = [ 'name' => 'contribution_amount', - ); + ]; try{ $result = civicrm_api3('PriceFieldValue', 'get', $params); @@ -18,12 +18,12 @@ function price_field_value_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function price_field_value_get_example() { */ function price_field_value_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'price_field_id' => '1', 'name' => 'contribution_amount', @@ -55,9 +55,9 @@ function price_field_value_get_expectedresult() { 'financial_type_id' => '1', 'non_deductible_amount' => '0.00', 'contribution_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceSet/Create.php b/api/v3/examples/PriceSet/Create.php index bf801c3eac..be4f7fd9bc 100644 --- a/api/v3/examples/PriceSet/Create.php +++ b/api/v3/examples/PriceSet/Create.php @@ -6,13 +6,13 @@ * API result array */ function price_set_create_example() { - $params = array( + $params = [ 'entity_table' => 'civicrm_event', 'entity_id' => 1, 'name' => 'event price', 'title' => 'event price', 'extends' => 1, - ); + ]; try{ $result = civicrm_api3('PriceSet', 'create', $params); @@ -22,12 +22,12 @@ function price_set_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function price_set_create_example() { */ function price_set_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 18, - 'values' => array( - '18' => array( + 'values' => [ + '18' => [ 'id' => '18', 'domain_id' => '', 'name' => 'event price', @@ -61,9 +61,9 @@ function price_set_create_expectedresult() { 'is_quick_config' => '', 'is_reserved' => '', 'min_amount' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceSet/Delete.php b/api/v3/examples/PriceSet/Delete.php index 3929b96906..e4f96909d3 100644 --- a/api/v3/examples/PriceSet/Delete.php +++ b/api/v3/examples/PriceSet/Delete.php @@ -6,9 +6,9 @@ * API result array */ function price_set_delete_example() { - $params = array( + $params = [ 'id' => 19, - ); + ]; try{ $result = civicrm_api3('PriceSet', 'delete', $params); @@ -18,12 +18,12 @@ function price_set_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function price_set_delete_example() { */ function price_set_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/PriceSet/Get.php b/api/v3/examples/PriceSet/Get.php index 7be052caa0..be0f4fd52e 100644 --- a/api/v3/examples/PriceSet/Get.php +++ b/api/v3/examples/PriceSet/Get.php @@ -6,9 +6,9 @@ * API result array */ function price_set_get_example() { - $params = array( + $params = [ 'name' => 'default_contribution_amount', - ); + ]; try{ $result = civicrm_api3('PriceSet', 'get', $params); @@ -18,12 +18,12 @@ function price_set_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function price_set_get_example() { */ function price_set_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'name' => 'default_contribution_amount', 'title' => 'Contribution Amount', @@ -52,10 +52,10 @@ function price_set_get_expectedresult() { 'is_quick_config' => '1', 'is_reserved' => '1', 'min_amount' => 0, - 'entity' => array(), - ), - ), - ); + 'entity' => [], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Profile/Apply.php b/api/v3/examples/Profile/Apply.php index 57b867c4d3..c3d881b4b8 100644 --- a/api/v3/examples/Profile/Apply.php +++ b/api/v3/examples/Profile/Apply.php @@ -6,7 +6,7 @@ * API result array */ function profile_apply_example() { - $params = array( + $params = [ 'profile_id' => 31, 'contact_id' => 3, 'first_name' => 'abc2', @@ -15,7 +15,7 @@ function profile_apply_example() { 'phone-1-1' => '022 321 826', 'country-1' => '1013', 'state_province-1' => '1000', - ); + ]; try{ $result = civicrm_api3('Profile', 'apply', $params); @@ -25,12 +25,12 @@ function profile_apply_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,11 +44,11 @@ function profile_apply_example() { */ function profile_apply_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 11, - 'values' => array( + 'values' => [ 'contact_type' => 'Individual', 'contact_sub_type' => '', 'contact_id' => 3, @@ -57,31 +57,31 @@ function profile_apply_expectedresult() { 'profile_id' => 31, 'first_name' => 'abc2', 'last_name' => 'xyz2', - 'email' => array( - '1' => array( + 'email' => [ + '1' => [ 'location_type_id' => '1', 'is_primary' => 1, 'email' => 'abc2.xyz2@gmail.com', - ), - ), - 'phone' => array( - '2' => array( + ], + ], + 'phone' => [ + '2' => [ 'location_type_id' => '1', 'is_primary' => 1, 'phone_type_id' => '1', 'phone' => '022 321 826', - ), - ), - 'address' => array( - '1' => array( + ], + ], + 'address' => [ + '1' => [ 'location_type_id' => '1', 'is_primary' => 1, 'country_id' => '1013', 'state_province_id' => '1000', - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Profile/Get.php b/api/v3/examples/Profile/Get.php index 9a34012a83..0e9e07c701 100644 --- a/api/v3/examples/Profile/Get.php +++ b/api/v3/examples/Profile/Get.php @@ -6,14 +6,14 @@ * API result array */ function profile_get_example() { - $params = array( - 'profile_id' => array( + $params = [ + 'profile_id' => [ '0' => 15, '1' => 1, '2' => 'Billing', - ), + ], 'contact_id' => 3, - ); + ]; try{ $result = civicrm_api3('Profile', 'get', $params); @@ -23,12 +23,12 @@ function profile_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,12 +42,12 @@ function profile_get_example() { */ function profile_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 3, - 'values' => array( - '15' => array( + 'values' => [ + '15' => [ 'postal_code-1' => '90210', 'state_province-1' => '1021', 'country-1' => '1228', @@ -56,8 +56,8 @@ function profile_get_expectedresult() { 'last_name' => 'xyz1', 'first_name' => 'abc1', 'email-primary' => 'abc1.xyz1@yahoo.com', - ), - '1' => array( + ], + '1' => [ 'first_name' => 'abc1', 'last_name' => 'xyz1', 'street_address-1' => '5 Saint Helier St', @@ -65,8 +65,8 @@ function profile_get_expectedresult() { 'postal_code-1' => '90210', 'country-1' => '1228', 'state_province-1' => '1021', - ), - 'Billing' => array( + ], + 'Billing' => [ 'billing_first_name' => 'abc1', 'billing_middle_name' => 'J.', 'billing_last_name' => 'xyz1', @@ -77,9 +77,9 @@ function profile_get_expectedresult() { 'billing_postal_code-5' => '90210', 'billing-email-5' => 'abc1.xyz1@yahoo.com', 'email-5' => 'abc1.xyz1@yahoo.com', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Profile/GetFields.php b/api/v3/examples/Profile/GetFields.php index 48b62cee42..588e90a21a 100644 --- a/api/v3/examples/Profile/GetFields.php +++ b/api/v3/examples/Profile/GetFields.php @@ -8,10 +8,10 @@ * API result array */ function profile_getfields_example() { - $params = array( + $params = [ 'action' => 'submit', 'profile_id' => 27, - ); + ]; try{ $result = civicrm_api3('Profile', 'getfields', $params); @@ -21,12 +21,12 @@ function profile_getfields_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,12 +40,12 @@ function profile_getfields_example() { */ function profile_getfields_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 9, - 'values' => array( - 'custom_1' => array( + 'values' => [ + 'custom_1' => [ 'label' => '_addCustomFieldToProfile', 'groupTitle' => '_addCustomFie', 'data_type' => 'String', @@ -74,9 +74,9 @@ function profile_getfields_expectedresult() { 'help_post' => '', 'entity' => 'contact', 'weight' => '1', - 'api.aliases' => array(), - ), - 'postal_code-1' => array( + 'api.aliases' => [], + ], + 'postal_code-1' => [ 'name' => 'postal_code', 'type' => 2, 'title' => 'State Province', @@ -91,18 +91,18 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_address', 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 6, - ), + ], 'api.required' => 0, 'help_pre' => '', 'help_post' => '', 'weight' => '2', - 'api.aliases' => array(), - ), - 'state_province-1' => array( + 'api.aliases' => [], + ], + 'state_province-1' => [ 'name' => 'state_province_id', 'type' => 1, 'title' => 'State Province', @@ -111,24 +111,24 @@ function profile_getfields_expectedresult() { 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', 'FKClassName' => 'CRM_Core_DAO_StateProvince', - 'html' => array( + 'html' => [ 'type' => 'ChainSelect', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_state_province', 'keyColumn' => 'id', 'labelColumn' => 'name', - ), + ], 'FKApiName' => 'StateProvince', 'api.required' => '1', 'help_pre' => '', 'help_post' => '', 'weight' => '3', - 'api.aliases' => array(), - ), - 'country-1' => array( + 'api.aliases' => [], + ], + 'country-1' => [ 'name' => 'country_id', 'type' => 1, 'title' => 'Country', @@ -137,25 +137,25 @@ function profile_getfields_expectedresult() { 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', 'FKClassName' => 'CRM_Core_DAO_Country', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_country', 'keyColumn' => 'id', 'labelColumn' => 'name', 'nameColumn' => 'iso_code', - ), + ], 'FKApiName' => 'Country', 'api.required' => '1', 'help_pre' => '', 'help_post' => '', 'weight' => '4', - 'api.aliases' => array(), - ), - 'phone-1-1' => array( + 'api.aliases' => [], + ], + 'phone-1-1' => [ 'name' => 'phone', 'type' => 2, 'title' => 'Phone', @@ -170,18 +170,18 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_phone', 'entity' => 'phone', 'bao' => 'CRM_Core_BAO_Phone', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 32, 'size' => 20, - ), + ], 'api.required' => '1', 'help_pre' => '', 'help_post' => '', 'weight' => '5', - 'api.aliases' => array(), - ), - 'email-primary' => array( + 'api.aliases' => [], + ], + 'email-primary' => [ 'name' => 'email', 'type' => 2, 'title' => 'Email', @@ -197,20 +197,20 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_email', 'entity' => 'email', 'bao' => 'CRM_Core_BAO_Email', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 254, 'size' => 30, - ), + ], 'api.required' => '1', 'help_pre' => '', 'help_post' => '', 'weight' => '6', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'email-Primary', - ), - ), - 'last_name' => array( + ], + ], + 'last_name' => [ 'name' => 'last_name', 'type' => 2, 'title' => 'Last Name', @@ -225,18 +225,18 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, - ), + ], 'api.required' => '1', 'help_pre' => '', 'help_post' => '', 'weight' => '7', - 'api.aliases' => array(), - ), - 'first_name' => array( + 'api.aliases' => [], + ], + 'first_name' => [ 'name' => 'first_name', 'type' => 2, 'title' => 'First Name', @@ -251,24 +251,24 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'contact', 'bao' => 'CRM_Contact_BAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, - ), + ], 'api.required' => '1', 'help_pre' => '', 'help_post' => '', 'weight' => '8', - 'api.aliases' => array(), - ), - 'profile_id' => array( + 'api.aliases' => [], + ], + 'profile_id' => [ 'api.required' => TRUE, 'title' => 'Profile ID', 'name' => 'profile_id', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Profile/Submit.php b/api/v3/examples/Profile/Submit.php index a8b26e325c..35f3b2f770 100644 --- a/api/v3/examples/Profile/Submit.php +++ b/api/v3/examples/Profile/Submit.php @@ -6,7 +6,7 @@ * API result array */ function profile_submit_example() { - $params = array( + $params = [ 'profile_id' => 29, 'contact_id' => 3, 'first_name' => 'abc2', @@ -15,7 +15,7 @@ function profile_submit_example() { 'phone-1-1' => '022 321 826', 'country-1' => '1013', 'state_province-1' => '1000', - ); + ]; try{ $result = civicrm_api3('Profile', 'submit', $params); @@ -25,12 +25,12 @@ function profile_submit_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function profile_submit_example() { */ function profile_submit_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', @@ -100,9 +100,9 @@ function profile_submit_expectedresult() { 'user_unique_id' => '', 'created_date' => '2013-07-28 08:49:19', 'modified_date' => '2012-11-14 16:02:35', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/BetweenRelationshipType.php b/api/v3/examples/Relationship/BetweenRelationshipType.php index d7dfa39ddd..949b9765b3 100644 --- a/api/v3/examples/Relationship/BetweenRelationshipType.php +++ b/api/v3/examples/Relationship/BetweenRelationshipType.php @@ -8,14 +8,14 @@ * API result array */ function relationship_get_example() { - $params = array( - 'relationship_type_id' => array( - 'BETWEEN' => array( + $params = [ + 'relationship_type_id' => [ + 'BETWEEN' => [ '0' => 36, '1' => 38, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Relationship', 'get', $params); @@ -25,12 +25,12 @@ function relationship_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,12 +44,12 @@ function relationship_get_example() { */ function relationship_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 3, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -58,8 +58,8 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - '3' => array( + ], + '3' => [ 'id' => '3', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -68,8 +68,8 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - '4' => array( + ], + '4' => [ 'id' => '4', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -78,9 +78,9 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/Create.php b/api/v3/examples/Relationship/Create.php index 1978de2bde..7f8db5c433 100644 --- a/api/v3/examples/Relationship/Create.php +++ b/api/v3/examples/Relationship/Create.php @@ -6,7 +6,7 @@ * API result array */ function relationship_create_example() { - $params = array( + $params = [ 'contact_id_a' => 31, 'contact_id_b' => 33, 'relationship_type_id' => 18, @@ -14,7 +14,7 @@ function relationship_create_example() { 'end_date' => '2010-12-30', 'is_active' => 1, 'note' => 'note', - ); + ]; try{ $result = civicrm_api3('Relationship', 'create', $params); @@ -24,12 +24,12 @@ function relationship_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function relationship_create_example() { */ function relationship_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id_a' => '31', 'contact_id_b' => '33', @@ -61,9 +61,9 @@ function relationship_create_expectedresult() { 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, 'case_id' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/Delete.php b/api/v3/examples/Relationship/Delete.php index 74e4ffc302..081973a304 100644 --- a/api/v3/examples/Relationship/Delete.php +++ b/api/v3/examples/Relationship/Delete.php @@ -6,9 +6,9 @@ * API result array */ function relationship_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Relationship', 'delete', $params); @@ -18,12 +18,12 @@ function relationship_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function relationship_delete_example() { */ function relationship_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 'Deleted relationship successfully', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/Get.php b/api/v3/examples/Relationship/Get.php index 9d21e1f781..b533076a16 100644 --- a/api/v3/examples/Relationship/Get.php +++ b/api/v3/examples/Relationship/Get.php @@ -6,9 +6,9 @@ * API result array */ function relationship_get_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('Relationship', 'get', $params); @@ -18,12 +18,12 @@ function relationship_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function relationship_get_example() { */ function relationship_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id_a' => '47', 'contact_id_b' => '49', @@ -54,9 +54,9 @@ function relationship_get_expectedresult() { 'is_permission_b_a' => 0, 'custom_1' => 'custom string', 'custom_1_1' => 'custom string', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/INRelationshipType.php b/api/v3/examples/Relationship/INRelationshipType.php index 3a907c0f1a..4a323b43a3 100644 --- a/api/v3/examples/Relationship/INRelationshipType.php +++ b/api/v3/examples/Relationship/INRelationshipType.php @@ -8,14 +8,14 @@ * API result array */ function relationship_get_example() { - $params = array( - 'relationship_type_id' => array( - 'IN' => array( + $params = [ + 'relationship_type_id' => [ + 'IN' => [ '0' => 36, '1' => 37, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Relationship', 'get', $params); @@ -25,12 +25,12 @@ function relationship_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,12 +44,12 @@ function relationship_get_example() { */ function relationship_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -58,8 +58,8 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - '3' => array( + ], + '3' => [ 'id' => '3', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -68,9 +68,9 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/NotBetweenRelationshipType.php b/api/v3/examples/Relationship/NotBetweenRelationshipType.php index 31a8a73454..06ae19f46a 100644 --- a/api/v3/examples/Relationship/NotBetweenRelationshipType.php +++ b/api/v3/examples/Relationship/NotBetweenRelationshipType.php @@ -8,14 +8,14 @@ * API result array */ function relationship_get_example() { - $params = array( - 'relationship_type_id' => array( - 'NOT BETWEEN' => array( + $params = [ + 'relationship_type_id' => [ + 'NOT BETWEEN' => [ '0' => 36, '1' => 38, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Relationship', 'get', $params); @@ -25,12 +25,12 @@ function relationship_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function relationship_get_example() { */ function relationship_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -59,9 +59,9 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/NotInRelationshipType.php b/api/v3/examples/Relationship/NotInRelationshipType.php index 5e77fe8b30..42cad00cec 100644 --- a/api/v3/examples/Relationship/NotInRelationshipType.php +++ b/api/v3/examples/Relationship/NotInRelationshipType.php @@ -8,14 +8,14 @@ * API result array */ function relationship_get_example() { - $params = array( - 'relationship_type_id' => array( - 'NOT IN' => array( + $params = [ + 'relationship_type_id' => [ + 'NOT IN' => [ '0' => 36, '1' => 37, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Relationship', 'get', $params); @@ -25,12 +25,12 @@ function relationship_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,12 +44,12 @@ function relationship_get_example() { */ function relationship_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -58,8 +58,8 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - '4' => array( + ], + '4' => [ 'id' => '4', 'contact_id_a' => '99', 'contact_id_b' => '101', @@ -68,9 +68,9 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Relationship/filterIsCurrent.php b/api/v3/examples/Relationship/filterIsCurrent.php index c4aee7a37a..a1275167f6 100644 --- a/api/v3/examples/Relationship/filterIsCurrent.php +++ b/api/v3/examples/Relationship/filterIsCurrent.php @@ -8,11 +8,11 @@ * API result array */ function relationship_get_example() { - $params = array( - 'filters' => array( + $params = [ + 'filters' => [ 'is_current' => 1, - ), - ); + ], + ]; try{ $result = civicrm_api3('Relationship', 'get', $params); @@ -22,12 +22,12 @@ function relationship_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function relationship_get_example() { */ function relationship_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id_a' => '95', 'contact_id_b' => '97', @@ -56,9 +56,9 @@ function relationship_get_expectedresult() { 'is_active' => '1', 'is_permission_a_b' => 0, 'is_permission_b_a' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/RelationshipType/Create.php b/api/v3/examples/RelationshipType/Create.php index 42826f114c..d2e71aa285 100644 --- a/api/v3/examples/RelationshipType/Create.php +++ b/api/v3/examples/RelationshipType/Create.php @@ -6,7 +6,7 @@ * API result array */ function relationship_type_create_example() { - $params = array( + $params = [ 'name_a_b' => 'Relation 1 for relationship type create', 'name_b_a' => 'Relation 2 for relationship type create', 'contact_type_a' => 'Individual', @@ -14,7 +14,7 @@ function relationship_type_create_example() { 'is_reserved' => 1, 'is_active' => 1, 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('RelationshipType', 'create', $params); @@ -24,12 +24,12 @@ function relationship_type_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function relationship_type_create_example() { */ function relationship_type_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'name_a_b' => 'Relation 1 for relationship type create', 'label_a_b' => 'Relation 1 for relationship type create', @@ -62,9 +62,9 @@ function relationship_type_create_expectedresult() { 'contact_sub_type_b' => '', 'is_reserved' => '1', 'is_active' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/RelationshipType/Delete.php b/api/v3/examples/RelationshipType/Delete.php index d331378cdc..ec8c1aad7d 100644 --- a/api/v3/examples/RelationshipType/Delete.php +++ b/api/v3/examples/RelationshipType/Delete.php @@ -6,9 +6,9 @@ * API result array */ function relationship_type_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('RelationshipType', 'delete', $params); @@ -18,12 +18,12 @@ function relationship_type_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function relationship_type_delete_example() { */ function relationship_type_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/ReportTemplate/Getrows.php b/api/v3/examples/ReportTemplate/Getrows.php index 25dc1d5fc6..48804cb7a5 100644 --- a/api/v3/examples/ReportTemplate/Getrows.php +++ b/api/v3/examples/ReportTemplate/Getrows.php @@ -8,15 +8,15 @@ * API result array */ function report_template_getrows_example() { - $params = array( + $params = [ 'report_id' => 'contact/summary', - 'options' => array( - 'metadata' => array( + 'options' => [ + 'metadata' => [ '0' => 'labels', '1' => 'title', - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('ReportTemplate', 'getrows', $params); @@ -26,12 +26,12 @@ function report_template_getrows_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,31 +45,31 @@ function report_template_getrows_example() { */ function report_template_getrows_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'civicrm_contact_sort_name' => 'Second Domain', 'civicrm_contact_id' => '2', 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=2', 'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact', - ), - '1' => array( + ], + '1' => [ 'civicrm_contact_sort_name' => 'Unit Test Organization', 'civicrm_contact_id' => '1', 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=1', 'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact', - ), - ), - 'metadata' => array( + ], + ], + 'metadata' => [ 'title' => 'ERROR: Title is not Set', - 'labels' => array( + 'labels' => [ 'civicrm_contact_sort_name' => 'Contact Name', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/ReportTemplate/Getstatistics.php b/api/v3/examples/ReportTemplate/Getstatistics.php index d9c9dc340c..cfb3de5822 100644 --- a/api/v3/examples/ReportTemplate/Getstatistics.php +++ b/api/v3/examples/ReportTemplate/Getstatistics.php @@ -8,9 +8,9 @@ * API result array */ function report_template_getstatistics_example() { - $params = array( + $params = [ 'report_id' => 'contribute/deferredrevenue', - ); + ]; try{ $result = civicrm_api3('ReportTemplate', 'getstatistics', $params); @@ -20,12 +20,12 @@ function report_template_getstatistics_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,12 +39,12 @@ function report_template_getstatistics_example() { */ function report_template_getstatistics_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 0, 'values' => '', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/SavedSearch/Create.php b/api/v3/examples/SavedSearch/Create.php index 31d677d93a..149e9f6b03 100644 --- a/api/v3/examples/SavedSearch/Create.php +++ b/api/v3/examples/SavedSearch/Create.php @@ -6,12 +6,12 @@ * API result array */ function saved_search_create_example() { - $params = array( - 'form_values' => array( + $params = [ + 'form_values' => [ 'relation_type_id' => '6_a_b', 'relation_target_name' => 'Default Organization', - ), - 'api.Group.create' => array( + ], + 'api.Group.create' => [ 'name' => 'my_smartgroup', 'title' => 'my smartgroup', 'description' => 'Volunteers for the default organization', @@ -20,8 +20,8 @@ function saved_search_create_example() { 'visibility' => 'User and User Admin Only', 'is_hidden' => 0, 'is_reserved' => 0, - ), - ); + ], + ]; try{ $result = civicrm_api3('SavedSearch', 'create', $params); @@ -31,12 +31,12 @@ function saved_search_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -50,30 +50,30 @@ function saved_search_create_example() { */ function saved_search_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', - 'form_values' => array( + 'form_values' => [ 'relation_type_id' => '6_a_b', 'relation_target_name' => 'Default Organization', - ), + ], 'mapping_id' => '', 'search_custom_id' => '', 'where_clause' => '', 'select_tables' => '', 'where_tables' => '', - 'api.Group.create' => array( + 'api.Group.create' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'name' => 'my_smartgroup', 'title' => 'my smartgroup', @@ -94,12 +94,12 @@ function saved_search_create_expectedresult() { 'is_reserved' => 0, 'created_id' => '', 'modified_id' => '', - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/SavedSearch/Delete.php b/api/v3/examples/SavedSearch/Delete.php index 3d0052b6b9..e2ed2a0ad2 100644 --- a/api/v3/examples/SavedSearch/Delete.php +++ b/api/v3/examples/SavedSearch/Delete.php @@ -6,9 +6,9 @@ * API result array */ function saved_search_delete_example() { - $params = array( + $params = [ 'id' => 4, - ); + ]; try{ $result = civicrm_api3('SavedSearch', 'delete', $params); @@ -18,12 +18,12 @@ function saved_search_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function saved_search_delete_example() { */ function saved_search_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/SavedSearch/Get.php b/api/v3/examples/SavedSearch/Get.php index 14adb3a11b..cb8f5c3f3e 100644 --- a/api/v3/examples/SavedSearch/Get.php +++ b/api/v3/examples/SavedSearch/Get.php @@ -6,9 +6,9 @@ * API result array */ function saved_search_get_example() { - $params = array( + $params = [ 'id' => 2, - ); + ]; try{ $result = civicrm_api3('SavedSearch', 'get', $params); @@ -18,12 +18,12 @@ function saved_search_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,21 +37,21 @@ function saved_search_get_example() { */ function saved_search_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', - 'form_values' => array( + 'form_values' => [ 'relation_type_id' => '6_a_b', 'relation_target_name' => 'Default Organization', - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/Create.php b/api/v3/examples/Setting/Create.php index 3f92f96137..88a1afc59d 100644 --- a/api/v3/examples/Setting/Create.php +++ b/api/v3/examples/Setting/Create.php @@ -6,10 +6,10 @@ * API result array */ function setting_create_example() { - $params = array( + $params = [ 'domain_id' => 2, 'uniq_email_per_site' => 1, - ); + ]; try{ $result = civicrm_api3('Setting', 'create', $params); @@ -19,12 +19,12 @@ function setting_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,17 +38,17 @@ function setting_create_example() { */ function setting_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'uniq_email_per_site' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/CreateAllDomains.php b/api/v3/examples/Setting/CreateAllDomains.php index 37a4d5efc4..7cfef55b75 100644 --- a/api/v3/examples/Setting/CreateAllDomains.php +++ b/api/v3/examples/Setting/CreateAllDomains.php @@ -8,10 +8,10 @@ * API result array */ function setting_create_example() { - $params = array( + $params = [ 'domain_id' => 'all', 'uniq_email_per_site' => 1, - ); + ]; try{ $result = civicrm_api3('Setting', 'create', $params); @@ -21,12 +21,12 @@ function setting_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,22 +40,22 @@ function setting_create_example() { */ function setting_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 3, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'uniq_email_per_site' => '1', - ), - '2' => array( + ], + '2' => [ 'uniq_email_per_site' => '1', - ), - '3' => array( + ], + '3' => [ 'uniq_email_per_site' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/CreateSettingCurrentDomain.php b/api/v3/examples/Setting/CreateSettingCurrentDomain.php index c0e189dcb2..d600ec4c80 100644 --- a/api/v3/examples/Setting/CreateSettingCurrentDomain.php +++ b/api/v3/examples/Setting/CreateSettingCurrentDomain.php @@ -8,9 +8,9 @@ * API result array */ function setting_create_example() { - $params = array( + $params = [ 'uniq_email_per_site' => 1, - ); + ]; try{ $result = civicrm_api3('Setting', 'create', $params); @@ -20,12 +20,12 @@ function setting_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,17 +39,17 @@ function setting_create_example() { */ function setting_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'uniq_email_per_site' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/CreateSpecifiedDomains.php b/api/v3/examples/Setting/CreateSpecifiedDomains.php index a54f24ab94..c7167e9131 100644 --- a/api/v3/examples/Setting/CreateSpecifiedDomains.php +++ b/api/v3/examples/Setting/CreateSpecifiedDomains.php @@ -8,13 +8,13 @@ * API result array */ function setting_create_example() { - $params = array( - 'domain_id' => array( + $params = [ + 'domain_id' => [ '0' => 1, '1' => 3, - ), + ], 'uniq_email_per_site' => 0, - ); + ]; try{ $result = civicrm_api3('Setting', 'create', $params); @@ -24,12 +24,12 @@ function setting_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,19 +43,19 @@ function setting_create_example() { */ function setting_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'uniq_email_per_site' => 0, - ), - '3' => array( + ], + '3' => [ 'uniq_email_per_site' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/Get.php b/api/v3/examples/Setting/Get.php index 522fb14a8e..74d9c9a03b 100644 --- a/api/v3/examples/Setting/Get.php +++ b/api/v3/examples/Setting/Get.php @@ -6,10 +6,10 @@ * API result array */ function setting_get_example() { - $params = array( + $params = [ 'domain_id' => 2, 'return' => 'uniq_email_per_site', - ); + ]; try{ $result = civicrm_api3('Setting', 'get', $params); @@ -19,12 +19,12 @@ function setting_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,17 +38,17 @@ function setting_get_example() { */ function setting_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'uniq_email_per_site' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/GetAllDomains.php b/api/v3/examples/Setting/GetAllDomains.php index 3a446f13d8..185f51b869 100644 --- a/api/v3/examples/Setting/GetAllDomains.php +++ b/api/v3/examples/Setting/GetAllDomains.php @@ -8,10 +8,10 @@ * API result array */ function setting_get_example() { - $params = array( + $params = [ 'domain_id' => 'all', 'return' => 'uniq_email_per_site', - ); + ]; try{ $result = civicrm_api3('Setting', 'get', $params); @@ -21,12 +21,12 @@ function setting_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,22 +40,22 @@ function setting_get_example() { */ function setting_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 3, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'uniq_email_per_site' => '1', - ), - '2' => array( + ], + '2' => [ 'uniq_email_per_site' => '1', - ), - '3' => array( + ], + '3' => [ 'uniq_email_per_site' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/GetDefaults.php b/api/v3/examples/Setting/GetDefaults.php index 1de4b30912..6b50ddf069 100644 --- a/api/v3/examples/Setting/GetDefaults.php +++ b/api/v3/examples/Setting/GetDefaults.php @@ -8,9 +8,9 @@ * API result array */ function setting_getdefaults_example() { - $params = array( + $params = [ 'name' => 'address_format', - ); + ]; try{ $result = civicrm_api3('Setting', 'getdefaults', $params); @@ -20,12 +20,12 @@ function setting_getdefaults_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function setting_getdefaults_example() { */ function setting_getdefaults_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'address_format' => '{contact.address_name} {contact.street_address} {contact.supplemental_address_1} @@ -53,9 +53,9 @@ function setting_getdefaults_expectedresult() { {contact.supplemental_address_3} {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/GetFields.php b/api/v3/examples/Setting/GetFields.php index 478c1c2c5f..e41b514ec5 100644 --- a/api/v3/examples/Setting/GetFields.php +++ b/api/v3/examples/Setting/GetFields.php @@ -8,7 +8,7 @@ * API result array */ function setting_getfields_example() { - $params = array(); + $params = []; try{ $result = civicrm_api3('Setting', 'getfields', $params); @@ -18,12 +18,12 @@ function setting_getfields_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function setting_getfields_example() { */ function setting_getfields_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 157, - 'values' => array( - 'address_standardization_provider' => array( + 'values' => [ + 'address_standardization_provider' => [ 'group_name' => 'Address Preferences', 'group' => 'address', 'name' => 'address_standardization_provider', @@ -55,8 +55,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => 'CiviCRM includes an optional plugin for interfacing with the United States Postal Services (USPS) Address Standardization web service. You must register to use the USPS service at https://www.usps.com/business/web-tools-apis/address-information.htm. If you are approved, they will provide you with a User ID and the URL for the service. Plugins for other address standardization services may be available from 3rd party developers. If installed, they will be included in the drop-down below. ', - ), - 'address_standardization_userid' => array( + ], + 'address_standardization_userid' => [ 'group_name' => 'Address Preferences', 'group' => 'address', 'name' => 'address_standardization_userid', @@ -69,8 +69,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'address_standardization_url' => array( + ], + 'address_standardization_url' => [ 'group_name' => 'Address Preferences', 'group' => 'address', 'name' => 'address_standardization_url', @@ -84,8 +84,8 @@ function setting_getfields_expectedresult() { 'description' => '', 'help_text' => 'Web Service URL', 'validate_callback' => 'CRM_Utils_Rule::url', - ), - 'hideCountryMailingLabels' => array( + ], + 'hideCountryMailingLabels' => [ 'group_name' => 'Address Preferences', 'group' => 'address', 'name' => 'hideCountryMailingLabels', @@ -98,8 +98,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Do not display the country field in mailing labels when the country is the same as that of the domain', 'help_text' => '', - ), - 'tag_unconfirmed' => array( + ], + 'tag_unconfirmed' => [ 'group_name' => 'Campaign Preferences', 'group' => 'campaign', 'name' => 'tag_unconfirmed', @@ -112,8 +112,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', - ), - 'petition_contacts' => array( + ], + 'petition_contacts' => [ 'group_name' => 'Campaign Preferences', 'group' => 'campaign', 'name' => 'petition_contacts', @@ -126,65 +126,65 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', - ), - 'civicaseRedactActivityEmail' => array( + ], + 'civicaseRedactActivityEmail' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'civicaseRedactActivityEmail', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array(), + 'html_attributes' => [], 'default' => 'default', 'add' => '4.7', 'title' => 'Redact Activity Email', 'is_domain' => 1, 'is_contact' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Case_Info::getRedactOptions', - ), + ], 'description' => 'Should activity emails be redacted? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)', 'help_text' => '', - ), - 'civicaseAllowMultipleClients' => array( + ], + 'civicaseAllowMultipleClients' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'civicaseAllowMultipleClients', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array(), + 'html_attributes' => [], 'default' => 'default', 'add' => '4.7', 'title' => 'Allow Multiple Case Clients', 'is_domain' => 1, 'is_contact' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Case_Info::getMultiClientOptions', - ), + ], 'description' => 'How many clients may be associated with a given case? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)', 'help_text' => '', - ), - 'civicaseNaturalActivityTypeSort' => array( + ], + 'civicaseNaturalActivityTypeSort' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'civicaseNaturalActivityTypeSort', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array(), + 'html_attributes' => [], 'default' => 'default', 'add' => '4.7', 'title' => 'Activity Type Sorting', 'is_domain' => 1, 'is_contact' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Case_Info::getSortOptions', - ), + ], 'description' => 'How to sort activity-types on the \"Manage Case\" screen? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)', 'help_text' => '', - ), - 'cvv_backoffice_required' => array( + ], + 'cvv_backoffice_required' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'cvv_backoffice_required', @@ -197,13 +197,13 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Is the CVV code required for back office credit card transactions', 'help_text' => 'If set it back-office credit card transactions will required a cvv code. Leave as required unless you have a very strong reason to change', - ), - 'contribution_invoice_settings' => array( + ], + 'contribution_invoice_settings' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'contribution_invoice_settings', 'type' => 'Array', - 'default' => array( + 'default' => [ 'invoice_prefix' => 'INV_', 'credit_notes_prefix' => 'CN_', 'due_date' => '10', @@ -211,15 +211,15 @@ function setting_getfields_expectedresult() { 'notes' => '', 'tax_term' => 'Sales Tax', 'tax_display_settings' => 'Inclusive', - ), + ], 'add' => '4.7', 'title' => 'Contribution Invoice Settings', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'invoicing' => array( + ], + 'invoicing' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'invoicing', @@ -233,8 +233,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'acl_financial_type' => array( + ], + 'acl_financial_type' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'acl_financial_type', @@ -248,8 +248,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'deferred_revenue_enabled' => array( + ], + 'deferred_revenue_enabled' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'deferred_revenue_enabled', @@ -263,17 +263,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'default_invoice_page' => array( + ], + 'default_invoice_page' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'default_invoice_page', 'type' => 'Integer', 'quick_form_type' => 'Element', 'default' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'name' => 'contributionPage', - ), + ], 'html_type' => 'select', 'add' => '4.7', 'title' => 'Default invoice payment page', @@ -281,8 +281,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'always_post_to_accounts_receivable' => array( + ], + 'always_post_to_accounts_receivable' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'always_post_to_accounts_receivable', @@ -296,8 +296,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'update_contribution_on_membership_type_change' => array( + ], + 'update_contribution_on_membership_type_change' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'update_contribution_on_membership_type_change', @@ -311,16 +311,16 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Enabling this setting will update related contribution of membership(s) except if the membership is paid for with a recurring contribution.', 'help_text' => '', - ), - 'contact_view_options' => array( + ], + 'contact_view_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_view_options', 'type' => 'String', 'html_type' => 'checkboxes', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'contact_view_options', - ), + ], 'default' => '123456789101113', 'add' => '4.1', 'title' => 'Viewing Contacts', @@ -328,16 +328,16 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'contact_edit_options' => array( + ], + 'contact_edit_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_edit_options', 'type' => 'String', 'html_type' => 'checkboxes', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'contact_edit_options', - ), + ], 'default' => '123456789111214151617', 'add' => '4.1', 'title' => 'Editing Contacts', @@ -345,15 +345,15 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'advanced_search_options' => array( + ], + 'advanced_search_options' => [ 'group_name' => 'CiviCRM Preferences', 'name' => 'advanced_search_options', 'type' => 'String', 'html_type' => 'checkboxes', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'advanced_search_options', - ), + ], 'default' => '123456789101112131516171819', 'add' => '4.1', 'title' => 'Contact Search', @@ -361,16 +361,16 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'user_dashboard_options' => array( + ], + 'user_dashboard_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'user_dashboard_options', 'type' => 'String', 'html_type' => 'checkboxes', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'user_dashboard_options', - ), + ], 'default' => '1234578', 'add' => '4.1', 'title' => 'Contact Dashboard', @@ -378,16 +378,16 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'address_options' => array( + ], + 'address_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'address_options', 'type' => 'String', 'html_type' => 'Text', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'address_options', - ), + ], 'default' => '123456891011', 'add' => '4.1', 'title' => 'Addressing Options', @@ -395,8 +395,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'address_format' => array( + ], + 'address_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'address_format', @@ -415,8 +415,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'mailing_format' => array( + ], + 'mailing_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'mailing_format', @@ -435,8 +435,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'display_name_format' => array( + ], + 'display_name_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'display_name_format', @@ -449,8 +449,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'sort_name_format' => array( + ], + 'sort_name_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'sort_name_format', @@ -463,8 +463,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'remote_profile_submissions' => array( + ], + 'remote_profile_submissions' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'remote_profile_submissions', @@ -478,8 +478,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, CiviCRM will permit submissions from external sites to profiles. This is disabled by default to limit abuse.', 'help_text' => '', - ), - 'allow_alert_autodismissal' => array( + ], + 'allow_alert_autodismissal' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'allow_alert_autodismissal', @@ -493,8 +493,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If disabled, alert messages in CiviCRM will never be automatically dismissed after 10 seconds.', 'help_text' => '', - ), - 'editor_id' => array( + ], + 'editor_id' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'editor_id', @@ -507,8 +507,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'contact_ajax_check_similar' => array( + ], + 'contact_ajax_check_similar' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_ajax_check_similar', @@ -521,8 +521,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'ajaxPopupsEnabled' => array( + ], + 'ajaxPopupsEnabled' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'ajaxPopupsEnabled', @@ -535,8 +535,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'activity_assignee_notification' => array( + ], + 'activity_assignee_notification' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'activity_assignee_notification', @@ -549,8 +549,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'activity_assignee_notification_ics' => array( + ], + 'activity_assignee_notification_ics' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'activity_assignee_notification_ics', @@ -563,16 +563,16 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'contact_autocomplete_options' => array( + ], + 'contact_autocomplete_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_autocomplete_options', 'type' => 'String', 'quick_form_type' => 'CheckBox', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactAutocompleteOptions', - ), + ], 'default' => '12', 'add' => '4.1', 'title' => 'Autocomplete Contact Search', @@ -580,16 +580,16 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Selected fields will be displayed in back-office autocomplete dropdown search results (Quick Search, etc.). Contact Name is always included.', 'help_text' => '', - ), - 'contact_reference_options' => array( + ], + 'contact_reference_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_reference_options', 'type' => 'String', 'quick_form_type' => 'CheckBox', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactReferenceOptions', - ), + ], 'default' => '12', 'add' => '4.1', 'title' => 'Contact Reference Options', @@ -597,8 +597,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Selected fields will be displayed in autocomplete dropdown search results for \'Contact Reference\' custom fields. Contact Name is always included. NOTE: You must assign \'access contact reference fields\' permission to the anonymous role if you want to use custom contact reference fields in profiles on public pages. For most situations, you should use the \'Limit List to Group\' setting when configuring a contact reference field which will be used in public forms to prevent exposing your entire contact list.', 'help_text' => '', - ), - 'contact_smart_group_display' => array( + ], + 'contact_smart_group_display' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_smart_group_display', @@ -611,8 +611,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'smart_group_cache_refresh_mode' => array( + ], + 'smart_group_cache_refresh_mode' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'smart_group_cache_refresh_mode', @@ -623,13 +623,13 @@ function setting_getfields_expectedresult() { 'title' => 'Smart Group Refresh Mode', 'is_domain' => 1, 'is_contact' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Contact_BAO_GroupContactCache::getModes', - ), + ], 'description' => 'Should the smart groups be by cron jobs or user actions', 'help_text' => 'In \"Opportunistic Flush\" mode, caches are flushed in response to user actions; this mode is broadly compatible but may add latency during form-submissions. In \"Cron Flush\" mode, you should schedule a cron job to flush caches; this can improve latency on form-submissions but requires more setup.', - ), - 'installed' => array( + ], + 'installed' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -643,8 +643,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'A flag indicating whether this system has run a post-installation routine', 'help_text' => '', - ), - 'max_attachments' => array( + ], + 'max_attachments' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'max_attachments', @@ -652,10 +652,10 @@ function setting_getfields_expectedresult() { 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, 'maxlength' => 8, - ), + ], 'default' => 3, 'add' => '4.3', 'title' => 'Maximum Attachments', @@ -663,18 +663,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Maximum number of files (documents, images, etc.) which can attached to emails or activities.', 'help_text' => '', - ), - 'maxFileSize' => array( + ], + 'maxFileSize' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'maxFileSize', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, 'maxlength' => 8, - ), + ], 'default' => 3, 'add' => '4.3', 'title' => 'Maximum File Size (in MB)', @@ -682,8 +682,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Maximum Size of file (documents, images, etc.) which can attached to emails or activities.
Note: php.ini should support this file size.', 'help_text' => '', - ), - 'contact_undelete' => array( + ], + 'contact_undelete' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_undelete', @@ -696,8 +696,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, deleted contacts will be moved to trash (instead of being destroyed). Users with the proper permission are able to search for the deleted contacts and restore them (or delete permanently).', 'help_text' => '', - ), - 'allowPermDeleteFinancial' => array( + ], + 'allowPermDeleteFinancial' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'allowPermDeleteFinancial', @@ -710,8 +710,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Allow Permanent Delete for contacts who are linked to live financial transactions', 'help_text' => '', - ), - 'securityAlert' => array( + ], + 'securityAlert' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'securityAlert', @@ -724,8 +724,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, CiviCRM will display pop-up notifications (no more than once per day) for security and misconfiguration issues identified in the system check.', 'help_text' => '', - ), - 'doNotAttachPDFReceipt' => array( + ], + 'doNotAttachPDFReceipt' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'doNotAttachPDFReceipt', @@ -738,17 +738,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, CiviCRM sends PDF receipt as an attachment during event signup or online contribution.', 'help_text' => '', - ), - 'recordGeneratedLetters' => array( + ], + 'recordGeneratedLetters' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'recordGeneratedLetters', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'class' => 'crm-select2', - ), + ], 'default' => 'multiple', 'add' => '4.7', 'title' => 'Record generated letters', @@ -756,20 +756,20 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'When generating a letter (PDF/Word) via mail-merge, how should the letter be recorded?', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Contact_Form_Task_PDFLetterCommon::getLoggingOptions', - ), - ), - 'wkhtmltopdfPath' => array( + ], + ], + 'wkhtmltopdfPath' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'wkhtmltopdfPath', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 256, - ), + ], 'html_type' => 'Text', 'default' => '', 'add' => '4.3', @@ -778,17 +778,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'recaptchaOptions' => array( + ], + 'recaptchaOptions' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'recaptchaOptions', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 64, - ), + ], 'html_type' => 'Text', 'default' => '', 'add' => '4.3', @@ -797,17 +797,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'You can specify the reCAPTCHA theme options as comma separated data.(eg: theme:\'blackglass\', lang : \'fr\' ). Check the available options at Customizing the Look and Feel of reCAPTCHA.', 'help_text' => '', - ), - 'recaptchaPublicKey' => array( + ], + 'recaptchaPublicKey' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'recaptchaPublicKey', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 64, - ), + ], 'html_type' => 'Text', 'default' => '', 'add' => '4.3', @@ -816,17 +816,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'recaptchaPrivateKey' => array( + ], + 'recaptchaPrivateKey' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'recaptchaPrivateKey', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 64, - ), + ], 'html_type' => 'Text', 'default' => '', 'add' => '4.3', @@ -835,17 +835,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'checksum_timeout' => array( + ], + 'checksum_timeout' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'checksum_timeout', 'type' => 'Integer', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, 'maxlength' => 8, - ), + ], 'html_type' => 'Text', 'default' => 7, 'add' => '4.3', @@ -854,17 +854,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'blogUrl' => array( + ], + 'blogUrl' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'blogUrl', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 128, - ), + ], 'html_type' => 'Text', 'default' => '*default*', 'add' => '4.3', @@ -873,17 +873,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Blog feed URL used by the blog dashlet', 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', - ), - 'communityMessagesUrl' => array( + ], + 'communityMessagesUrl' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'communityMessagesUrl', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 128, - ), + ], 'html_type' => 'Text', 'default' => '*default*', 'add' => '4.3', @@ -892,17 +892,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Service providing CiviCRM community messages', 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', - ), - 'gettingStartedUrl' => array( + ], + 'gettingStartedUrl' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'gettingStartedUrl', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 128, - ), + ], 'html_type' => 'Text', 'default' => '*default*', 'add' => '4.3', @@ -911,8 +911,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Service providing the Getting Started data', 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', - ), - 'resCacheCode' => array( + ], + 'resCacheCode' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'resCacheCode', @@ -926,8 +926,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Code appended to resource URLs (JS/CSS) to coerce HTTP caching', 'help_text' => '', - ), - 'verifySSL' => array( + ], + 'verifySSL' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'verifySSL', @@ -940,8 +940,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If disabled, outbound web-service requests will allow unverified, insecure HTTPS connections', 'help_text' => 'Unless you are absolutely unable to configure your server to check the SSL certificate of the remote server you should leave this set to Yes', - ), - 'enableSSL' => array( + ], + 'enableSSL' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'enableSSL', @@ -954,8 +954,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, inbound HTTP requests for sensitive pages will be redirected to HTTPS.', 'help_text' => 'If enabled, inbound HTTP requests for sensitive pages will be redirected to HTTPS.', - ), - 'wpBasePage' => array( + ], + 'wpBasePage' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'wpBasePage', @@ -969,8 +969,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If set, CiviCRM will use this setting as the base url.', 'help_text' => 'By default, CiviCRM will generate front-facing pages using the home page at http://wp/ as its base. If you want to use a different template for CiviCRM pages, set the path here.', - ), - 'secondDegRelPermissions' => array( + ], + 'secondDegRelPermissions' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'secondDegRelPermissions', @@ -983,8 +983,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, contacts with the permission to edit a related contact will inherit that contact\'s permission to edit other related contacts', 'help_text' => '', - ), - 'enable_components' => array( + ], + 'enable_components' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -992,11 +992,11 @@ function setting_getfields_expectedresult() { 'type' => 'Array', 'quick_form_type' => 'Element', 'html_type' => 'advmultiselect', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect', - ), + ], 'default' => '', 'add' => '4.4', 'title' => 'Enable Components', @@ -1004,13 +1004,13 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - 'on_change' => array( + 'on_change' => [ '0' => 'CRM_Case_Info::onToggleComponents', '1' => 'CRM_Core_Component::flushEnabledComponents', '2' => 'call://resources/resetCacheCode', - ), - ), - 'disable_core_css' => array( + ], + ], + 'disable_core_css' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'disable_core_css', @@ -1023,8 +1023,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Prevent the stylesheet \"civicrm.css\" from being loaded.', 'help_text' => '', - ), - 'empoweredBy' => array( + ], + 'empoweredBy' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'empoweredBy', @@ -1037,8 +1037,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'When enabled, \"empowered by CiviCRM\" is displayed at the bottom of public forms.', 'help_text' => '', - ), - 'logging_no_trigger_permission' => array( + ], + 'logging_no_trigger_permission' => [ 'add' => '4.7', 'is_domain' => 1, 'is_contact' => 0, @@ -1052,8 +1052,8 @@ function setting_getfields_expectedresult() { 'default' => 0, 'title' => '(EXPERIMENTAL) MySQL user does not have trigger permissions', 'description' => 'Set this when you intend to manage trigger creation outside of CiviCRM', - ), - 'logging' => array( + ], + 'logging' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1068,11 +1068,11 @@ function setting_getfields_expectedresult() { 'title' => 'Logging', 'description' => 'If enabled, all actions will be logged with a complete record of changes.', 'validate_callback' => 'CRM_Logging_Schema::checkLoggingSupport', - 'on_change' => array( + 'on_change' => [ '0' => 'CRM_Logging_Schema::onToggle', - ), - ), - 'logging_uniqueid_date' => array( + ], + ], + 'logging_uniqueid_date' => [ 'add' => '4.7', 'help_text' => 'This is the date when CRM-18193 was implemented', 'is_domain' => 1, @@ -1086,8 +1086,8 @@ function setting_getfields_expectedresult() { 'default' => '', 'title' => 'Logging Unique ID not recorded before', 'description' => 'This is the date when CRM-18193 was implemented', - ), - 'logging_all_tables_uniquid' => array( + ], + 'logging_all_tables_uniquid' => [ 'add' => '4.7', 'help_text' => 'This indicates there are no tables holdng pre-uniqid log_conn_id values (CRM-18193)', 'is_domain' => 1, @@ -1101,8 +1101,8 @@ function setting_getfields_expectedresult() { 'default' => 0, 'title' => 'All tables use Unique Connection ID', 'description' => 'Do some tables pre-date CRM-18193?', - ), - 'userFrameworkUsersTableName' => array( + ], + 'userFrameworkUsersTableName' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1113,15 +1113,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '32', 'maxlength' => '64', - ), + ], 'default' => '', 'title' => 'CMS Users Table Name', 'description' => '', - ), - 'wpLoadPhp' => array( + ], + 'wpLoadPhp' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'wpLoadPhp', @@ -1135,18 +1135,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'CiviCRM will use this setting as path to bootstrap WP.', 'help_text' => '', - ), - 'secure_cache_timeout_minutes' => array( + ], + 'secure_cache_timeout_minutes' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'secure_cache_timeout_minutes', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, 'maxlength' => 8, - ), + ], 'default' => 20, 'add' => '4.7', 'title' => 'Secure Cache Timeout', @@ -1154,8 +1154,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Maximum number of minutes that secure form data should linger', 'help_text' => '', - ), - 'site_id' => array( + ], + 'site_id' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'site_id', @@ -1169,18 +1169,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'recentItemsMaxCount' => array( + ], + 'recentItemsMaxCount' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'recentItemsMaxCount', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, 'maxlength' => 3, - ), + ], 'default' => 20, 'add' => '4.7', 'title' => 'Size of \"Recent Items\" stack', @@ -1188,18 +1188,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'How many items should CiviCRM store in it\'s \"Recently viewed\" list.', 'help_text' => '', - ), - 'recentItemsProviders' => array( + ], + 'recentItemsProviders' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'recentItemsProviders', 'type' => 'Array', 'html_type' => 'Select', 'quick_form_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'multiple' => 1, 'class' => 'crm-select2', - ), + ], 'default' => '', 'add' => '4.7', 'title' => 'Recent Items Providers', @@ -1207,11 +1207,11 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'What providers may save views in CiviCRM\'s \"Recently viewed\" list. If empty, all are in.', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Utils_Recent::getProviders', - ), - ), - 'dedupe_default_limit' => array( + ], + ], + 'dedupe_default_limit' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'dedupe_default_limit', @@ -1225,8 +1225,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Default to only loading matches against this number of contacts', 'help_text' => 'Deduping larger databases can crash the server. By configuring a limit other than 0 here the dedupe query will only search for matches against a limited number of contacts.', - ), - 'syncCMSEmail' => array( + ], + 'syncCMSEmail' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'syncCMSEmail', @@ -1239,8 +1239,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, then CMS email id will be syncronised with CiviCRM contacts\'s primary email.', 'help_text' => '', - ), - 'preserve_activity_tab_filter' => array( + ], + 'preserve_activity_tab_filter' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'preserve_activity_tab_filter', @@ -1253,15 +1253,15 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts', 'help_text' => '', - ), - 'assetCache' => array( + ], + 'assetCache' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', 'name' => 'assetCache', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array(), + 'html_attributes' => [], 'default' => 'auto', 'add' => '4.7', 'title' => 'Asset Caching', @@ -1269,11 +1269,11 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Store computed JS/CSS content in cache files? (Note: In \"Auto\" mode, the \"Debug\" setting will determine whether to activate the cache.)', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => '\Civi\Core\AssetBuilder::getCacheModes', - ), - ), - 'userFrameworkLogging' => array( + ], + ], + 'userFrameworkLogging' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', 'name' => 'userFrameworkLogging', @@ -1286,8 +1286,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Set this value to Yes if you want CiviCRM error/debugging messages to appear in the Drupal error logs', 'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS\' error log. In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal\'s watchdog enabled)', - ), - 'debug_enabled' => array( + ], + 'debug_enabled' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', 'name' => 'debug_enabled', @@ -1301,8 +1301,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Set this value to Yes if you want to use one of CiviCRM\'s debugging tools. This feature should NOT be enabled for production sites', 'help_text' => 'Do not turn this on on production sites', - ), - 'backtrace' => array( + ], + 'backtrace' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', 'name' => 'backtrace', @@ -1314,8 +1314,8 @@ function setting_getfields_expectedresult() { 'is_domain' => 1, 'is_contact' => 0, 'description' => 'Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites', - ), - 'fatalErrorHandler' => array( + ], + 'fatalErrorHandler' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', 'name' => 'fatalErrorHandler', @@ -1328,8 +1328,8 @@ function setting_getfields_expectedresult() { 'is_domain' => 1, 'is_contact' => 0, 'description' => 'Enter the path and class for a custom PHP error-handling function if you want to override built-in CiviCRM error handling for your site.', - ), - 'uploadDir' => array( + ], + 'uploadDir' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'Directory Preferences', 'group' => 'directory', @@ -1344,8 +1344,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => 'File system path where temporary CiviCRM files - such as import data files - are uploaded.', - ), - 'imageUploadDir' => array( + ], + 'imageUploadDir' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'Directory Preferences', 'group' => 'directory', @@ -1360,8 +1360,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'File system path where image files are uploaded. Currently, this path is used for images associated with premiums (CiviContribute thank-you gifts).', 'help_text' => '', - ), - 'customFileUploadDir' => array( + ], + 'customFileUploadDir' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'Directory Preferences', 'group' => 'directory', @@ -1376,8 +1376,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Path where documents and images which are attachments to contact records are stored (e.g. contact photos, resumes, contracts, etc.). These attachments are defined using \'file\' type custom fields.', 'help_text' => '', - ), - 'customTemplateDir' => array( + ], + 'customTemplateDir' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'Directory Preferences', 'group' => 'directory', @@ -1392,8 +1392,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Path where site specific templates are stored if any. This directory is searched first if set. Custom JavaScript code can be added to templates by creating files named templateFile.extra.tpl. (learn more...)', 'help_text' => '', - ), - 'customPHPPathDir' => array( + ], + 'customPHPPathDir' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'Directory Preferences', 'group' => 'directory', @@ -1408,8 +1408,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Path where site specific PHP code files are stored if any. This directory is searched first if set.', 'help_text' => '', - ), - 'extensionsDir' => array( + ], + 'extensionsDir' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group_name' => 'Directory Preferences', 'group' => 'directory', @@ -1424,8 +1424,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Path where CiviCRM extensions are stored.', 'help_text' => '', - ), - 'enable_cart' => array( + ], + 'enable_cart' => [ 'name' => 'enable_cart', 'group_name' => 'Event Preferences', 'group' => 'event', @@ -1438,8 +1438,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'WRITE ME', 'help_text' => 'WRITE ME', - ), - 'show_events' => array( + ], + 'show_events' => [ 'name' => 'show_events', 'group_name' => 'Event Preferences', 'group' => 'event', @@ -1453,17 +1453,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Configure how many events should be shown on the dashboard. This overrides the default value of 10 entries.', 'help_text' => '', - ), - 'ext_repo_url' => array( + ], + 'ext_repo_url' => [ 'group_name' => 'Extension Preferences', 'group' => 'ext', 'name' => 'ext_repo_url', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 128, - ), + ], 'html_type' => 'Text', 'default' => 'https://civicrm.org/extdir/ver={ver}|cms={uf}', 'add' => '4.3', @@ -1472,8 +1472,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'customTranslateFunction' => array( + ], + 'customTranslateFunction' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1484,24 +1484,24 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '30', 'maxlength' => '100', - ), + ], 'default' => '', 'title' => 'Custom Translate Function', 'description' => '', - ), - 'monetaryThousandSeparator' => array( + ], + 'monetaryThousandSeparator' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'monetaryThousandSeparator', 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, - ), + ], 'default' => ',', 'add' => '4.3', 'title' => 'Thousands Separator', @@ -1509,17 +1509,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'monetaryDecimalPoint' => array( + ], + 'monetaryDecimalPoint' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'monetaryDecimalPoint', 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, - ), + ], 'default' => '.', 'add' => '4.3', 'title' => 'Decimal Delimiter', @@ -1527,8 +1527,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'moneyformat' => array( + ], + 'moneyformat' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'moneyformat', @@ -1542,8 +1542,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'moneyvalueformat' => array( + ], + 'moneyvalueformat' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'moneyvalueformat', @@ -1557,17 +1557,17 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'defaultCurrency' => array( + ], + 'defaultCurrency' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'defaultCurrency', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'class' => 'crm-select2', - ), + ], 'default' => 'USD', 'add' => '4.3', 'title' => 'Default Currency', @@ -1575,21 +1575,21 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Default currency assigned to contributions and other monetary transactions.', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Localization::getCurrencySymbols', - ), - 'on_change' => array( + ], + 'on_change' => [ '0' => 'CRM_Admin_Form_Setting_Localization::onChangeDefaultCurrency', - ), - ), - 'defaultContactCountry' => array( + ], + ], + 'defaultContactCountry' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'defaultContactCountry', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array(), + 'html_attributes' => [], 'default' => '1228', 'add' => '4.4', 'title' => 'Default Country', @@ -1597,11 +1597,11 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'This value is selected by default when adding a new contact address.', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries', - ), - ), - 'defaultContactStateProvince' => array( + ], + ], + 'defaultContactStateProvince' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1615,54 +1615,54 @@ function setting_getfields_expectedresult() { 'default' => '', 'title' => 'Default State/Province', 'description' => 'This value is selected by default when adding a new contact address.', - ), - 'countryLimit' => array( + ], + 'countryLimit' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'countryLimit', 'type' => 'Array', 'quick_form_type' => 'Element', 'html_type' => 'advmultiselect', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect', - ), - 'default' => array(), + ], + 'default' => [], 'add' => '4.3', 'title' => 'Available Countries', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries', - ), - ), - 'provinceLimit' => array( + ], + ], + 'provinceLimit' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'provinceLimit', 'type' => 'Array', 'quick_form_type' => 'Element', 'html_type' => 'advmultiselect', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect', - ), - 'default' => array(), + ], + 'default' => [], 'add' => '4.3', 'title' => 'Available States and Provinces (by Country)', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries', - ), - ), - 'inheritLocale' => array( + ], + ], + 'inheritLocale' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'inheritLocale', @@ -1675,8 +1675,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'dateformatDatetime' => array( + ], + 'dateformatDatetime' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'dateformatDatetime', @@ -1690,8 +1690,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'dateformatFull' => array( + ], + 'dateformatFull' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'dateformatFull', @@ -1705,8 +1705,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'dateformatPartial' => array( + ], + 'dateformatPartial' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'dateformatPartial', @@ -1720,8 +1720,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'dateformatTime' => array( + ], + 'dateformatTime' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1732,15 +1732,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '12', 'maxlength' => '60', - ), + ], 'default' => '%l:%M %P', 'title' => 'Date Format: Time Only', 'description' => '', - ), - 'dateformatYear' => array( + ], + 'dateformatYear' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1751,15 +1751,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '12', 'maxlength' => '60', - ), + ], 'default' => '%Y', 'title' => 'Date Format: Year Only', 'description' => '', - ), - 'dateformatFinancialBatch' => array( + ], + 'dateformatFinancialBatch' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1770,15 +1770,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '12', 'maxlength' => '60', - ), + ], 'default' => '%m/%d/%Y', 'title' => 'Date Format: Financial Batch', 'description' => '', - ), - 'dateformatshortdate' => array( + ], + 'dateformatshortdate' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1789,15 +1789,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '12', 'maxlength' => '60', - ), + ], 'default' => '%m/%d/%Y', 'title' => 'Date Format: Short date Month Day Year', 'description' => '', - ), - 'dateInputFormat' => array( + ], + 'dateInputFormat' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1808,14 +1808,14 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getDatePluginInputFormats', - ), + ], 'default' => 'mm/dd/yy', 'title' => 'Date Input Format', 'description' => '', - ), - 'fieldSeparator' => array( + ], + 'fieldSeparator' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1826,15 +1826,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '2', 'maxlength' => '8', - ), + ], 'default' => ',', 'title' => 'Import / Export Field Separator', 'description' => 'Global CSV separator character. Modify this setting to enable import and export of different kinds of CSV files (for example: \',\' \';\' \':\' \'|\' ).', - ), - 'fiscalYearStart' => array( + ], + 'fiscalYearStart' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1845,24 +1845,24 @@ function setting_getfields_expectedresult() { 'type' => 'Array', 'quick_form_type' => 'MonthDay', 'html_type' => 'MonthDay', - 'default' => array( + 'default' => [ 'M' => 1, 'd' => 1, - ), + ], 'title' => 'Fiscal Year Start', 'description' => '', - ), - 'languageLimit' => array( + ], + 'languageLimit' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'languageLimit', 'type' => 'Array', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'multiple' => 1, 'class' => 'crm-select2', - ), + ], 'default' => '', 'add' => '4.3', 'title' => 'Available Languages (Multi-lingual)', @@ -1870,20 +1870,20 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_I18n::languages', - ), - ), - 'lcMessages' => array( + ], + ], + 'lcMessages' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'lcMessages', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'class' => 'crm-select2', - ), + ], 'default' => 'en_US', 'add' => '4.3', 'title' => 'Default Language', @@ -1891,14 +1891,14 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Localization::getDefaultLocaleOptions', - ), - 'on_change' => array( + ], + 'on_change' => [ '0' => 'CRM_Admin_Form_Setting_Localization::onChangeLcMessages', - ), - ), - 'legacyEncoding' => array( + ], + ], + 'legacyEncoding' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1909,15 +1909,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '12', 'maxlength' => '30', - ), + ], 'default' => 'Windows-1252', 'title' => 'Legacy Encoding', 'description' => 'If import files are NOT encoded as UTF-8, specify an alternate character encoding for these files. The default of Windows-1252 will work for Excel-created .CSV files on many computers.', - ), - 'timeInputFormat' => array( + ], + 'timeInputFormat' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -1928,26 +1928,26 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getTimeFormats', - ), + ], 'default' => '1', 'title' => 'Time Input Format', 'description' => '', - 'on_change' => array( + 'on_change' => [ '0' => 'CRM_Core_BAO_PreferencesDate::onChangeSetting', - ), - ), - 'weekBegins' => array( + ], + ], + 'weekBegins' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'weekBegins', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Utils_Date::getFullWeekdayNames', - ), + ], 'default' => 0, 'add' => '4.7', 'title' => 'Week begins on', @@ -1955,20 +1955,20 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'contact_default_language' => array( + ], + 'contact_default_language' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'contact_default_language', 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'class' => 'crm-select2', - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Localization::getDefaultLanguageOptions', - ), + ], 'default' => '*default*', 'add' => '4.7', 'title' => 'Default Language for contacts', @@ -1976,8 +1976,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Default language (if any) for contact records', 'help_text' => 'If a contact is created with no language this setting will determine the language data (if any) to save.You may or may not wish to make an assumption here about whether it matches the site language', - ), - 'profile_double_optin' => array( + ], + 'profile_double_optin' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'profile_double_optin', @@ -1990,8 +1990,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', - ), - 'track_civimail_replies' => array( + ], + 'track_civimail_replies' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'track_civimail_replies', @@ -2005,8 +2005,8 @@ function setting_getfields_expectedresult() { 'description' => 'If checked, mailings will default to tracking replies using VERP-ed Reply-To. ', 'help_text' => '', 'validate_callback' => 'CRM_Core_BAO_Setting::validateBoolSetting', - ), - 'civimail_workflow' => array( + ], + 'civimail_workflow' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_workflow', @@ -2019,8 +2019,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', - ), - 'civimail_server_wide_lock' => array( + ], + 'civimail_server_wide_lock' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_server_wide_lock', @@ -2033,8 +2033,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'replyTo' => array( + ], + 'replyTo' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'replyTo', @@ -2047,24 +2047,24 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Allow CiviMail users to send mailings with a custom Reply-To header', 'help_text' => '', - ), - 'mailing_backend' => array( + ], + 'mailing_backend' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'mailing_backend', 'type' => 'Array', 'html_type' => 'checkbox', - 'default' => array( + 'default' => [ 'outBound_option' => '3', - ), + ], 'add' => '4.1', 'title' => 'Mailing Backend', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'profile_add_to_group_double_optin' => array( + ], + 'profile_add_to_group_double_optin' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'profile_add_to_group_double_optin', @@ -2077,8 +2077,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', - ), - 'disable_mandatory_tokens_check' => array( + ], + 'disable_mandatory_tokens_check' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'disable_mandatory_tokens_check', @@ -2091,8 +2091,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.', 'help_text' => '', - ), - 'dedupe_email_default' => array( + ], + 'dedupe_email_default' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'dedupe_email_default', @@ -2105,8 +2105,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Set the \"dedupe e-mail\" option when sending a new mailing to \"true\" by default.', 'help_text' => '', - ), - 'hash_mailing_url' => array( + ], + 'hash_mailing_url' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'hash_mailing_url', @@ -2119,8 +2119,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, a randomized hash key will be used to reference the mailing URL in the mailing.viewUrl token, instead of the mailing ID', 'help_text' => '', - ), - 'civimail_multiple_bulk_emails' => array( + ], + 'civimail_multiple_bulk_emails' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_multiple_bulk_emails', @@ -2133,8 +2133,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, CiviMail will deliver a copy of the email to each bulk email listed for the contact.', 'help_text' => '', - ), - 'include_message_id' => array( + ], + 'include_message_id' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'include_message_id', @@ -2147,18 +2147,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'mailerBatchLimit' => array( + ], + 'mailerBatchLimit' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'mailerBatchLimit', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 4, 'maxlength' => 8, - ), + ], 'default' => 0, 'add' => '4.7', 'title' => 'Mailer Batch Limit', @@ -2166,18 +2166,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Throttle email delivery by setting the maximum number of emails sent during each CiviMail run (0 = unlimited).', 'help_text' => '', - ), - 'mailerJobSize' => array( + ], + 'mailerJobSize' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'mailerJobSize', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 4, 'maxlength' => 8, - ), + ], 'default' => 0, 'add' => '4.7', 'title' => 'Mailer Job Size', @@ -2185,18 +2185,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If you want to utilize multi-threading enter the size you want your sub jobs to be split into. Recommended values are between 1,000 and 10,000. Use a lower value if your server has multiple cron jobs running simultaneously, but do not use values smaller than 1,000. Enter \"0\" to disable multi-threading and process mail as one single job - batch limits still apply.', 'help_text' => '', - ), - 'mailerJobsMax' => array( + ], + 'mailerJobsMax' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'mailerJobsMax', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 4, 'maxlength' => 8, - ), + ], 'default' => 0, 'add' => '4.7', 'title' => 'Mailer Cron Job Limit', @@ -2204,18 +2204,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'The maximum number of mailer delivery jobs executing simultaneously (0 = allow as many processes to execute as started by cron)', 'help_text' => '', - ), - 'mailThrottleTime' => array( + ], + 'mailThrottleTime' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'mailThrottleTime', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 4, 'maxlength' => 8, - ), + ], 'default' => 0, 'add' => '4.7', 'title' => 'Mailer Throttle Time', @@ -2223,18 +2223,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'The time to sleep in between each e-mail in micro seconds. Setting this above 0 allows you to control the rate at which e-mail messages are sent to the mail server, avoiding filling up the mail queue very quickly. Set to 0 to disable.', 'help_text' => '', - ), - 'verpSeparator' => array( + ], + 'verpSeparator' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'verpSeparator', 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 4, 'maxlength' => 32, - ), + ], 'default' => '.', 'add' => '4.7', 'title' => 'VERP Separator', @@ -2242,8 +2242,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Separator character used when CiviMail generates VERP (variable envelope return path) Mail-From addresses.', 'help_text' => '', - ), - 'write_activity_record' => array( + ], + 'write_activity_record' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'write_activity_record', @@ -2256,26 +2256,26 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'simple_mail_limit' => array( + ], + 'simple_mail_limit' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'simple_mail_limit', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 4, 'maxlength' => 8, - ), + ], 'default' => 50, 'title' => 'Simple mail limit', 'is_domain' => 1, 'is_contact' => 0, 'description' => 'The number of emails sendable via simple mail. Make sure you understand the implications for your spam reputation and legal requirements for bulk emails before editing. As there is some risk both to your spam reputation and the products if this is misused it is a hidden setting', 'help_text' => 'CiviCRM forces users sending more than this number of mails to use CiviMails. CiviMails have additional precautions: not sending to contacts who do not want bulk mail, adding domain name and opt out links. You should familiarise yourself with the law relevant to you on bulk mailings if changing this setting. For the US https://en.wikipedia.org/wiki/CAN-SPAM_Act_of_2003 is a good place to start.', - ), - 'geoAPIKey' => array( + ], + 'geoAPIKey' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -2286,15 +2286,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '32', 'maxlength' => '64', - ), + ], 'default' => '', 'title' => 'Geo Provider Key', 'description' => 'Enter the API key or Application ID associated with your geocoding provider (not required for Yahoo).', - ), - 'geoProvider' => array( + ], + 'geoProvider' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -2305,17 +2305,17 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'class' => 'crm-select2', - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::geoProvider', - ), + ], 'default' => '', 'title' => 'Geocoding Provider', 'description' => 'This can be the same or different from the mapping provider selected.', - ), - 'mapAPIKey' => array( + ], + 'mapAPIKey' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -2326,15 +2326,15 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => '32', 'maxlength' => '64', - ), + ], 'default' => '', 'title' => 'Map Provider Key', 'description' => 'Enter your API Key or Application ID. An API Key is required for the Google Maps API. Refer to developers.google.com for the latest information.', - ), - 'mapProvider' => array( + ], + 'mapProvider' => [ 'add' => '4.7', 'help_text' => '', 'is_domain' => 1, @@ -2345,34 +2345,34 @@ function setting_getfields_expectedresult() { 'type' => 'String', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'class' => 'crm-select2', - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::mapProvider', - ), + ], 'default' => '', 'title' => 'Mapping Provider', 'description' => 'Choose the mapping provider that has the best coverage for the majority of your contact addresses.', - ), - 'default_renewal_contribution_page' => array( + ], + 'default_renewal_contribution_page' => [ 'group_name' => 'Member Preferences', 'group' => 'member', 'name' => 'default_renewal_contribution_page', 'type' => 'Integer', 'html_type' => 'Select', 'default' => '', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'name' => 'contributionPage', - ), + ], 'add' => '4.1', 'title' => 'Default online membership renewal page', 'is_domain' => 1, 'is_contact' => 0, 'description' => 'If you select a default online contribution page for self-service membership renewals, a \"renew\" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships.', 'help_text' => '', - ), - 'is_enabled' => array( + ], + 'is_enabled' => [ 'group_name' => 'Multi Site Preferences', 'group' => 'multisite', 'name' => 'is_enabled', @@ -2384,8 +2384,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Multisite is enabled', 'help_text' => '', - ), - 'domain_group_id' => array( + ], + 'domain_group_id' => [ 'group_name' => 'Multi Site Preferences', 'group' => 'multisite', 'name' => 'domain_group_id', @@ -2397,8 +2397,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'event_price_set_domain_id' => array( + ], + 'event_price_set_domain_id' => [ 'group_name' => 'Multi Site Preferences', 'group' => 'multisite', 'name' => 'event_price_set_domain_id', @@ -2410,8 +2410,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'uniq_email_per_site' => array( + ], + 'uniq_email_per_site' => [ 'group_name' => 'Multi Site Preferences', 'group' => 'multisite', 'name' => 'uniq_email_per_site', @@ -2423,18 +2423,18 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'search_autocomplete_count' => array( + ], + 'search_autocomplete_count' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'search_autocomplete_count', 'type' => 'Integer', 'quick_form_type' => 'Element', 'html_type' => 'text', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 2, 'maxlength' => 2, - ), + ], 'default' => 10, 'add' => '4.3', 'title' => 'Autocomplete Results', @@ -2442,8 +2442,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'The maximum number of contacts to show at a time when typing in an autocomplete field.', 'help_text' => '', - ), - 'enable_innodb_fts' => array( + ], + 'enable_innodb_fts' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'enable_innodb_fts', @@ -2456,23 +2456,23 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Enable InnoDB full-text search optimizations. (Requires MySQL 5.6+)', 'help_text' => '', - 'on_change' => array( - '0' => array( + 'on_change' => [ + '0' => [ '0' => 'CRM_Core_InnoDBIndexer', '1' => 'onToggleFts', - ), - ), - ), - 'fts_query_mode' => array( + ], + ], + ], + 'fts_query_mode' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'fts_query_mode', 'type' => 'String', 'quick_form_type' => 'Element', - 'html_attributes' => array( + 'html_attributes' => [ 'size' => 64, 'maxlength' => 64, - ), + ], 'html_type' => 'Text', 'default' => 'simple', 'add' => '4.5', @@ -2481,8 +2481,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', - ), - 'includeOrderByClause' => array( + ], + 'includeOrderByClause' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'includeOrderByClause', @@ -2495,8 +2495,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If disabled, the search results will not be ordered. This may improve response time on search results on large datasets', 'help_text' => '', - ), - 'includeWildCardInName' => array( + ], + 'includeWildCardInName' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'includeWildCardInName', @@ -2509,8 +2509,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, wildcards are automatically added to the beginning AND end of the search term when users search for contacts by Name. EXAMPLE: Searching for \'ada\' will return any contact whose name includes those letters - e.g. \'Adams, Janet\', \'Nadal, Jorge\', etc. If disabled, a wildcard is added to the end of the search term only. EXAMPLE: Searching for \'ada\' will return any contact whose last name begins with those letters - e.g. \'Adams, Janet\' but NOT \'Nadal, Jorge\'. Disabling this feature will speed up search significantly for larger databases, but users must manually enter wildcards (\'%\' or \'_\') to the beginning of the search term if they want to find all records which contain those letters. EXAMPLE: \'%ada\' will return \'Nadal, Jorge\'.', 'help_text' => '', - ), - 'includeEmailInName' => array( + ], + 'includeEmailInName' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'includeEmailInName', @@ -2523,8 +2523,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, email addresses are automatically included when users search by Name. Disabling this feature will speed up search significantly for larger databases, but users will need to use the Email search fields (from Advanced Search, Search Builder, or Profiles) to find contacts by email address.', 'help_text' => '', - ), - 'includeNickNameInName' => array( + ], + 'includeNickNameInName' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'includeNickNameInName', @@ -2537,8 +2537,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, nicknames are automatically included when users search by Name.', 'help_text' => '', - ), - 'includeAlphabeticalPager' => array( + ], + 'includeAlphabeticalPager' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'includeAlphabeticalPager', @@ -2551,8 +2551,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If disabled, the alphabetical pager will not be displayed on the search screens. This will improve response time on search results on large datasets.', 'help_text' => '', - ), - 'smartGroupCacheTimeout' => array( + ], + 'smartGroupCacheTimeout' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'smartGroupCacheTimeout', @@ -2566,20 +2566,20 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'The number of minutes to cache smart group contacts. We strongly recommend that this value be greater than zero, since a value of zero means no caching at all. If your contact data changes frequently, you should set this value to at least 5 minutes.', 'help_text' => '', - ), - 'defaultSearchProfileID' => array( + ], + 'defaultSearchProfileID' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'defaultSearchProfileID', 'type' => 'Integer', 'quick_form_type' => 'Select', 'html_type' => 'Select', - 'html_attributes' => array( + 'html_attributes' => [ 'class' => 'crm-select2', - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getAvailableProfiles', - ), + ], 'default' => '', 'add' => '4.6', 'title' => 'Default Contact Search Profile', @@ -2587,8 +2587,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If set, this will be the default profile used for contact search.', 'help_text' => '', - ), - 'searchPrimaryDetailsOnly' => array( + ], + 'searchPrimaryDetailsOnly' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', 'name' => 'searchPrimaryDetailsOnly', @@ -2601,8 +2601,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'If enabled, only primary details (eg contact\'s primary email, phone, etc) will be included in Basic and Advanced Search results. Disabling this feature will allow users to match contacts using any email, phone etc detail.', 'help_text' => '', - ), - 'userFrameworkResourceURL' => array( + ], + 'userFrameworkResourceURL' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group' => 'url', 'group_name' => 'URL Preferences', @@ -2618,8 +2618,8 @@ function setting_getfields_expectedresult() { 'description' => 'Absolute URL of the location where the civicrm module or component has been installed.', 'help_text' => '', 'validate_callback' => 'CRM_Utils_Rule::urlish', - ), - 'imageUploadURL' => array( + ], + 'imageUploadURL' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group' => 'url', 'group_name' => 'URL Preferences', @@ -2635,8 +2635,8 @@ function setting_getfields_expectedresult() { 'description' => 'URL of the location for uploaded image files.', 'help_text' => '', 'validate_callback' => 'CRM_Utils_Rule::urlish', - ), - 'customCSSURL' => array( + ], + 'customCSSURL' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group' => 'url', 'group_name' => 'URL Preferences', @@ -2652,8 +2652,8 @@ function setting_getfields_expectedresult() { 'description' => 'You can modify the look and feel of CiviCRM by adding your own stylesheet. For small to medium sized modifications, use your css file to override some of the styles in civicrm.css. Or if you need to make drastic changes, you can choose to disable civicrm.css completely.', 'help_text' => '', 'validate_callback' => 'CRM_Utils_Rule::urlish', - ), - 'extensionsURL' => array( + ], + 'extensionsURL' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group' => 'url', 'group_name' => 'URL Preferences', @@ -2669,9 +2669,9 @@ function setting_getfields_expectedresult() { 'description' => 'Base URL for extension resources (images, stylesheets, etc). This should match extensionsDir.', 'help_text' => '', 'validate_callback' => 'CRM_Utils_Rule::urlish', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/GetSettingCurrentDomain.php b/api/v3/examples/Setting/GetSettingCurrentDomain.php index 3b46544817..de514afdc2 100644 --- a/api/v3/examples/Setting/GetSettingCurrentDomain.php +++ b/api/v3/examples/Setting/GetSettingCurrentDomain.php @@ -8,9 +8,9 @@ * API result array */ function setting_get_example() { - $params = array( + $params = [ 'return' => 'uniq_email_per_site', - ); + ]; try{ $result = civicrm_api3('Setting', 'get', $params); @@ -20,12 +20,12 @@ function setting_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,17 +39,17 @@ function setting_get_example() { */ function setting_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'uniq_email_per_site' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/GetSpecifiedDomains.php b/api/v3/examples/Setting/GetSpecifiedDomains.php index ef6db54e00..9de1adaef0 100644 --- a/api/v3/examples/Setting/GetSpecifiedDomains.php +++ b/api/v3/examples/Setting/GetSpecifiedDomains.php @@ -8,15 +8,15 @@ * API result array */ function setting_get_example() { - $params = array( - 'domain_id' => array( + $params = [ + 'domain_id' => [ '0' => 1, '1' => 2, - ), - 'return' => array( + ], + 'return' => [ '0' => 'uniq_email_per_site', - ), - ); + ], + ]; try{ $result = civicrm_api3('Setting', 'get', $params); @@ -26,12 +26,12 @@ function setting_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -45,19 +45,19 @@ function setting_get_example() { */ function setting_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 2, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'uniq_email_per_site' => 0, - ), - '2' => array( + ], + '2' => [ 'uniq_email_per_site' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Setting/GetValue.php b/api/v3/examples/Setting/GetValue.php index 10991cc435..a5534bcac9 100644 --- a/api/v3/examples/Setting/GetValue.php +++ b/api/v3/examples/Setting/GetValue.php @@ -8,10 +8,10 @@ * API result array */ function setting_getvalue_example() { - $params = array( + $params = [ 'name' => 'petition_contacts', 'group' => 'Campaign Preferences', - ); + ]; try{ $result = civicrm_api3('Setting', 'getvalue', $params); @@ -21,12 +21,12 @@ function setting_getvalue_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; diff --git a/api/v3/examples/Setting/Revert.php b/api/v3/examples/Setting/Revert.php index 413da3e4ec..de5aa88ffa 100644 --- a/api/v3/examples/Setting/Revert.php +++ b/api/v3/examples/Setting/Revert.php @@ -8,9 +8,9 @@ * API result array */ function setting_revert_example() { - $params = array( + $params = [ 'name' => 'address_format', - ); + ]; try{ $result = civicrm_api3('Setting', 'revert', $params); @@ -20,12 +20,12 @@ function setting_revert_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,18 +39,18 @@ function setting_revert_example() { */ function setting_revert_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 5, 'id' => 1, - 'values' => array( + 'values' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'address_format' => '{contact.address_name} {contact.street_address} {contact.supplemental_address_1} @@ -58,10 +58,10 @@ function setting_revert_expectedresult() { {contact.supplemental_address_3} {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/StateProvince/Create.php b/api/v3/examples/StateProvince/Create.php index d8e8e56d0c..f84cd70bf2 100644 --- a/api/v3/examples/StateProvince/Create.php +++ b/api/v3/examples/StateProvince/Create.php @@ -6,11 +6,11 @@ * API result array */ function state_province_create_example() { - $params = array( + $params = [ 'name' => 'Wessex', 'abbreviation' => 'WEX', 'country_id' => 1226, - ); + ]; try{ $result = civicrm_api3('StateProvince', 'create', $params); @@ -20,12 +20,12 @@ function state_province_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function state_province_create_example() { */ function state_province_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 13947, - 'values' => array( - '13947' => array( + 'values' => [ + '13947' => [ 'id' => '13947', 'name' => 'Wessex', 'abbreviation' => 'WEX', 'country_id' => '1226', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/StateProvince/Delete.php b/api/v3/examples/StateProvince/Delete.php index 6d3d142420..38863c43c8 100644 --- a/api/v3/examples/StateProvince/Delete.php +++ b/api/v3/examples/StateProvince/Delete.php @@ -6,9 +6,9 @@ * API result array */ function state_province_delete_example() { - $params = array( + $params = [ 'id' => 13948, - ); + ]; try{ $result = civicrm_api3('StateProvince', 'delete', $params); @@ -18,12 +18,12 @@ function state_province_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function state_province_delete_example() { */ function state_province_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/StateProvince/Get.php b/api/v3/examples/StateProvince/Get.php index c4f1ace0fb..7cdf17e9ca 100644 --- a/api/v3/examples/StateProvince/Get.php +++ b/api/v3/examples/StateProvince/Get.php @@ -6,9 +6,9 @@ * API result array */ function state_province_get_example() { - $params = array( + $params = [ 'name' => 'Wessex', - ); + ]; try{ $result = civicrm_api3('StateProvince', 'get', $params); @@ -18,12 +18,12 @@ function state_province_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,20 +37,20 @@ function state_province_get_example() { */ function state_province_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 13949, - 'values' => array( - '13949' => array( + 'values' => [ + '13949' => [ 'id' => '13949', 'name' => 'Wessex', 'abbreviation' => 'WEX', 'country_id' => '1226', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/StatusPreference/Create.php b/api/v3/examples/StatusPreference/Create.php index 01ae882c12..d217d25a15 100644 --- a/api/v3/examples/StatusPreference/Create.php +++ b/api/v3/examples/StatusPreference/Create.php @@ -6,13 +6,13 @@ * API result array */ function status_preference_create_example() { - $params = array( + $params = [ 'name' => 'test_check', 'domain_id' => 1, 'hush_until' => '20151212', 'ignore_severity' => 'cRItical', 'check_info' => '', - ); + ]; try{ $result = civicrm_api3('StatusPreference', 'create', $params); @@ -22,12 +22,12 @@ function status_preference_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function status_preference_create_example() { */ function status_preference_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 4, - 'values' => array( - '4' => array( + 'values' => [ + '4' => [ 'id' => '4', 'domain_id' => '1', 'name' => 'test_check', @@ -55,9 +55,9 @@ function status_preference_create_expectedresult() { 'ignore_severity' => '5', 'prefs' => '', 'check_info' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/StatusPreference/Delete.php b/api/v3/examples/StatusPreference/Delete.php index 8c3d75f677..14afaefcda 100644 --- a/api/v3/examples/StatusPreference/Delete.php +++ b/api/v3/examples/StatusPreference/Delete.php @@ -6,9 +6,9 @@ * API result array */ function status_preference_delete_example() { - $params = array( + $params = [ 'id' => 2, - ); + ]; try{ $result = civicrm_api3('StatusPreference', 'delete', $params); @@ -18,12 +18,12 @@ function status_preference_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function status_preference_delete_example() { */ function status_preference_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/StatusPreference/Get.php b/api/v3/examples/StatusPreference/Get.php index b1334a9cae..8393a062f2 100644 --- a/api/v3/examples/StatusPreference/Get.php +++ b/api/v3/examples/StatusPreference/Get.php @@ -6,9 +6,9 @@ * API result array */ function status_preference_get_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('StatusPreference', 'get', $params); @@ -18,12 +18,12 @@ function status_preference_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,21 +37,21 @@ function status_preference_get_example() { */ function status_preference_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 3, - 'values' => array( - '3' => array( + 'values' => [ + '3' => [ 'id' => '3', 'domain_id' => '1', 'name' => 'test_check', 'hush_until' => '2015-12-12', 'ignore_severity' => '4', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Survey/ChainedGetDelete.php b/api/v3/examples/Survey/ChainedGetDelete.php index 860366008b..222a49d251 100644 --- a/api/v3/examples/Survey/ChainedGetDelete.php +++ b/api/v3/examples/Survey/ChainedGetDelete.php @@ -8,10 +8,10 @@ * API result array */ function survey_get_example() { - $params = array( + $params = [ 'title' => 'survey title', 'api.survey.delete' => 1, - ); + ]; try{ $result = civicrm_api3('Survey', 'get', $params); @@ -21,12 +21,12 @@ function survey_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function survey_get_example() { */ function survey_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 4, - 'values' => array( - '4' => array( + 'values' => [ + '4' => [ 'id' => '4', 'title' => 'survey title', 'activity_type_id' => '30', @@ -57,15 +57,15 @@ function survey_get_expectedresult() { 'created_date' => '2013-07-28 08:49:19', 'bypass_confirm' => 0, 'is_share' => '1', - 'api.survey.delete' => array( + 'api.survey.delete' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Survey/Create.php b/api/v3/examples/Survey/Create.php index 09a7387251..e4a4b55394 100644 --- a/api/v3/examples/Survey/Create.php +++ b/api/v3/examples/Survey/Create.php @@ -6,12 +6,12 @@ * API result array */ function survey_create_example() { - $params = array( + $params = [ 'title' => 'survey title', 'activity_type_id' => '30', 'max_number_of_contacts' => 12, 'instructions' => 'Call people, ask for money', - ); + ]; try{ $result = civicrm_api3('Survey', 'create', $params); @@ -21,12 +21,12 @@ function survey_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function survey_create_example() { */ function survey_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'title' => 'survey title', 'campaign_id' => '', @@ -67,9 +67,9 @@ function survey_create_expectedresult() { 'thankyou_title' => '', 'thankyou_text' => '', 'is_share' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Survey/Delete.php b/api/v3/examples/Survey/Delete.php index 2a15ecb7be..acc86f7fa6 100644 --- a/api/v3/examples/Survey/Delete.php +++ b/api/v3/examples/Survey/Delete.php @@ -6,9 +6,9 @@ * API result array */ function survey_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Survey', 'delete', $params); @@ -18,12 +18,12 @@ function survey_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function survey_delete_example() { */ function survey_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Survey/Get.php b/api/v3/examples/Survey/Get.php index f1c14e1b44..ca7cbdd56c 100644 --- a/api/v3/examples/Survey/Get.php +++ b/api/v3/examples/Survey/Get.php @@ -6,12 +6,12 @@ * API result array */ function survey_get_example() { - $params = array( + $params = [ 'title' => 'survey title', 'activity_type_id' => '30', 'max_number_of_contacts' => 12, 'instructions' => 'Call people, ask for money', - ); + ]; try{ $result = civicrm_api3('Survey', 'get', $params); @@ -21,12 +21,12 @@ function survey_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -40,13 +40,13 @@ function survey_get_example() { */ function survey_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'title' => 'survey title', 'activity_type_id' => '30', @@ -57,9 +57,9 @@ function survey_get_expectedresult() { 'created_date' => '2013-07-28 08:49:19', 'bypass_confirm' => 0, 'is_share' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/SurveyRespondant/Get.php b/api/v3/examples/SurveyRespondant/Get.php index 93614aacf4..5fc87be96a 100644 --- a/api/v3/examples/SurveyRespondant/Get.php +++ b/api/v3/examples/SurveyRespondant/Get.php @@ -9,10 +9,10 @@ * API result array */ function survey_respondant_get_example() { - $params = array( + $params = [ 'sequential' => '1', 'survey_id' => 1, - ); + ]; try{ $result = civicrm_api3('SurveyRespondant', 'get', $params); @@ -22,12 +22,12 @@ function survey_respondant_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -41,13 +41,13 @@ function survey_respondant_get_example() { */ function survey_respondant_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), + 'values' => [], 'deprecated' => 'The SurveyRespondant api is not currently supported.', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/System/Flush.php b/api/v3/examples/System/Flush.php index dab2f325a4..e702ee259b 100644 --- a/api/v3/examples/System/Flush.php +++ b/api/v3/examples/System/Flush.php @@ -8,7 +8,7 @@ * API result array */ function system_flush_example() { - $params = array(); + $params = []; try{ $result = civicrm_api3('System', 'flush', $params); @@ -18,12 +18,12 @@ function system_flush_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function system_flush_example() { */ function system_flush_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Tag/Create.php b/api/v3/examples/Tag/Create.php index 3add021f74..fbdc03fb9e 100644 --- a/api/v3/examples/Tag/Create.php +++ b/api/v3/examples/Tag/Create.php @@ -6,10 +6,10 @@ * API result array */ function tag_create_example() { - $params = array( + $params = [ 'name' => 'Super Heros', 'description' => 'Outside undie-wearers', - ); + ]; try{ $result = civicrm_api3('Tag', 'create', $params); @@ -19,12 +19,12 @@ function tag_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function tag_create_example() { */ function tag_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 12, - 'values' => array( - '12' => array( + 'values' => [ + '12' => [ 'id' => '12', 'name' => 'Super Heros', 'description' => 'Outside undie-wearers', @@ -56,9 +56,9 @@ function tag_create_expectedresult() { 'created_id' => '', 'color' => '', 'created_date' => '2013-07-28 08:49:19', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Tag/Delete.php b/api/v3/examples/Tag/Delete.php index 75f072716a..cd6dd09b6a 100644 --- a/api/v3/examples/Tag/Delete.php +++ b/api/v3/examples/Tag/Delete.php @@ -6,9 +6,9 @@ * API result array */ function tag_delete_example() { - $params = array( + $params = [ 'id' => '17', - ); + ]; try{ $result = civicrm_api3('Tag', 'delete', $params); @@ -18,12 +18,12 @@ function tag_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function tag_delete_example() { */ function tag_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Tag/Get.php b/api/v3/examples/Tag/Get.php index a39d5c6a8e..4c4ac2faf0 100644 --- a/api/v3/examples/Tag/Get.php +++ b/api/v3/examples/Tag/Get.php @@ -6,10 +6,10 @@ * API result array */ function tag_get_example() { - $params = array( + $params = [ 'id' => '7', 'name' => 'New Tag3', - ); + ]; try{ $result = civicrm_api3('Tag', 'get', $params); @@ -19,12 +19,12 @@ function tag_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -38,13 +38,13 @@ function tag_get_example() { */ function tag_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 7, - 'values' => array( - '7' => array( + 'values' => [ + '7' => [ 'id' => '7', 'name' => 'New Tag3', 'description' => 'This is description for Our New Tag ', @@ -53,9 +53,9 @@ function tag_get_expectedresult() { 'is_tagset' => 0, 'used_for' => 'civicrm_contact', 'created_date' => '2013-07-28 08:49:19', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Tag/GetFields.php b/api/v3/examples/Tag/GetFields.php index c00491e909..8636fb926d 100644 --- a/api/v3/examples/Tag/GetFields.php +++ b/api/v3/examples/Tag/GetFields.php @@ -8,9 +8,9 @@ * API result array */ function tag_getfields_example() { - $params = array( + $params = [ 'action' => 'create', - ); + ]; try{ $result = civicrm_api3('Tag', 'getfields', $params); @@ -20,12 +20,12 @@ function tag_getfields_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,12 +39,12 @@ function tag_getfields_example() { */ function tag_getfields_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 11, - 'values' => array( - 'id' => array( + 'values' => [ + 'id' => [ 'name' => 'id', 'type' => 1, 'title' => 'Tag ID', @@ -53,11 +53,11 @@ function tag_getfields_expectedresult() { 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'tag', - ), - ), - 'name' => array( + ], + ], + 'name' => [ 'name' => 'name', 'type' => 2, 'title' => 'Tag Name', @@ -69,8 +69,8 @@ function tag_getfields_expectedresult() { 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'api.required' => 1, - ), - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => 2, 'title' => 'Description', @@ -80,8 +80,8 @@ function tag_getfields_expectedresult() { 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - ), - 'parent_id' => array( + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => 1, 'title' => 'Parent Tag', @@ -92,8 +92,8 @@ function tag_getfields_expectedresult() { 'bao' => 'CRM_Core_BAO_Tag', 'FKClassName' => 'CRM_Core_DAO_Tag', 'FKApiName' => 'Tag', - ), - 'is_selectable' => array( + ], + 'is_selectable' => [ 'name' => 'is_selectable', 'type' => 16, 'title' => 'Display Tag?', @@ -102,24 +102,24 @@ function tag_getfields_expectedresult() { 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - ), - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => 16, 'title' => 'Reserved', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - ), - 'is_tagset' => array( + ], + 'is_tagset' => [ 'name' => 'is_tagset', 'type' => 16, 'title' => 'Tagset', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - ), - 'used_for' => array( + ], + 'used_for' => [ 'name' => 'used_for', 'type' => 2, 'title' => 'Used For', @@ -129,18 +129,18 @@ function tag_getfields_expectedresult() { 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - 'html' => array( + 'html' => [ 'type' => 'Select', 'maxlength' => 64, 'size' => 30, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'tag_used_for', 'optionEditPath' => 'civicrm/admin/options/tag_used_for', - ), + ], 'api.default' => 'civicrm_contact', - ), - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => 1, 'title' => 'Tag Created By', @@ -150,8 +150,8 @@ function tag_getfields_expectedresult() { 'bao' => 'CRM_Core_BAO_Tag', 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ), - 'color' => array( + ], + 'color' => [ 'name' => 'color', 'type' => 2, 'title' => 'Color', @@ -162,8 +162,8 @@ function tag_getfields_expectedresult() { 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - ), - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => 12, 'title' => 'Tag Created Date', @@ -171,9 +171,9 @@ function tag_getfields_expectedresult() { 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Tag/GetList.php b/api/v3/examples/Tag/GetList.php index 08db458290..6c5b4b0394 100644 --- a/api/v3/examples/Tag/GetList.php +++ b/api/v3/examples/Tag/GetList.php @@ -8,12 +8,12 @@ * API result array */ function tag_getlist_example() { - $params = array( + $params = [ 'input' => 'New Tag3', - 'extra' => array( + 'extra' => [ '0' => 'used_for', - ), - ); + ], + ]; try{ $result = civicrm_api3('Tag', 'getlist', $params); @@ -23,12 +23,12 @@ function tag_getlist_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -42,26 +42,26 @@ function tag_getlist_example() { */ function tag_getlist_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 0, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '19', 'label' => 'New Tag3', - 'description' => array( + 'description' => [ '0' => 'This is description for Our New Tag ', - ), - 'extra' => array( + ], + 'extra' => [ 'used_for' => 'civicrm_contact', - ), - ), - ), + ], + ], + ], 'page_num' => 1, 'more_results' => '', - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Tag/GetReturnArray.php b/api/v3/examples/Tag/GetReturnArray.php index ae5465dce7..b4c541ce66 100644 --- a/api/v3/examples/Tag/GetReturnArray.php +++ b/api/v3/examples/Tag/GetReturnArray.php @@ -8,13 +8,13 @@ * API result array */ function tag_get_example() { - $params = array( + $params = [ 'id' => '8', 'name' => 'New Tag3', - 'return' => array( + 'return' => [ '0' => 'name', - ), - ); + ], + ]; try{ $result = civicrm_api3('Tag', 'get', $params); @@ -24,12 +24,12 @@ function tag_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,18 +43,18 @@ function tag_get_example() { */ function tag_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 8, - 'values' => array( - '8' => array( + 'values' => [ + '8' => [ 'id' => '8', 'name' => 'New Tag3', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/TaxContributionPage/Create.php b/api/v3/examples/TaxContributionPage/Create.php index e3b7172661..850ab57997 100644 --- a/api/v3/examples/TaxContributionPage/Create.php +++ b/api/v3/examples/TaxContributionPage/Create.php @@ -6,7 +6,7 @@ * API result array */ function tax_contribution_page_create_example() { - $params = array( + $params = [ 'contact_id' => 1, 'receive_date' => '20120511', 'total_amount' => '100', @@ -16,7 +16,7 @@ function tax_contribution_page_create_example() { 'invoice_id' => 67890, 'source' => 'SSF', 'contribution_status_id' => 2, - ); + ]; try{ $result = civicrm_api3('tax_contribution_page', 'create', $params); @@ -26,11 +26,11 @@ function tax_contribution_page_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -44,13 +44,13 @@ function tax_contribution_page_create_example() { */ function tax_contribution_page_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '1', 'financial_type_id' => '11', @@ -80,9 +80,9 @@ function tax_contribution_page_create_expectedresult() { 'creditnote_id' => '', 'tax_amount' => '20', 'contribution_type_id' => '11', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php b/api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php index 749a06df20..e6b6217e9d 100644 --- a/api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php +++ b/api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php @@ -8,7 +8,7 @@ * API result array */ function tax_contribution_page_create_example() { - $params = array( + $params = [ 'contact_id' => 1, 'receive_date' => '20120511', 'total_amount' => '400', @@ -18,27 +18,27 @@ function tax_contribution_page_create_example() { 'source' => 'SSF', 'contribution_status_id' => 1, 'skipLineItem' => 1, - 'api.line_item.create' => array( - '0' => array( - 'price_field_id' => array( + 'api.line_item.create' => [ + '0' => [ + 'price_field_id' => [ '0' => 3, - ), + ], 'qty' => 1, 'line_total' => '100', 'unit_price' => '100', 'financial_type_id' => 7, - ), - '1' => array( - 'price_field_id' => array( + ], + '1' => [ + 'price_field_id' => [ '0' => 3, - ), + ], 'qty' => 1, 'line_total' => '300', 'unit_price' => '300', 'financial_type_id' => 8, - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('tax_contribution_page', 'create', $params); @@ -48,11 +48,11 @@ function tax_contribution_page_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -66,13 +66,13 @@ function tax_contribution_page_create_example() { */ function tax_contribution_page_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '1', 'financial_type_id' => '7', @@ -102,21 +102,21 @@ function tax_contribution_page_create_expectedresult() { 'creditnote_id' => '', 'tax_amount' => '35', 'contribution_type_id' => '7', - 'api.line_item.create' => array( - '0' => array( + 'api.line_item.create' => [ + '0' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'entity_table' => 'civicrm_contribution', 'entity_id' => '1', 'contribution_id' => '1', - 'price_field_id' => array( + 'price_field_id' => [ '0' => '3', - ), + ], 'label' => 'line item', 'qty' => '1', 'unit_price' => '100', @@ -126,23 +126,23 @@ function tax_contribution_page_create_expectedresult() { 'financial_type_id' => '7', 'deductible_amount' => '', 'tax_amount' => '20', - ), - ), - ), - '1' => array( + ], + ], + ], + '1' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '2', 'entity_table' => 'civicrm_contribution', 'entity_id' => '1', 'contribution_id' => '1', - 'price_field_id' => array( + 'price_field_id' => [ '0' => '3', - ), + ], 'label' => 'line item', 'qty' => '1', 'unit_price' => '300', @@ -152,13 +152,13 @@ function tax_contribution_page_create_expectedresult() { 'financial_type_id' => '8', 'deductible_amount' => '', 'tax_amount' => '15', - ), - ), - ), - ), - ), - ), - ); + ], + ], + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/TaxContributionPage/Delete.php b/api/v3/examples/TaxContributionPage/Delete.php index 1047ae0a97..5733ca2c5f 100644 --- a/api/v3/examples/TaxContributionPage/Delete.php +++ b/api/v3/examples/TaxContributionPage/Delete.php @@ -6,9 +6,9 @@ * API result array */ function tax_contribution_page_delete_example() { - $params = array( + $params = [ 'id' => 1, - ); + ]; try{ $result = civicrm_api3('tax_contribution_page', 'delete', $params); @@ -18,11 +18,11 @@ function tax_contribution_page_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -36,15 +36,15 @@ function tax_contribution_page_delete_example() { */ function tax_contribution_page_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( + 'values' => [ '1' => 1, - ), - ); + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFField/Create.php b/api/v3/examples/UFField/Create.php index 6710ce7375..7dfa389705 100644 --- a/api/v3/examples/UFField/Create.php +++ b/api/v3/examples/UFField/Create.php @@ -6,7 +6,7 @@ * API result array */ function uf_field_create_example() { - $params = array( + $params = [ 'field_name' => 'phone', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -17,7 +17,7 @@ function uf_field_create_example() { 'location_type_id' => 1, 'phone_type_id' => 1, 'uf_group_id' => 11, - ); + ]; try{ $result = civicrm_api3('UFField', 'create', $params); @@ -27,12 +27,12 @@ function uf_field_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -46,13 +46,13 @@ function uf_field_create_example() { */ function uf_field_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'uf_group_id' => '11', 'field_name' => 'phone', @@ -72,9 +72,9 @@ function uf_field_create_expectedresult() { 'field_type' => 'Contact', 'is_reserved' => '', 'is_multi_summary' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFField/Delete.php b/api/v3/examples/UFField/Delete.php index 996cb148ee..c84edce6b0 100644 --- a/api/v3/examples/UFField/Delete.php +++ b/api/v3/examples/UFField/Delete.php @@ -6,9 +6,9 @@ * API result array */ function uf_field_delete_example() { - $params = array( + $params = [ 'field_id' => 1, - ); + ]; try{ $result = civicrm_api3('UFField', 'delete', $params); @@ -18,12 +18,12 @@ function uf_field_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function uf_field_delete_example() { */ function uf_field_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => TRUE, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/UFField/Get.php b/api/v3/examples/UFField/Get.php index c6c1a6b2df..91bfa7db7c 100644 --- a/api/v3/examples/UFField/Get.php +++ b/api/v3/examples/UFField/Get.php @@ -6,7 +6,7 @@ * API result array */ function uf_field_get_example() { - $params = array(); + $params = []; try{ $result = civicrm_api3('UFField', 'get', $params); @@ -16,12 +16,12 @@ function uf_field_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -35,13 +35,13 @@ function uf_field_get_example() { */ function uf_field_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'uf_group_id' => '11', 'field_name' => 'phone', @@ -57,9 +57,9 @@ function uf_field_get_expectedresult() { 'label' => 'Test Phone', 'field_type' => 'Contact', 'is_multi_summary' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFField/Replace.php b/api/v3/examples/UFField/Replace.php index 992d678986..dd32472a61 100644 --- a/api/v3/examples/UFField/Replace.php +++ b/api/v3/examples/UFField/Replace.php @@ -6,11 +6,11 @@ * API result array */ function uf_field_replace_example() { - $params = array( + $params = [ 'uf_group_id' => 11, 'option.autoweight' => '', - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'field_name' => 'first_name', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -18,8 +18,8 @@ function uf_field_replace_example() { 'label' => 'Test First Name', 'is_searchable' => 1, 'is_active' => 1, - ), - '1' => array( + ], + '1' => [ 'field_name' => 'country', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -28,8 +28,8 @@ function uf_field_replace_example() { 'is_searchable' => 1, 'is_active' => 1, 'location_type_id' => 1, - ), - '2' => array( + ], + '2' => [ 'field_name' => 'phone', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -39,10 +39,10 @@ function uf_field_replace_example() { 'is_active' => 1, 'location_type_id' => 1, 'phone_type_id' => 1, - ), - ), + ], + ], 'check_permissions' => TRUE, - ); + ]; try{ $result = civicrm_api3('UFField', 'replace', $params); @@ -52,12 +52,12 @@ function uf_field_replace_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -71,12 +71,12 @@ function uf_field_replace_example() { */ function uf_field_replace_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 3, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'uf_group_id' => '11', 'field_name' => 'first_name', @@ -96,8 +96,8 @@ function uf_field_replace_expectedresult() { 'field_type' => 'Contact', 'is_reserved' => '', 'is_multi_summary' => '', - ), - '2' => array( + ], + '2' => [ 'id' => '2', 'uf_group_id' => '11', 'field_name' => 'country', @@ -117,8 +117,8 @@ function uf_field_replace_expectedresult() { 'field_type' => 'Contact', 'is_reserved' => '', 'is_multi_summary' => '', - ), - '3' => array( + ], + '3' => [ 'id' => '3', 'uf_group_id' => '11', 'field_name' => 'phone', @@ -138,9 +138,9 @@ function uf_field_replace_expectedresult() { 'field_type' => 'Contact', 'is_reserved' => '', 'is_multi_summary' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFGroup/Create.php b/api/v3/examples/UFGroup/Create.php index ade13f1fbe..b514ca44c4 100644 --- a/api/v3/examples/UFGroup/Create.php +++ b/api/v3/examples/UFGroup/Create.php @@ -6,7 +6,7 @@ * API result array */ function uf_group_create_example() { - $params = array( + $params = [ 'add_captcha' => 1, 'add_contact_to_group' => 1, 'group' => 1, @@ -27,7 +27,7 @@ function uf_group_create_example() { 'notify' => 'admin@example.org', 'post_URL' => 'http://example.org/post', 'title' => 'Test Group', - ); + ]; try{ $result = civicrm_api3('UFGroup', 'create', $params); @@ -37,12 +37,12 @@ function uf_group_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -56,13 +56,13 @@ function uf_group_create_example() { */ function uf_group_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'is_active' => 0, 'group_type' => 'Individual,Contact', @@ -86,9 +86,9 @@ function uf_group_create_expectedresult() { 'created_id' => '1', 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFGroup/Delete.php b/api/v3/examples/UFGroup/Delete.php index 68855a931e..58ee2e9cdb 100644 --- a/api/v3/examples/UFGroup/Delete.php +++ b/api/v3/examples/UFGroup/Delete.php @@ -6,9 +6,9 @@ * API result array */ function uf_group_delete_example() { - $params = array( + $params = [ 'id' => 2, - ); + ]; try{ $result = civicrm_api3('UFGroup', 'delete', $params); @@ -18,12 +18,12 @@ function uf_group_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function uf_group_delete_example() { */ function uf_group_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/UFGroup/Get.php b/api/v3/examples/UFGroup/Get.php index 1ce438b38b..2843f27ca2 100644 --- a/api/v3/examples/UFGroup/Get.php +++ b/api/v3/examples/UFGroup/Get.php @@ -6,9 +6,9 @@ * API result array */ function uf_group_get_example() { - $params = array( + $params = [ 'id' => 2, - ); + ]; try{ $result = civicrm_api3('UFGroup', 'get', $params); @@ -18,12 +18,12 @@ function uf_group_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,13 +37,13 @@ function uf_group_get_example() { */ function uf_group_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'is_active' => 0, 'group_type' => 'Individual,Contact', @@ -66,9 +66,9 @@ function uf_group_get_expectedresult() { 'created_id' => '1', 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => 0, - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFJoin/Create.php b/api/v3/examples/UFJoin/Create.php index 45eb69fec1..386b09b76c 100644 --- a/api/v3/examples/UFJoin/Create.php +++ b/api/v3/examples/UFJoin/Create.php @@ -6,7 +6,7 @@ * API result array */ function uf_join_create_example() { - $params = array( + $params = [ 'module' => 'CiviCampaign', 'entity_table' => 'civicrm_survey', 'entity_id' => 1, @@ -14,7 +14,7 @@ function uf_join_create_example() { 'uf_group_id' => 11, 'is_active' => 1, 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('UFJoin', 'create', $params); @@ -24,12 +24,12 @@ function uf_join_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,13 +43,13 @@ function uf_join_create_example() { */ function uf_join_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 0, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'is_active' => '1', 'module' => 'CiviCampaign', @@ -58,9 +58,9 @@ function uf_join_create_expectedresult() { 'weight' => '1', 'uf_group_id' => '11', 'module_data' => '', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFJoin/Get.php b/api/v3/examples/UFJoin/Get.php index 6f38609a02..129626b354 100644 --- a/api/v3/examples/UFJoin/Get.php +++ b/api/v3/examples/UFJoin/Get.php @@ -6,11 +6,11 @@ * API result array */ function uf_join_get_example() { - $params = array( + $params = [ 'entity_table' => 'civicrm_contribution_page', 'entity_id' => 1, 'sequential' => 1, - ); + ]; try{ $result = civicrm_api3('UFJoin', 'get', $params); @@ -20,12 +20,12 @@ function uf_join_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,13 +39,13 @@ function uf_join_get_example() { */ function uf_join_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '0' => array( + 'values' => [ + '0' => [ 'id' => '1', 'is_active' => '1', 'module' => 'CiviContribute', @@ -53,9 +53,9 @@ function uf_join_get_expectedresult() { 'entity_id' => '1', 'weight' => '1', 'uf_group_id' => '11', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/UFMatch/Get.php b/api/v3/examples/UFMatch/Get.php index dddd476237..1c77731cb6 100644 --- a/api/v3/examples/UFMatch/Get.php +++ b/api/v3/examples/UFMatch/Get.php @@ -6,9 +6,9 @@ * API result array */ function uf_match_get_example() { - $params = array( + $params = [ 'contact_id' => 69, - ); + ]; try{ $result = civicrm_api3('UFMatch', 'get', $params); @@ -18,12 +18,12 @@ function uf_match_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,20 +37,20 @@ function uf_match_get_example() { */ function uf_match_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'domain_id' => '1', 'uf_id' => '42', 'contact_id' => '69', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Website/Create.php b/api/v3/examples/Website/Create.php index 1e1d4e10fa..ca680c7339 100644 --- a/api/v3/examples/Website/Create.php +++ b/api/v3/examples/Website/Create.php @@ -6,11 +6,11 @@ * API result array */ function website_create_example() { - $params = array( + $params = [ 'contact_id' => 3, 'url' => 'website.com', 'website_type_id' => 1, - ); + ]; try{ $result = civicrm_api3('Website', 'create', $params); @@ -20,12 +20,12 @@ function website_create_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function website_create_example() { */ function website_create_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, - 'values' => array( - '1' => array( + 'values' => [ + '1' => [ 'id' => '1', 'contact_id' => '3', 'url' => 'website.com', 'website_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Website/Delete.php b/api/v3/examples/Website/Delete.php index e40f33ac4b..2b99ad2c6b 100644 --- a/api/v3/examples/Website/Delete.php +++ b/api/v3/examples/Website/Delete.php @@ -6,9 +6,9 @@ * API result array */ function website_delete_example() { - $params = array( + $params = [ 'id' => 3, - ); + ]; try{ $result = civicrm_api3('Website', 'delete', $params); @@ -18,12 +18,12 @@ function website_delete_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function website_delete_example() { */ function website_delete_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'values' => 1, - ); + ]; return $expectedResult; } diff --git a/api/v3/examples/Website/Get.php b/api/v3/examples/Website/Get.php index 7547491227..c4a8ee27ab 100644 --- a/api/v3/examples/Website/Get.php +++ b/api/v3/examples/Website/Get.php @@ -6,11 +6,11 @@ * API result array */ function website_get_example() { - $params = array( + $params = [ 'contact_id' => 4, 'url' => 'website.com', 'website_type_id' => 1, - ); + ]; try{ $result = civicrm_api3('Website', 'get', $params); @@ -20,12 +20,12 @@ function website_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -39,20 +39,20 @@ function website_get_example() { */ function website_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 2, - 'values' => array( - '2' => array( + 'values' => [ + '2' => [ 'id' => '2', 'contact_id' => '4', 'url' => 'website.com', 'website_type_id' => '1', - ), - ), - ); + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Website/GetFields.php b/api/v3/examples/Website/GetFields.php index 1f163d8dc5..32abee5b59 100644 --- a/api/v3/examples/Website/GetFields.php +++ b/api/v3/examples/Website/GetFields.php @@ -6,9 +6,9 @@ * API result array */ function website_getfields_example() { - $params = array( + $params = [ 'action' => 'get', - ); + ]; try{ $result = civicrm_api3('Website', 'getfields', $params); @@ -18,12 +18,12 @@ function website_getfields_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -37,12 +37,12 @@ function website_getfields_example() { */ function website_getfields_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 4, - 'values' => array( - 'id' => array( + 'values' => [ + 'id' => [ 'name' => 'id', 'type' => 1, 'title' => 'Website ID', @@ -51,11 +51,11 @@ function website_getfields_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'website_id', - ), - ), - 'contact_id' => array( + ], + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => 1, 'title' => 'Contact', @@ -65,8 +65,8 @@ function website_getfields_expectedresult() { 'bao' => 'CRM_Core_BAO_Website', 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ), - 'url' => array( + ], + 'url' => [ 'name' => 'url', 'type' => 2, 'title' => 'Website', @@ -81,13 +81,13 @@ function website_getfields_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, - ), - ), - 'website_type_id' => array( + ], + ], + 'website_type_id' => [ 'name' => 'website_type_id', 'type' => 1, 'title' => 'Website Type', @@ -95,18 +95,18 @@ function website_getfields_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', - ), - ), - ), - ); + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/examples/Website/GetWithMetadata.php b/api/v3/examples/Website/GetWithMetadata.php index 24c4467ddd..b77fac5a8b 100644 --- a/api/v3/examples/Website/GetWithMetadata.php +++ b/api/v3/examples/Website/GetWithMetadata.php @@ -8,13 +8,13 @@ * API result array */ function website_get_example() { - $params = array( - 'options' => array( - 'metadata' => array( + $params = [ + 'options' => [ + 'metadata' => [ '0' => 'fields', - ), - ), - ); + ], + ], + ]; try{ $result = civicrm_api3('Website', 'get', $params); @@ -24,12 +24,12 @@ function website_get_example() { $errorMessage = $e->getMessage(); $errorCode = $e->getErrorCode(); $errorData = $e->getExtraParams(); - return array( + return [ 'is_error' => 1, 'error_message' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData, - ); + ]; } return $result; @@ -43,14 +43,14 @@ function website_get_example() { */ function website_get_expectedresult() { - $expectedResult = array( + $expectedResult = [ 'is_error' => 0, 'version' => 3, 'count' => 0, - 'values' => array(), - 'metadata' => array( - 'fields' => array( - 'id' => array( + 'values' => [], + 'metadata' => [ + 'fields' => [ + 'id' => [ 'name' => 'id', 'type' => '1', 'title' => 'Website ID', @@ -59,11 +59,11 @@ function website_get_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', - 'api.aliases' => array( + 'api.aliases' => [ '0' => 'website_id', - ), - ), - 'contact_id' => array( + ], + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => '1', 'title' => 'Contact', @@ -73,8 +73,8 @@ function website_get_expectedresult() { 'bao' => 'CRM_Core_BAO_Website', 'FKClassName' => 'CRM_Contact_DAO_Contact', 'FKApiName' => 'Contact', - ), - 'url' => array( + ], + 'url' => [ 'name' => 'url', 'type' => '2', 'title' => 'Website', @@ -89,13 +89,13 @@ function website_get_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', - 'html' => array( + 'html' => [ 'type' => 'Text', 'maxlength' => '128', 'size' => '30', - ), - ), - 'website_type_id' => array( + ], + ], + 'website_type_id' => [ 'name' => 'website_type_id', 'type' => '1', 'title' => 'Website Type', @@ -103,19 +103,19 @@ function website_get_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', - 'html' => array( + 'html' => [ 'type' => 'Select', 'size' => '6', 'maxlength' => '14', - ), - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', - ), - ), - ), - ), - ); + ], + ], + ], + ], + ]; return $expectedResult; } diff --git a/api/v3/utils.php b/api/v3/utils.php index 52ffaedd01..b13b31aa9d 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -50,8 +50,8 @@ function _civicrm_api3_initialize() { * @param array $keyoptions * List of required fields options. One of the options is required. */ -function civicrm_api3_verify_one_mandatory($params, $daoName = NULL, $keyoptions = array()) { - $keys = array(array()); +function civicrm_api3_verify_one_mandatory($params, $daoName = NULL, $keyoptions = []) { + $keys = [[]]; foreach ($keyoptions as $key) { $keys[0][] = $key; } @@ -71,11 +71,11 @@ function civicrm_api3_verify_one_mandatory($params, $daoName = NULL, $keyoptions * * @throws \API_Exception */ -function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array(), $verifyDAO = TRUE) { - $unmatched = array(); +function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = [], $verifyDAO = TRUE) { + $unmatched = []; if (!empty($params['id'])) { - $keys = array('version'); + $keys = ['version']; } else { if (!in_array('version', $keys)) { @@ -86,7 +86,7 @@ function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array() foreach ($keys as $key) { if (is_array($key)) { $match = 0; - $optionset = array(); + $optionset = []; foreach ($key as $subkey) { if (!array_key_exists($subkey, $params) || empty($params[$subkey])) { $optionset[] = $subkey; @@ -109,7 +109,7 @@ function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array() } } if (!empty($unmatched)) { - throw new API_Exception("Mandatory key(s) missing from params array: " . implode(", ", $unmatched), "mandatory_missing", array("fields" => $unmatched)); + throw new API_Exception("Mandatory key(s) missing from params array: " . implode(", ", $unmatched), "mandatory_missing", ["fields" => $unmatched]); } } @@ -121,7 +121,7 @@ function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array() * * @return array */ -function civicrm_api3_create_error($msg, $data = array()) { +function civicrm_api3_create_error($msg, $data = []) { $data['is_error'] = 1; $data['error_message'] = $msg; @@ -157,8 +157,8 @@ function civicrm_api3_create_error($msg, $data = array()) { * * @return array */ -function civicrm_api3_create_success($values = 1, $params = array(), $entity = NULL, $action = NULL, &$dao = NULL, $extraReturnValues = array()) { - $result = array(); +function civicrm_api3_create_success($values = 1, $params = [], $entity = NULL, $action = NULL, &$dao = NULL, $extraReturnValues = []) { + $result = []; $lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity); // TODO: This shouldn't be necessary but this fn sometimes gets called with lowercase entity $entity = _civicrm_api_get_camel_name($entity); @@ -182,21 +182,21 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N if (is_array($params) && !empty($params['debug'])) { if (is_string($action) && $action != 'getfields') { - $apiFields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => $action) + $params); + $apiFields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => $action] + $params); } elseif ($action != 'getfields') { - $apiFields = civicrm_api($entity, 'getfields', array('version' => 3) + $params); + $apiFields = civicrm_api($entity, 'getfields', ['version' => 3] + $params); } else { $apiFields = FALSE; } - $allFields = array(); + $allFields = []; if ($action != 'getfields' && is_array($apiFields) && is_array(CRM_Utils_Array::value('values', $apiFields))) { $allFields = array_keys($apiFields['values']); } $paramFields = array_keys($params); - $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), array( + $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), [ 'action', 'entity', 'debug', @@ -213,7 +213,7 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N 'option_sort', 'options', 'prettyprint', - )); + ]); if ($undefined) { $result['undefined_fields'] = array_merge($undefined); } @@ -250,9 +250,9 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N if (!empty($params['options']['metadata'])) { // We've made metadata an array but only supporting 'fields' atm. if (in_array('fields', (array) $params['options']['metadata']) && $action !== 'getfields') { - $fields = civicrm_api3($entity, 'getfields', array( + $fields = civicrm_api3($entity, 'getfields', [ 'action' => substr($action, 0, 3) == 'get' ? 'get' : 'create', - )); + ]); $result['metadata']['fields'] = $fields['values']; } } @@ -260,11 +260,11 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N $deprecated = _civicrm_api3_deprecation_check($entity, $result); // Always report "setvalue" action as deprecated. if (!is_string($deprecated) && ($action == 'getactions' || $action == 'setvalue')) { - $deprecated = ((array) $deprecated) + array('setvalue' => 'The "setvalue" action is deprecated. Use "create" with an id instead.'); + $deprecated = ((array) $deprecated) + ['setvalue' => 'The "setvalue" action is deprecated. Use "create" with an id instead.']; } // Always report "update" action as deprecated. if (!is_string($deprecated) && ($action == 'getactions' || $action == 'update')) { - $deprecated = ((array) $deprecated) + array('update' => 'The "update" action is deprecated. Use "create" with an id instead.'); + $deprecated = ((array) $deprecated) + ['update' => 'The "update" action is deprecated. Use "create" with an id instead.']; } if ($deprecated) { // Metadata-level deprecations or wholesale entity deprecations. @@ -428,7 +428,7 @@ function _civicrm_api3_separate_values(&$values) { * @param array $values */ function _civicrm_api3_filter_fields_for_bao($entity, &$params, &$values) { - $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'create')); + $fields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => 'create']); $fields = $fields['values']; _civicrm_api3_store_values($fields, $params, $values); } @@ -462,7 +462,7 @@ function _civicrm_api3_store_values(&$fields, &$params, &$values) { * @return array */ function _civicrm_api3_field_names($fields) { - $result = array(); + $result = []; foreach ($fields as $key => $value) { if (!empty($value['name'])) { $result[] = $value['name']; @@ -500,7 +500,7 @@ function _civicrm_api3_field_names($fields) { * @return array * @throws API_Exception */ -function _civicrm_api3_get_using_query_object($entity, $params, $additional_options = array(), $getCount = NULL, $mode = 1, $defaultReturnProperties = NULL) { +function _civicrm_api3_get_using_query_object($entity, $params, $additional_options = [], $getCount = NULL, $mode = 1, $defaultReturnProperties = NULL) { $lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity); // Convert id to e.g. contact_id if (empty($params[$lowercase_entity . '_id']) && isset($params['id'])) { @@ -511,22 +511,22 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti $options = _civicrm_api3_get_options_from_params($params, TRUE); $inputParams = array_merge( - CRM_Utils_Array::value('input_params', $options, array()), - CRM_Utils_Array::value('input_params', $additional_options, array()) + CRM_Utils_Array::value('input_params', $options, []), + CRM_Utils_Array::value('input_params', $additional_options, []) ); $returnProperties = array_merge( - CRM_Utils_Array::value('return', $options, array()), - CRM_Utils_Array::value('return', $additional_options, array()) + CRM_Utils_Array::value('return', $options, []), + CRM_Utils_Array::value('return', $additional_options, []) ); if (empty($returnProperties)) { $returnProperties = $defaultReturnProperties; } if (!empty($params['check_permissions'])) { // we will filter query object against getfields - $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'get')); + $fields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => 'get']); // we need to add this in as earlier in this function 'id' was unset in favour of $entity_id - $fields['values'][$lowercase_entity . '_id'] = array(); - $varsToFilter = array('returnProperties', 'inputParams'); + $fields['values'][$lowercase_entity . '_id'] = []; + $varsToFilter = ['returnProperties', 'inputParams']; foreach ($varsToFilter as $varToFilter) { if (!is_array($$varToFilter)) { continue; @@ -593,7 +593,7 @@ function _civicrm_api3_get_query_object($params, $mode, $entity) { $sort = CRM_Utils_Array::value('sort', $options, NULL); $offset = CRM_Utils_Array::value('offset', $options); $rowCount = CRM_Utils_Array::value('limit', $options); - $inputParams = CRM_Utils_Array::value('input_params', $options, array()); + $inputParams = CRM_Utils_Array::value('input_params', $options, []); $returnProperties = CRM_Utils_Array::value('return', $options, NULL); if (empty($returnProperties)) { $returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties($mode); @@ -617,7 +617,7 @@ function _civicrm_api3_get_query_object($params, $mode, $entity) { $sql .= " LIMIT $offset, $rowCount "; } $dao = CRM_Core_DAO::executeQuery($sql); - return array($dao, $query); + return [$dao, $query]; } /** @@ -635,7 +635,7 @@ function _civicrm_api3_get_query_object($params, $mode, $entity) { * @throws API_Exception * @throws Exception */ -function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $extraSql = array()) { +function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $extraSql = []) { $entity = _civicrm_api_get_entity_name_from_dao($dao); $lowercase_entity = _civicrm_api_get_entity_name_from_camel($entity); if (!empty($params[$lowercase_entity . "_id"]) && empty($params['id'])) { @@ -666,7 +666,7 @@ function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $extraSql } } if (!$fields) { - $fields = array(); + $fields = []; } foreach ($fields as $field) { @@ -797,7 +797,7 @@ function _civicrm_api3_get_options_from_params(&$params, $queryObject = FALSE, $ $sort = CRM_Utils_Array::value('sort', $params['options'], $sort); } - $returnProperties = array(); + $returnProperties = []; // handle the format return =sort_name,display_name... if (array_key_exists('return', $params)) { if (is_array($params['return'])) { @@ -815,14 +815,14 @@ function _civicrm_api3_get_options_from_params(&$params, $queryObject = FALSE, $ } } - $options = array( + $options = [ 'offset' => CRM_Utils_Rule::integer($offset) ? $offset : NULL, 'limit' => (!$is_count && CRM_Utils_Rule::integer($limit)) ? $limit : NULL, 'is_count' => $is_count, - 'return' => !empty($returnProperties) ? $returnProperties : array(), - ); + 'return' => !empty($returnProperties) ? $returnProperties : [], + ]; - $finalSort = array(); + $finalSort = []; $options['sort'] = NULL; if (!empty($sort)) { if (!is_array($sort)) { @@ -856,12 +856,12 @@ function _civicrm_api3_get_options_from_params(&$params, $queryObject = FALSE, $ } //here comes the legacy support for $returnProperties, $inputParams e.g for contat_get // if the query object is being used this should be used - $inputParams = array(); - $legacyreturnProperties = array(); - $otherVars = array( + $inputParams = []; + $legacyreturnProperties = []; + $otherVars = [ 'sort', 'offset', 'rowCount', 'options', 'return', 'version', 'prettyprint', 'check_permissions', 'sequential', - ); + ]; foreach ($params as $n => $v) { if (substr($n, 0, 7) == 'return.') { $legacyreturnProperties[substr($n, 7)] = $v; @@ -969,15 +969,15 @@ function _civicrm_api3_get_unique_name_array(&$bao) { * @return array */ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "", $autoFind = TRUE) { - $result = array(); + $result = []; if (isset($params['options']) && !empty($params['options']['is_count'])) { return $dao->count(); } if (empty($dao)) { - return array(); + return []; } if ($autoFind && !$dao->find()) { - return array(); + return []; } if (isset($dao->count)) { @@ -986,7 +986,7 @@ function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $fields = array_keys(_civicrm_api3_build_fields_array($dao, FALSE)); while ($dao->fetch()) { - $tmp = array(); + $tmp = []; foreach ($fields as $key) { if (array_key_exists($key, $dao)) { // not sure on that one @@ -1072,14 +1072,14 @@ function _civicrm_api3_object_to_array_unique_fields(&$dao, &$values) { * ID of entity per $extends. */ function _civicrm_api3_custom_format_params($params, &$values, $extends, $entityId = NULL) { - $values['custom'] = array(); + $values['custom'] = []; $checkCheckBoxField = FALSE; $entity = $extends; - if (in_array($extends, array('Household', 'Individual', 'Organization'))) { + if (in_array($extends, ['Household', 'Individual', 'Organization'])) { $entity = 'Contact'; } - $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'create')); + $fields = civicrm_api($entity, 'getfields', ['version' => 3, 'action' => 'create']); if (!$fields['is_error']) { // not sure if fields could be error - maybe change to using civicrm_api3 wrapper later - this is conservative $fields = $fields['values']; @@ -1107,13 +1107,13 @@ function _civicrm_api3_custom_format_params($params, &$values, $extends, $entity * @param $entity */ function _civicrm_api3_format_params_for_create(&$params, $entity) { - $nonGenericEntities = array('Contact', 'Individual', 'Household', 'Organization'); + $nonGenericEntities = ['Contact', 'Individual', 'Household', 'Organization']; $customFieldEntities = array_diff_key(CRM_Core_SelectValues::customGroupExtends(), array_fill_keys($nonGenericEntities, 1)); if (!array_key_exists($entity, $customFieldEntities)) { return; } - $values = array(); + $values = []; _civicrm_api3_custom_format_params($params, $values, $entity); $params = array_merge($params, $values); } @@ -1149,7 +1149,7 @@ function formatCheckBoxField(&$checkboxFieldValue, $customFieldLabel, $entity) { // We can assume it's pre-formatted. return; } - $options = civicrm_api($entity, 'getoptions', array('field' => $customFieldLabel, 'version' => 3)); + $options = civicrm_api($entity, 'getoptions', ['field' => $customFieldLabel, 'version' => 3]); if (!empty($options['is_error'])) { // The check is precautionary - can probably be removed later. return; @@ -1239,7 +1239,7 @@ function _civicrm_api3_basic_get($bao_name, $params, $returnAsSuccess = TRUE, $e $query = new \Civi\API\Api3SelectQuery($entity, CRM_Utils_Array::value('check_permissions', $params, FALSE)); $query->where = $params; if ($options['is_count']) { - $query->select = array('count_rows'); + $query->select = ['count_rows']; } else { $query->select = array_keys(array_filter($options['return'])); @@ -1276,19 +1276,19 @@ function _civicrm_api3_basic_create($bao_name, &$params, $entity = NULL) { _civicrm_api3_format_params_for_create($params, $entity); $args = array(&$params); if ($entity) { - $ids = array($entity => CRM_Utils_Array::value('id', $params)); + $ids = [$entity => CRM_Utils_Array::value('id', $params)]; $args[] = &$ids; } if (method_exists($bao_name, 'create')) { $fct = 'create'; $fct_name = $bao_name . '::' . $fct; - $bao = call_user_func_array(array($bao_name, $fct), $args); + $bao = call_user_func_array([$bao_name, $fct], $args); } elseif (method_exists($bao_name, 'add')) { $fct = 'add'; $fct_name = $bao_name . '::' . $fct; - $bao = call_user_func_array(array($bao_name, $fct), $args); + $bao = call_user_func_array([$bao_name, $fct], $args); } else { $fct_name = '_civicrm_api3_basic_create_fallback'; @@ -1314,7 +1314,7 @@ function _civicrm_api3_basic_create($bao_name, &$params, $entity = NULL) { if (isset($params['custom']) && empty(CRM_Core_BAO_CustomQuery::$extendsMap[$entity])) { CRM_Core_BAO_CustomValueTable::store($params['custom'], CRM_Core_DAO_AllCoreTables::getTableForClass(CRM_Core_DAO_AllCoreTables::getFullName($entity)), $bao->id); } - $values = array(); + $values = []; _civicrm_api3_object_to_array($bao, $values[$bao->id]); return civicrm_api3_create_success($values, $params, $entity, 'create', $bao); } @@ -1341,9 +1341,9 @@ function _civicrm_api3_basic_create_fallback($bao_name, &$params) { } $entityName = CRM_Core_DAO_AllCoreTables::getBriefName($dao_name); if (empty($entityName)) { - throw new API_Exception("Class \"$bao_name\" does not map to an entity name", "unmapped_class_to_entity", array( + throw new API_Exception("Class \"$bao_name\" does not map to an entity name", "unmapped_class_to_entity", [ 'class_name' => $bao_name, - )); + ]); } $hook = empty($params['id']) ? 'create' : 'edit'; @@ -1370,14 +1370,14 @@ function _civicrm_api3_basic_create_fallback($bao_name, &$params) { * @throws \Civi\API\Exception\UnauthorizedException */ function _civicrm_api3_basic_delete($bao_name, &$params) { - civicrm_api3_verify_mandatory($params, NULL, array('id')); - _civicrm_api3_check_edit_permissions($bao_name, array('id' => $params['id'])); + civicrm_api3_verify_mandatory($params, NULL, ['id']); + _civicrm_api3_check_edit_permissions($bao_name, ['id' => $params['id']]); $args = array(&$params['id']); if (method_exists($bao_name, 'del')) { $dao = new $bao_name(); $dao->id = $params['id']; if ($dao->find()) { - $bao = call_user_func_array(array($bao_name, 'del'), $args); + $bao = call_user_func_array([$bao_name, 'del'], $args); if ($bao !== FALSE) { return civicrm_api3_create_success(); } @@ -1435,9 +1435,9 @@ function _civicrm_api3_custom_data_get(&$returnArray, $checkPermission, $entity, $checkPermission ); $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1); - $customValues = array(); + $customValues = []; CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $customValues); - $fieldInfo = array(); + $fieldInfo = []; foreach ($groupTree as $set) { $fieldInfo += $set['fields']; } @@ -1468,22 +1468,22 @@ function _civicrm_api3_custom_data_get(&$returnArray, $checkPermission, $entity, * @return array $errors */ function _civicrm_api3_validate($entity, $action, $params) { - $errors = array(); - $fields = civicrm_api3($entity, 'getfields', array('sequential' => 1, 'api_action' => $action)); + $errors = []; + $fields = civicrm_api3($entity, 'getfields', ['sequential' => 1, 'api_action' => $action]); $fields = $fields['values']; // Check for required fields. foreach ($fields as $values) { if (!empty($values['api.required']) && empty($params[$values['name']])) { - $errors[$values['name']] = array( + $errors[$values['name']] = [ 'message' => "Mandatory key(s) missing from params array: " . $values['name'], 'code' => "mandatory_missing", - ); + ]; } } // Select only the fields which have been input as a param. - $finalfields = array(); + $finalfields = []; foreach ($fields as $values) { if (array_key_exists($values['name'], $params)) { $finalfields[] = $values; @@ -1499,14 +1499,14 @@ function _civicrm_api3_validate($entity, $action, $params) { _civicrm_api3_validate_switch_cases($fieldName, $fieldInfo, $entity, $params); } catch (Exception $e) { - $errors[$fieldName] = array( + $errors[$fieldName] = [ 'message' => $e->getMessage(), 'code' => 'incorrect_value', - ); + ]; } } - return array($errors); + return [$errors]; } /** @@ -1766,10 +1766,10 @@ function _civicrm_api3_validate_unique_key(&$params, &$fieldName) { if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) { return; } - $existing = civicrm_api($params['entity'], 'get', array( + $existing = civicrm_api($params['entity'], 'get', [ 'version' => $params['version'], $fieldName => $fieldValue, - )); + ]); // an entry already exists for this unique field if ($existing['count'] == 1) { // question - could this ever be a security issue? @@ -1814,7 +1814,7 @@ function _civicrm_api3_generic_replace($entity, $params) { } // Save the new/updated records - $creates = array(); + $creates = []; foreach ($params['values'] as $replacement) { // Sugar: Don't force clients to duplicate the 'key' data $replacement = array_merge($baseParams, $replacement); @@ -1835,10 +1835,10 @@ function _civicrm_api3_generic_replace($entity, $params) { array_keys($creates) ); foreach ($staleIDs as $staleID) { - $delete = civicrm_api($entity, 'delete', array( + $delete = civicrm_api($entity, 'delete', [ 'version' => $params['version'], 'id' => $staleID, - )); + ]); if (civicrm_error($delete)) { $transaction->rollback(); return $delete; @@ -1883,17 +1883,17 @@ function _civicrm_api3_generic_replace_base_params($params) { * * @return array */ -function _civicrm_api_get_fields($entity, $unique = FALSE, &$params = array()) { - $unsetIfEmpty = array( +function _civicrm_api_get_fields($entity, $unique = FALSE, &$params = []) { + $unsetIfEmpty = [ 'dataPattern', 'headerPattern', 'default', 'export', 'import', - ); + ]; $dao = _civicrm_api3_get_DAO($entity); if (empty($dao)) { - return array(); + return []; } $d = new $dao(); $fields = $d->fields(); @@ -1969,7 +1969,7 @@ function _civicrm_api_get_custom_fields($entity, &$params) { FALSE ); - $ret = array(); + $ret = []; foreach ($customfields as $key => $value) { // Regular fields have a 'name' property @@ -2058,7 +2058,7 @@ function _civicrm_api3_validate_integer(&$params, $fieldName, &$fieldInfo, $enti if (!is_numeric($fieldValue) && is_scalar($fieldValue)) { $realContactId = _civicrm_api3_resolve_contactID($fieldValue); if ('unknown-user' === $realContactId) { - throw new API_Exception("\"$fieldName\" \"{$fieldValue}\" cannot be resolved to a contact ID", 2002, array('error_field' => $fieldName, "type" => "integer")); + throw new API_Exception("\"$fieldName\" \"{$fieldValue}\" cannot be resolved to a contact ID", 2002, ['error_field' => $fieldName, "type" => "integer"]); } elseif (is_numeric($realContactId)) { $fieldValue = $realContactId; @@ -2069,7 +2069,7 @@ function _civicrm_api3_validate_integer(&$params, $fieldName, &$fieldInfo, $enti } } if (!empty($fieldInfo['pseudoconstant']) || !empty($fieldInfo['options'])) { - $additional_lookup_params = array(); + $additional_lookup_params = []; if (strtolower($entity) == 'address' && $fieldName == 'state_province_id' && !empty($params['country_id'])) { $additional_lookup_params = ['country_id' => $params['country_id']]; } @@ -2079,7 +2079,7 @@ function _civicrm_api3_validate_integer(&$params, $fieldName, &$fieldInfo, $enti // After swapping options, ensure we have an integer(s) foreach ((array) ($fieldValue) as $value) { if ($value && !is_numeric($value) && $value !== 'null' && $value !== NULL && !is_array($value)) { - throw new API_Exception("$fieldName is not a valid integer", 2001, array('error_field' => $fieldName, "type" => "integer")); + throw new API_Exception("$fieldName is not a valid integer", 2001, ['error_field' => $fieldName, "type" => "integer"]); } } @@ -2087,7 +2087,7 @@ function _civicrm_api3_validate_integer(&$params, $fieldName, &$fieldInfo, $enti if (is_string($fieldValue) && !empty($fieldInfo['maxlength']) && strlen($fieldValue) > $fieldInfo['maxlength'] ) { throw new API_Exception($fieldValue . " is " . strlen($fieldValue) . " characters - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters', - 2100, array('field' => $fieldName, "max_length" => $fieldInfo['maxlength']) + 2100, ['field' => $fieldName, "max_length" => $fieldInfo['maxlength']] ); } } @@ -2147,7 +2147,7 @@ function _civicrm_api3_validate_html(&$params, &$fieldName, $fieldInfo) { } if ($fieldValue) { if (!CRM_Utils_Rule::xssString($fieldValue)) { - throw new API_Exception('Input contains illegal SCRIPT tag.', array("field" => $fieldName, "error_code" => "xss")); + throw new API_Exception('Input contains illegal SCRIPT tag.', ["field" => $fieldName, "error_code" => "xss"]); } } } @@ -2197,7 +2197,7 @@ function _civicrm_api3_validate_string(&$params, &$fieldName, &$fieldInfo, $enti // Check our field length elseif (is_string($fieldValue) && !empty($fieldInfo['maxlength']) && strlen(utf8_decode($fieldValue)) > $fieldInfo['maxlength']) { throw new API_Exception("Value for $fieldName is " . strlen(utf8_decode($value)) . " characters - This field has a maxlength of {$fieldInfo['maxlength']} characters.", - 2100, array('field' => $fieldName) + 2100, ['field' => $fieldName] ); } @@ -2221,8 +2221,8 @@ function _civicrm_api3_validate_string(&$params, &$fieldName, &$fieldInfo, $enti * * @throws \API_Exception */ -function _civicrm_api3_api_match_pseudoconstant(&$fieldValue, $entity, $fieldName, $fieldInfo, $op = '=', $additional_lookup_params = array()) { - if (in_array($op, array('>', '<', '>=', '<=', 'LIKE', 'NOT LIKE'))) { +function _civicrm_api3_api_match_pseudoconstant(&$fieldValue, $entity, $fieldName, $fieldInfo, $op = '=', $additional_lookup_params = []) { + if (in_array($op, ['>', '<', '>=', '<=', 'LIKE', 'NOT LIKE'])) { return; } @@ -2243,7 +2243,7 @@ function _civicrm_api3_api_match_pseudoconstant(&$fieldValue, $entity, $fieldNam } $options = civicrm_api($entity, 'getoptions', $options_lookup_params); - $options = CRM_Utils_Array::value('values', $options, array()); + $options = CRM_Utils_Array::value('values', $options, []); } // If passed a value-separated string, explode to an array, then re-implode after matching values. @@ -2307,7 +2307,7 @@ function _civicrm_api3_api_match_pseudoconstant_value(&$value, $options, $fieldN // CiviMagic syntax for Nulling out the field - let it through. return; } - throw new API_Exception("'$value' is not a valid option for field $fieldName", 2001, array('error_field' => $fieldName)); + throw new API_Exception("'$value' is not a valid option for field $fieldName", 2001, ['error_field' => $fieldName]); } $value = $newValue; } @@ -2335,10 +2335,10 @@ function _civicrm_api3_api_resolve_alias($entity, $fieldName, $action = 'create' if ($fieldName == _civicrm_api_get_entity_name_from_camel($entity) . '_id') { return 'id'; } - $result = civicrm_api($entity, 'getfields', array( + $result = civicrm_api($entity, 'getfields', [ 'version' => 3, 'action' => $action, - )); + ]); $meta = $result['values']; if (!isset($meta[$fieldName]['name']) && isset($meta[$fieldName . '_id'])) { $fieldName = $fieldName . '_id'; @@ -2350,7 +2350,7 @@ function _civicrm_api3_api_resolve_alias($entity, $fieldName, $action = 'create' if ($fieldName == $info['name'] || $fieldName == CRM_Utils_Array::value('uniqueName', $info)) { return $info['name']; } - if (array_search($fieldName, CRM_Utils_Array::value('api.aliases', $info, array())) !== FALSE) { + if (array_search($fieldName, CRM_Utils_Array::value('api.aliases', $info, [])) !== FALSE) { return $info['name']; } } @@ -2369,7 +2369,7 @@ function _civicrm_api3_api_resolve_alias($entity, $fieldName, $action = 'create' * * @return string|array|null */ -function _civicrm_api3_deprecation_check($entity, $result = array()) { +function _civicrm_api3_deprecation_check($entity, $result = []) { if ($entity) { $apiFile = "api/v3/$entity.php"; if (CRM_Utils_File::isIncludable($apiFile)) { @@ -2406,7 +2406,7 @@ function _civicrm_api3_field_value_check(&$params, $fieldName, $type = NULL) { $op = key($fieldValue); $fieldValue = CRM_Utils_Array::value($op, $fieldValue); } - return array($fieldValue, $op); + return [$fieldValue, $op]; } /** @@ -2433,7 +2433,7 @@ function _civicrm_api3_basic_array_get($entity, $params, $records, $idCol, $filt $offset = CRM_Utils_Array::value('offset', $options); $limit = CRM_Utils_Array::value('limit', $options); - $matches = array(); + $matches = []; $currentOffset = 0; foreach ($records as $record) { @@ -2461,7 +2461,7 @@ function _civicrm_api3_basic_array_get($entity, $params, $records, $idCol, $filt } } - $return = CRM_Utils_Array::value('return', $options, array()); + $return = CRM_Utils_Array::value('return', $options, []); if (!empty($return)) { $return['id'] = 1; $matches = CRM_Utils_Array::filterColumns($matches, array_keys($return)); @@ -2479,14 +2479,14 @@ function _civicrm_api3_check_edit_permissions($bao_name, $params) { // For lack of something more clever, here's a whitelist of entities whos permissions // are inherited from a contact record. // Note, when adding here, also remember to modify _civicrm_api3_permissions() - $contactEntities = array( + $contactEntities = [ 'CRM_Core_BAO_Email', 'CRM_Core_BAO_Phone', 'CRM_Core_BAO_Address', 'CRM_Core_BAO_IM', 'CRM_Core_BAO_Website', 'CRM_Core_BAO_OpenID', - ); + ]; if (!empty($params['check_permissions']) && in_array($bao_name, $contactEntities)) { $cid = !empty($params['contact_id']) ? $params['contact_id'] : CRM_Core_DAO::getFieldValue($bao_name, $params['id'], 'contact_id'); if (!CRM_Contact_BAO_Contact_Permission::allow($cid, CRM_Core_Permission::EDIT)) { @@ -2503,7 +2503,7 @@ function _civicrm_api3_check_edit_permissions($bao_name, $params) { * @return bool */ function _civicrm_api3_compare_timestamps($modifiedDate, $id, $entity) { - $currentDbInfo = civicrm_api3($entity, 'getsingle', array('id' => $id)); + $currentDbInfo = civicrm_api3($entity, 'getsingle', ['id' => $id]); if (strtotime($currentDbInfo['modified_date']) <= strtotime($modifiedDate)) { return TRUE; } -- 2.25.1