X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FAPI%2FSubscriber%2FChainSubscriber.php;h=84b55753a0e9f7c23b4b352d06b3381f5173e27d;hb=9dd7b2c930c8110b6bb44e14d232e43954f23d8a;hp=06a2e27140688eb3d4691ee35de9f8838158b93a;hpb=b48045a740f9b4b47c9f320616baf8ea1f3e2c04;p=civicrm-core.git diff --git a/Civi/API/Subscriber/ChainSubscriber.php b/Civi/API/Subscriber/ChainSubscriber.php index 06a2e27140..84b55753a0 100644 --- a/Civi/API/Subscriber/ChainSubscriber.php +++ b/Civi/API/Subscriber/ChainSubscriber.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -50,13 +50,14 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * eg Amy's contact_id). */ class ChainSubscriber implements EventSubscriberInterface { + /** * @return array */ public static function getSubscribedEvents() { - return array( - Events::RESPOND => array('onApiRespond', Events::W_EARLY), - ); + return [ + Events::RESPOND => ['onApiRespond', Events::W_EARLY], + ]; } /** @@ -93,7 +94,7 @@ class ChainSubscriber implements EventSubscriberInterface { // We don't need to worry about nested api in the getfields/getoptions // actions, so just return immediately. - if (in_array($action, array('getfields', 'getfield', 'getoptions'))) { + if (in_array($action, ['getfields', 'getfield', 'getoptions'])) { return; } @@ -102,7 +103,7 @@ class ChainSubscriber implements EventSubscriberInterface { // $result to be a recursive array // $result['values'][0] = $result; $oldResult = $result; - $result = array('values' => array(0 => $oldResult)); + $result = ['values' => [0 => $oldResult]]; } foreach ($params as $field => $newparams) { if ((is_array($newparams) || $newparams === 1) && $field <> 'api.has_parent' && substr($field, 0, 3) == 'api') { @@ -110,7 +111,7 @@ class ChainSubscriber implements EventSubscriberInterface { // 'api.participant.delete' => 1 is a valid options - handle 1 // instead of an array if ($newparams === 1) { - $newparams = array('version' => $version); + $newparams = ['version' => $version]; } // can be api_ or api. $separator = $field[3]; @@ -120,18 +121,18 @@ class ChainSubscriber implements EventSubscriberInterface { $subAPI = explode($separator, $field); $subaction = empty($subAPI[2]) ? $action : $subAPI[2]; - $subParams = array( + $subParams = [ 'debug' => \CRM_Utils_Array::value('debug', $params), - ); + ]; $subEntity = _civicrm_api_get_entity_name_from_camel($subAPI[1]); // Hard coded list of entitys that have fields starting api_ and shouldn't be automatically // deemed to be chained API calls - $skipList = array( - 'SmsProvider' => array('type', 'url', 'params'), - 'Job' => array('prefix', 'entity', 'action'), - 'Contact' => array('key'), - ); + $skipList = [ + 'SmsProvider' => ['type', 'url', 'params'], + 'Job' => ['prefix', 'entity', 'action'], + 'Contact' => ['key'], + ]; if (isset($skipList[$entity]) && in_array($subEntity, $skipList[$entity])) { continue; }