<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
namespace Civi\API;
* @inheritDoc
*/
protected function buildWhereClause() {
- $filters = array();
+ $filters = [];
foreach ($this->where as $key => $value) {
$table_name = NULL;
$column_name = NULL;
// Legacy support for old filter syntax per the test contract.
// (Convert the style to the later one & then deal with them).
$filterArray = explode('.', $key);
- $value = array($filterArray[1] => $value);
+ $value = [$filterArray[1] => $value];
$key = 'filters';
}
foreach ($value as $filterKey => $filterValue) {
if (substr($filterKey, -4, 4) == 'high') {
$key = substr($filterKey, 0, -5);
- $value = array('<=' => $filterValue);
+ $value = ['<=' => $filterValue];
}
if (substr($filterKey, -3, 3) == 'low') {
$key = substr($filterKey, 0, -4);
- $value = array('>=' => $filterValue);
+ $value = ['>=' => $filterValue];
}
if ($filterKey == 'is_current' || $filterKey == 'isCurrent') {
}
$operator = is_array($value) ? \CRM_Utils_Array::first(array_keys($value)) : NULL;
if (!in_array($operator, \CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
- $value = array('=' => $value);
+ $value = ['=' => $value];
}
$filters[$key] = \CRM_Core_DAO::createSQLFilter("{$table_name}.{$column_name}", $value);
}
$orGroups = array_map('trim', explode(',', $orGroups));
}
if (!is_array(\CRM_Utils_Array::first($orGroups))) {
- $orGroups = array($orGroups);
+ $orGroups = [$orGroups];
}
foreach ($orGroups as $orGroup) {
- $orClause = array();
+ $orClause = [];
foreach ($orGroup as $key) {
if (!isset($filters[$key])) {
throw new \CiviCRM_API3_Exception("'$key' specified in OR group but not added to params");
protected function getFields() {
require_once 'api/v3/Generic.php';
// Call this function directly instead of using the api wrapper to force unique field names off
- $apiSpec = \civicrm_api3_generic_getfields(array(
+ $apiSpec = \civicrm_api3_generic_getfields([
'entity' => $this->entity,
'version' => 3,
- 'params' => array('action' => 'get'),
- ), FALSE);
+ 'params' => ['action' => 'get'],
+ ], FALSE);
return $apiSpec['values'];
}
foreach ($this->apiFieldSpec as $field) {
if (
$fieldName == \CRM_Utils_Array::value('uniqueName', $field) ||
- array_search($fieldName, \CRM_Utils_Array::value('api.aliases', $field, array())) !== FALSE
+ array_search($fieldName, \CRM_Utils_Array::value('api.aliases', $field, [])) !== FALSE
) {
return $field;
}