// If we check a custom field on 'IS NULL', it should also work when there is no
// record in the custom value table, see CRM-20740.
$side = empty($value['IS NULL']) ? 'INNER' : 'LEFT OUTER';
- list($table_name, $column_name) = $this->addCustomField($this->apiFieldSpec['custom_' . $cf_id], $side);
+ [$table_name, $column_name] = $this->addCustomField($this->apiFieldSpec['custom_' . $cf_id], $side);
}
elseif (strpos($key, '.')) {
$fkInfo = $this->addFkField($key, 'INNER');
if ($fkInfo) {
- list($table_name, $column_name) = $fkInfo;
+ [$table_name, $column_name] = $fkInfo;
$this->validateNestedInput($key, $value);
}
}
try {
$this->boot($apiRequest);
- list($apiProvider, $apiRequest) = $this->resolve($apiRequest);
+ [$apiProvider, $apiRequest] = $this->resolve($apiRequest);
$this->authorize($apiProvider, $apiRequest);
return TRUE;
}
public function runRequest($apiRequest) {
$this->boot($apiRequest);
- list($apiProvider, $apiRequest) = $this->resolve($apiRequest);
+ [$apiProvider, $apiRequest] = $this->resolve($apiRequest);
$this->authorize($apiProvider, $apiRequest);
- list ($apiProvider, $apiRequest) = $this->prepare($apiProvider, $apiRequest);
+ [$apiProvider, $apiRequest] = $this->prepare($apiProvider, $apiRequest);
$result = $apiProvider->invoke($apiRequest);
return $this->respond($apiProvider, $apiRequest, $result);
}
if (isset($apiRequest['params']['id'])) {
- list($isValidId, $entityTable, $entityId) = $this->getDelegate($apiRequest['params']['id']);
+ [$isValidId, $entityTable, $entityId] = $this->getDelegate($apiRequest['params']['id']);
if ($isValidId && $entityTable && $entityId) {
$this->authorizeDelegate($apiRequest['action'], $entityTable, $entityId, $apiRequest);
$this->preventReassignment($apiRequest['params']['id'], $entityTable, $entityId, $apiRequest);
* @throws \API_Exception
*/
protected function runChain($request, $row) {
- list($entity, $action, $params, $index) = $request;
+ [$entity, $action, $params, $index] = $request;
// Swap out variables in $entity, $action & $params
$this->resolveChainLinks($entity, $row);
$this->resolveChainLinks($action, $row);
}
// If either the having or select field contains a pseudoconstant suffix, match and perform substitution
else {
- list($fieldName) = explode(':', $expr);
+ [$fieldName] = explode(':', $expr);
foreach ($this->selectAliases as $selectAlias => $selectExpr) {
- list($selectField) = explode(':', $selectAlias);
+ [$selectField] = explode(':', $selectAlias);
if ($selectAlias === $selectExpr && $fieldName === $selectField && isset($this->apiFieldSpec[$fieldName])) {
$field = $this->getField($fieldName);
FormattingUtil::formatInputValue($value, $expr, $field, $operator);
// First item in the array is the entity name
$entity = array_shift($join);
// Which might contain an alias. Split on the keyword "AS"
- list($entity, $alias) = array_pad(explode(' AS ', $entity), 2, NULL);
+ [$entity, $alias] = array_pad(explode(' AS ', $entity), 2, NULL);
// Ensure permissions
if (!$this->checkEntityAccess($entity)) {
continue;
$stack = [NULL, NULL];
// See if the ON clause already contains an FK reference to joinEntity
$explicitFK = array_filter($joinTree, function($clause) use ($alias, $joinEntityFields) {
- list($sideA, $op, $sideB) = array_pad((array) $clause, 3, NULL);
+ [$sideA, $op, $sideB] = array_pad((array) $clause, 3, NULL);
if ($op !== '=' || !$sideB) {
return FALSE;
}
$bridgeAlias = $side === 'INNER' ? $bridgeAlias : $alias;
// Find explicit bridge join conditions and move them out of the joinTree
$joinTree = array_filter($joinTree, function ($clause) use ($baseRef, $alias, $bridgeAlias, &$bridgeConditions) {
- list($sideA, $op, $sideB) = array_pad((array) $clause, 3, NULL);
+ [$sideA, $op, $sideB] = array_pad((array) $clause, 3, NULL);
// Skip AND/OR/NOT branches
if (!$sideB) {
return TRUE;
*/
public function popAll() {
while ($frame = array_pop($this->stack)) {
- list($setting, $value) = $frame;
+ [$setting, $value] = $frame;
if ($value === NULL) {
unset($GLOBALS['civicrm_setting']['domain'][$setting]);
}
* @throws CryptoException
*/
public function parseKey($keyExpr) {
- list($suite, $keyFunc, $keyVal) = explode(':', $keyExpr);
+ [$suite, $keyFunc, $keyVal] = explode(':', $keyExpr);
if ($suite === '') {
$suite = self::DEFAULT_SUITE;
}
}
// Handle single api call
- list(, $chainEntity, $chainAction) = explode('.', $key);
+ [, $chainEntity, $chainAction] = explode('.', $key);
$lcChainEntity = \CRM_Core_DAO_AllCoreTables::convertEntityNameToLower($chainEntity);
$chainEntity = \CRM_Core_DAO_AllCoreTables::convertEntityNameToCamel($chainEntity);
$lcMainEntity = \CRM_Core_DAO_AllCoreTables::convertEntityNameToLower($mainEntity);
*/
protected function assertContentType($expectType, $response = NULL) {
$response = $this->resolveResponse($response);
- list($actualType) = explode(';', $response->getHeader('Content-Type')[0]);
+ [$actualType] = explode(';', $response->getHeader('Content-Type')[0]);
$fmt = $actualType === $expectType ? '' : $this->formatFailure($response);
$this->assertEquals($expectType, $actualType, "Expected content-type $expectType. Received content-type $actualType.\n$fmt");
return $this;