+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2020 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
*/
class WhitelistRule {
- static $IGNORE_FIELDS = array(
+ public static $IGNORE_FIELDS = [
'check_permissions',
'debug',
'offset',
'sequential',
'sort',
'version',
- );
+ ];
/**
* Create a batch of rules from an array.
* @return array
*/
public static function createAll($rules) {
- $whitelist = array();
+ $whitelist = [];
foreach ($rules as $rule) {
$whitelist[] = new WhitelistRule($rule);
}
$this->actions = '*';
}
else {
- $this->actions = array();
+ $this->actions = [];
foreach ((array) $ruleSpec['actions'] as $action) {
$this->actions[] = Request::normalizeActionName($action, $ruleSpec['version']);
}
// Kind'a silly we need to (re(re))parse here for each rule; would be more
// performant if pre-parsed by Request::create().
$options = _civicrm_api3_get_options_from_params($apiRequest['params'], TRUE, $apiRequest['entity'], 'get');
- $return = \CRM_Utils_Array::value('return', $options, array());
+ $return = \CRM_Utils_Array::value('return', $options, []);
$activatedFields = array_merge($activatedFields, array_keys($return));
}
* List of acceptable keys.
*/
protected function filterFields($keys) {
- $r = array();
+ $r = [];
foreach ($keys as $key) {
if (in_array($key, $this->fields)) {
$r[] = $key;