$params = [1 => [$str, 'String']];
$count = CRM_Core_DAO::singleValueQuery($query, $params);
- return ($count) ? TRUE : FALSE;
+ return (bool) $count;
}
/**
* @param array $list
*/
public function assertArrayKeyExists($key, &$list) {
- $result = isset($list[$key]) ? TRUE : FALSE;
+ $result = isset($list[$key]);
$this->assertTrue($result, sprintf("%s element exists?", $key));
}
* true if error, false otherwise
*/
function civicrm_error($result) {
- if (is_array($result)) {
- return (array_key_exists('is_error', $result) &&
- $result['is_error']
- ) ? TRUE : FALSE;
- }
- return FALSE;
+ return is_array($result) && !empty($result['is_error']);
}
/**
if ($contactID == $session->get('userID')) {
return civicrm_api3_create_error('This contact record is linked to the currently logged in user account - and cannot be deleted.');
}
- $restore = !empty($params['restore']) ? $params['restore'] : FALSE;
- $skipUndelete = !empty($params['skip_undelete']) ? $params['skip_undelete'] : FALSE;
+ $restore = !empty($params['restore']);
+ $skipUndelete = !empty($params['skip_undelete']);
// CRM-12929
// restrict permanent delete if a contact has financial trxn associated with it
* @throws API_Exception
*/
function civicrm_api3_profile_get($params) {
- $nonStandardLegacyBehaviour = is_numeric($params['profile_id']) ? TRUE : FALSE;
+ $nonStandardLegacyBehaviour = is_numeric($params['profile_id']);
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');
}
//@todo get_options should take an array - @ the moment it is only takes 'all' - which is supported
// by other getfields fn
// we don't resolve state, country & county for performance reasons
- $resolveOptions = CRM_Utils_Array::value('get_options', $apirequest['params']) == 'all' ? TRUE : FALSE;
+ $resolveOptions = ($apirequest['params']['get_options'] ?? NULL) == 'all';
$profileID = _civicrm_api3_profile_getProfileID($apirequest['params']['profile_id']);
$params = _civicrm_api3_buildprofile_submitfields($profileID, $resolveOptions, CRM_Utils_Array::value('cache_clear', $params));
}
)
);
}
- $onlyRequire = ($dbName == 'Drupal' || $dbName == 'Backdrop') ? TRUE : FALSE;
+ $onlyRequire = $dbName == 'Drupal' || $dbName == 'Backdrop';
$this->requireDatabaseOrCreatePermissions(
$databaseConfig['server'],
$databaseConfig['username'],