Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] CRM_Utils_Array::value() -> empty() #16704

Merged
merged 1 commit into from
Mar 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Activity/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static function select(&$query) {
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
}

if (CRM_Utils_Array::value('parent_id', $query->_returnProperties)) {
if (!empty($query->_returnProperties['parent_id'])) {
$query->_tables['parent_id'] = 1;
$query->_whereTables['parent_id'] = 1;
$query->_element['parent_id'] = 1;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Preferences/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function postProcess() {
$addressOptions = CRM_Core_OptionGroup::values('address_options', TRUE);

// check if county option has been set
if (CRM_Utils_Array::value($addressOptions['County'], $this->_params['address_options'])) {
if (!empty($this->_params['address_options'][$addressOptions['County']])) {
$countyCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_county");
if ($countyCount < 10) {
CRM_Core_Session::setStatus(ts('You have enabled the County option. Please ensure you populate the county table in your CiviCRM Database. You can find extensions to populate counties in the <a %1>CiviCRM Extensions Directory</a>.', [1 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', ['reset' => 1], TRUE, 'extensions-addnew') . '"']),
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/XMLRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function retrieve($caseType) {
// throw new CRM_Core_Exception("Cannot load caseType with malformed name [$caseType]");
//}

if (!CRM_Utils_Array::value($caseType, $this->xml)) {
if (empty($this->xml[$caseType])) {
$fileXml = $this->retrieveFile($caseType);
if ($fileXml) {
$this->xml[$caseType] = $fileXml;
Expand Down
10 changes: 5 additions & 5 deletions CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ public function selectClause($apiEntity = NULL) {
elseif (isset($field['where'])) {
list($tableName, $fieldName) = explode('.', $field['where'], 2);
if (isset($tableName)) {
if (CRM_Utils_Array::value($tableName, self::$_dependencies)) {
if (!empty(self::$_dependencies[$tableName])) {
$this->_tables['civicrm_address'] = 1;
$this->_select['address_id'] = 'civicrm_address.id as address_id';
$this->_element['address_id'] = 1;
Expand Down Expand Up @@ -4727,7 +4727,7 @@ protected static function convertCustomRelativeFields(&$formValues, &$params, $v
list($from, $to) = CRM_Utils_Date::getFromTo($values, NULL, NULL);
}
else {
if ($fieldName == $customFieldName . '_to' && CRM_Utils_Array::value($customFieldName . '_from', $formValues)) {
if ($fieldName == $customFieldName . '_to' && !empty($formValues[$customFieldName . '_from'])) {
// Both to & from are set. We only need to acton one, choosing from.
return;
}
Expand Down Expand Up @@ -6554,15 +6554,15 @@ private function pseudoConstantNameIsInReturnProperties($field, $fieldName = NUL
return FALSE;
}

if (!empty($pseudoConstant['optionGroupName']) && CRM_Utils_Array::value($pseudoConstant['optionGroupName'], $this->_returnProperties)) {
if (!empty($pseudoConstant['optionGroupName']) && !empty($this->_returnProperties[$pseudoConstant['optionGroupName']])) {
return TRUE;
}
if (CRM_Utils_Array::value($fieldName, $this->_returnProperties)) {
if (!empty($this->_returnProperties[$fieldName])) {
return TRUE;
}
// Is this still required - the above goes off the unique name. Test with things like
// communication_preferences & prefix_id.
if (CRM_Utils_Array::value($field['name'], $this->_returnProperties)) {
if (!empty($this->_returnProperties[$field['name']])) {
return TRUE;
}
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/DedupeRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function postProcess() {
}

// lets skip updating of fields for reserved dedupe group
if (CRM_Utils_Array::value('is_reserved', $this->_defaults)) {
if (!empty($this->_defaults['is_reserved'])) {
CRM_Core_Session::setStatus(ts("The rule '%1' has been saved.", [1 => $rgDao->title]), ts('Saved'), 'success');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public function preProcess() {

// assign context to drive the template display, make sure context is valid
$this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
if (!CRM_Utils_Array::value($this->_context, self::validContext())) {
if (!array_key_exists($this->_context, self::validContext())) {
Copy link
Contributor

@demeritcowboy demeritcowboy Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically these aren't equal. I don't see any code outside this class that manipulates the $_validContext property directly (which is what is returned by self::validContext()), and it seems unlikely anyone would do something screwy with it like change it to null, but it's a public property. Seems low risk though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thoughts too.

$this->_context = 'search';
}
$this->set('context', $this->_context);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public static function permissionedTaskTitles($permission, $params = array()) {
public static function getTask($value) {
self::tasks();

if (!CRM_Utils_Array::value($value, self::$_tasks)) {
if (empty(self::$_tasks[$value])) {
// make it the print task by default
$value = self::TASK_PRINT;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/BAO/Contribution/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static function processConfirm(
$paymentParams['source'] = $paymentParams['contribution_source'];
}

if (CRM_Utils_Array::value('is_recur', $form->_params) && $contribution->contribution_recur_id) {
if (!empty($form->_params['is_recur']) && $contribution->contribution_recur_id) {
$paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
}
if (isset($paymentParams['contribution_source'])) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/BAO/ContributionSoft.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static function formatSoftCreditParams(&$params, &$form) {
'soft_credit_type_id' => $params['soft_credit_type_id'],
];

if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) {
if (!empty($form->_values['is_email_receipt'])) {
$form->_values['honor'] = [
'soft_credit_type' => CRM_Utils_Array::value(
$params['soft_credit_type_id'],
Expand Down
6 changes: 3 additions & 3 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ protected function processMembership($membershipParams, $contactID, $customField
$financialTypeID = CRM_Utils_Array::value('financial_type_id', $membershipType, CRM_Utils_Array::value('financial_type_id', $membershipParams));
}

if (CRM_Utils_Array::value('membership_source', $this->_params)) {
if (!empty($this->_params['membership_source'])) {
$membershipParams['contribution_source'] = $this->_params['membership_source'];
}

Expand Down Expand Up @@ -2054,7 +2054,7 @@ protected function processFormSubmission($contactID) {
CRM_Contribute_Form_AbstractEditPayment::formatCreditCardDetails($this->_params);

// CRM-18854
if (CRM_Utils_Array::value('is_pledge', $this->_params) && !CRM_Utils_Array::value('pledge_id', $this->_values) && CRM_Utils_Array::value('adjust_recur_start_date', $this->_values)) {
if (!empty($this->_params['is_pledge']) && empty($this->_values['pledge_id']) && !empty($this->_values['adjust_recur_start_date'])) {
$pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($this->_id);
if (CRM_Utils_Array::value('start_date', $this->_params) || !CRM_Utils_Array::value('is_pledge_start_date_visible', $pledgeBlock)
|| !CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) {
Expand All @@ -2066,7 +2066,7 @@ protected function processFormSubmission($contactID) {
}

//carry payment processor id.
if (CRM_Utils_Array::value('id', $this->_paymentProcessor)) {
if (!empty($this->_paymentProcessor['id'])) {
$this->_params['payment_processor_id'] = $this->_paymentProcessor['id'];
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Contribution/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public static function formRule($fields, $files, $self) {
);

foreach ($self->_values['fee'] as $fieldKey => $fieldValue) {
if ($fieldValue['html_type'] != 'Text' && CRM_Utils_Array::value('price_' . $fieldKey, $fields)) {
if ($fieldValue['html_type'] != 'Text' && !empty($fields['price_' . $fieldKey])) {
if (!is_array($fields['price_' . $fieldKey]) && isset($fieldValue['options'][$fields['price_' . $fieldKey]])) {
if (array_key_exists('membership_type_id', $fieldValue['options'][$fields['price_' . $fieldKey]])
&& in_array($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'], $currentMemberships)
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contribute/Form/ContributionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public function preProcess() {
}

// check if billing block is required for pay later
if (CRM_Utils_Array::value('is_pay_later', $this->_values)) {
if (!empty($this->_values['is_pay_later'])) {
$this->_isBillingAddressRequiredForPayLater = CRM_Utils_Array::value('is_billing_required', $this->_values);
$this->assign('isBillingAddressRequiredForPayLater', $this->_isBillingAddressRequiredForPayLater);
}
Expand Down Expand Up @@ -951,7 +951,7 @@ public function buildComponentForm($id, $form) {

$form->assign('fieldSetTitle', CRM_Core_BAO_UFGroup::getTitle($form->_values['onbehalf_profile_id']));

if (CRM_Utils_Array::value('is_for_organization', $form->_values)) {
if (!empty($form->_values['is_for_organization'])) {
if ($form->_values['is_for_organization'] == 2) {
$form->assign('onBehalfRequired', TRUE);
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/RecurringEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ public static function getReminderDetailsByEntityId($entityId, $used_for) {
public static function updateModeLinkedEntity($entityId, $linkedEntityTable, $mainEntityTable) {
$result = [];
if ($entityId && $linkedEntityTable && $mainEntityTable) {
if (CRM_Utils_Array::value($linkedEntityTable, self::$_tableDAOMapper)) {
if (!empty(self::$_tableDAOMapper[$linkedEntityTable])) {
$dao = self::$_tableDAOMapper[$linkedEntityTable];
}
else {
Expand Down
8 changes: 4 additions & 4 deletions CRM/Core/Form/RecurringEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,17 @@ public static function postProcess($params = [], $type, $linkedEntities = []) {
//Delete relations if any from recurring entity tables before inserting new relations for this entity id
if ($params['entity_id']) {
//If entity has any pre delete function, consider that first
if (CRM_Utils_Array::value('pre_delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&
CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])
if (!empty(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['pre_delete_func']) &&
colemanw marked this conversation as resolved.
Show resolved Hide resolved
!empty(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['helper_class'])
) {
$preDeleteResult = call_user_func_array(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['pre_delete_func'], [$params['entity_id']]);
if (!empty($preDeleteResult)) {
call_user_func([CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['helper_class'], $preDeleteResult]);
}
}
//Ready to execute delete on entities if it has delete function set
if (CRM_Utils_Array::value('delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&
CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])
if (!empty(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['delete_func']) &&
!empty(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['helper_class'])
) {
//Check if pre delete function has some ids to be deleted
if (!empty(CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted)) {
Expand Down
6 changes: 3 additions & 3 deletions CRM/Core/Page/RecurringEntityPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public function run() {
$endDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['intervalDateColumns'][0];

$recursion = new CRM_Core_BAO_RecurringEntity();
if (CRM_Utils_Array::value('dateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
if (!empty(CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'])) {
$recursion->dateColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'];
}
$recursion->scheduleFormValues = $formValues;
if (!empty($formValues['exclude_date_list'])) {
$recursion->excludeDates = explode(',', $formValues['exclude_date_list']);
}
if (CRM_Utils_Array::value('excludeDateRangeColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
if (!empty(CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['excludeDateRangeColumns'])) {
$recursion->excludeDateRangeColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['excludeDateRangeColumns'];
}

Expand All @@ -52,7 +52,7 @@ public function run() {
}

//Check if there is any enddate column defined to find out the interval between the two range
if (CRM_Utils_Array::value('intervalDateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
if (!empty(CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['intervalDateColumns'])) {
if ($endDate) {
$interval = $recursion->getInterval($startDate, $endDate);
$recursion->intervalDateColumns = [$endDateColumnName => $interval];
Expand Down
8 changes: 4 additions & 4 deletions CRM/Core/PseudoConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public static function &activityType() {
* array reference of all State/Provinces.
*/
public static function &stateProvince($id = FALSE, $limit = TRUE) {
if (($id && !CRM_Utils_Array::value($id, self::$stateProvince)) || !self::$stateProvince || !$id) {
if (($id && empty(self::$stateProvince[$id])) || !self::$stateProvince || !$id) {
$whereClause = FALSE;
if ($limit) {
$countryIsoCodes = self::countryIsoCode();
Expand Down Expand Up @@ -791,7 +791,7 @@ public static function stateProvinceAbbreviationForDefaultCountry() {
* array reference of all countries.
*/
public static function country($id = FALSE, $applyLimit = TRUE) {
if (($id && !CRM_Utils_Array::value($id, self::$country)) || !self::$country || !$id) {
if (($id && empty(self::$country[$id])) || !self::$country || !$id) {

$config = CRM_Core_Config::singleton();
$limitCodes = [];
Expand Down Expand Up @@ -1151,7 +1151,7 @@ public static function &paymentProcessorType($all = FALSE, $id = NULL, $return =
if (empty(self::$paymentProcessorType[$cacheKey])) {
self::populate(self::$paymentProcessorType[$cacheKey], 'CRM_Financial_DAO_PaymentProcessorType', $all, $return, 'is_active', NULL, "is_default, $return", 'id');
}
if ($id && CRM_Utils_Array::value($id, self::$paymentProcessorType[$cacheKey])) {
if ($id && !empty(self::$paymentProcessorType[$cacheKey][$id])) {
return self::$paymentProcessorType[$cacheKey][$id];
}
return self::$paymentProcessorType[$cacheKey];
Expand Down Expand Up @@ -1398,7 +1398,7 @@ public static function greeting($filter, $columnName = 'label') {
$index .= '_' . $contactType;
}

if (!CRM_Utils_Array::value($index, Civi::$statics[__CLASS__]['greeting'])) {
if (empty(Civi::$statics[__CLASS__]['greeting'][$index])) {
$filterCondition = NULL;
if ($contactType) {
$filterVal = 'v.filter =';
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static function corePermissionedTaskTitles($tasks, $permission, $params)
public static function getTask($value) {
static::tasks();

if (!CRM_Utils_Array::value($value, self::$_tasks)) {
if (empty(self::$_tasks[$value])) {
// Children can specify a default task (eg. print), pick another if it is not valid.
$value = key(self::$_tasks);
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/BAO/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ public static function getValidAdditionalIds($participantId, $oldStatusId, $newS
$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
}

if (CRM_Utils_Array::value($participantStatuses[$oldStatusId], self::$_statusTransitionsRules) &&
if (!empty(self::$_statusTransitionsRules[$participantStatuses[$oldStatusId]]) &&
in_array($participantStatuses[$newStatusId], self::$_statusTransitionsRules[$participantStatuses[$oldStatusId]])
) {
$additionalParticipantIds = self::getAdditionalParticipantIds($participantId, TRUE, $oldStatusId);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ public function submit($params) {
}
}

if (CRM_Utils_Array::value('tax_amount', $this->_params)) {
if (!empty($this->_params['tax_amount'])) {
$contributionParams['tax_amount'] = $this->_params['tax_amount'];
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public function preProcess() {
// note that I have started removing the use of isBillingAddressRequiredForPayLater in favour of letting
// the CRM_Core_Payment_Manual class handle it - but there are ~300 references to it in the code base so only
// removing in very limited cases.
if (CRM_Utils_Array::value('is_pay_later', $this->_values['event'])) {
if (!empty($this->_values['event']['is_pay_later'])) {
$this->_isBillingAddressRequiredForPayLater = CRM_Utils_Array::value('is_billing_required', $this->_values['event']);
$this->assign('isBillingAddressRequiredForPayLater', $this->_isBillingAddressRequiredForPayLater);
}
Expand Down
4 changes: 2 additions & 2 deletions CRM/Event/PseudoConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static function &participantStatus($id = NULL, $cond = NULL, $retColumn =

$index = $cond ? $cond : 'No Condition';
$index = "{$index}_{$retColumn}";
if (!CRM_Utils_Array::value($index, self::$participantStatus)) {
if (empty(self::$participantStatus[$index])) {
self::$participantStatus[$index] = [];
CRM_Core_PseudoConstant::populate(self::$participantStatus[$index],
'CRM_Event_DAO_ParticipantStatusType',
Expand Down Expand Up @@ -182,7 +182,7 @@ public static function &participantStatusClass() {
*/
public static function &participantRole($id = NULL, $cond = NULL) {
$index = $cond ? $cond : 'No Condition';
if (!CRM_Utils_Array::value($index, self::$participantRole)) {
if (empty(self::$participantRole[$index])) {
self::$participantRole[$index] = [];

$condition = NULL;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Grant/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static function permissionedTaskTitles($permission, $params = []) {
public static function getTask($value) {
self::tasks();

if (!CRM_Utils_Array::value($value, self::$_tasks)) {
if (empty(self::$_tasks[$value])) {
// make it the print task by default
$value = self::TASK_PRINT;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Mailing/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function select(&$query) {
}
}

if (CRM_Utils_Array::value('mailing_campaign_id', $query->_returnProperties)) {
if (!empty($query->_returnProperties['mailing_campaign_id'])) {
$query->_select['mailing_campaign_id'] = 'civicrm_mailing.campaign_id as mailing_campaign_id';
$query->_element['mailing_campaign_id'] = 1;
$query->_tables['civicrm_campaign'] = 1;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Import/Parser/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ public function membership_format_params($params, &$values, $create = FALSE) {
break;

case 'membership_type_id':
if (!CRM_Utils_Array::value($value, CRM_Member_PseudoConstant::membershipType())) {
if (!array_key_exists($value, CRM_Member_PseudoConstant::membershipType())) {
throw new Exception('Invalid Membership Type Id');
}
$values[$key] = $value;
Expand Down
4 changes: 2 additions & 2 deletions CRM/Member/Page/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public static function &links(
$isCancelSupported = FALSE,
$isUpdateBilling = FALSE
) {
if (!CRM_Utils_Array::value('view', self::$_links)) {
if (empty(self::$_links['view'])) {
self::$_links['view'] = [
CRM_Core_Action::VIEW => [
'name' => ts('View'),
Expand All @@ -486,7 +486,7 @@ public static function &links(
];
}

if (!CRM_Utils_Array::value('all', self::$_links)) {
if (empty(self::$_links['all'])) {
$extraLinks = [
CRM_Core_Action::UPDATE => [
'name' => ts('Edit'),
Expand Down
2 changes: 1 addition & 1 deletion CRM/Pledge/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function permissionedTaskTitles($permission, $params = []) {
public static function getTask($value) {
self::tasks();

if (!CRM_Utils_Array::value($value, self::$_tasks)) {
if (empty(self::$_tasks[$value])) {
// make it the print task by default
$value = self::TASK_PRINT;
}
Expand Down
Loading