Partial of #16768 - only contains test lines which I don't think need individual review
$this->assertEquals(1, $values['noteTotalCount'], 'Check for total note count');
foreach ($values['note'] as $key => $val) {
- $retrieveNote = CRM_Utils_Array::value('note', $val);
+ $retrieveNote = $val['note'] ?? NULL;
//check the note value
$this->assertEquals($params['note'], $retrieveNote, 'Check for note');
}
$result = civicrm_api3('Address', 'create', $params);
$value = array_pop($result['values']);
- $street_number = CRM_Utils_Array::value('street_number', $value);
+ $street_number = $value['street_number'] ?? NULL;
$this->assertEquals($street_number, '54');
// Ensure street parsing does not happen if disabled.
$this->setStreetAddressParsing(FALSE);
$result = civicrm_api3('Address', 'create', $params);
$value = array_pop($result['values']);
- $street_number = CRM_Utils_Array::value('street_number', $value);
+ $street_number = $value['street_number'] ?? NULL;
$this->assertEmpty($street_number);
}
foreach ($cases as $case) {
list ($type, $className, $expectedResult) = $case;
- $methodName = CRM_Utils_Array::value(3, $case);
+ $methodName = $case[3] ?? NULL;
$actualResult = CRM_Core_Page_AJAX::checkAuthz($type, $className, $methodName);
if ($methodName) {
$this->assertEquals($expectedResult, $actualResult,
// -- processing priceSet using the BAO
$lineItems = [];
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId, TRUE, FALSE);
- $priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
- $feeBlock = CRM_Utils_Array::value('fields', $priceSet);
+ $priceSet = $priceSet[$priceSetId] ?? NULL;
+ $feeBlock = $priceSet['fields'] ?? NULL;
$params['price_2'] = $feeTotal;
$tempParams = $params;
$this->_priceSetID = $this->priceSetCreate();
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_eventId, $this->_priceSetID);
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($this->_priceSetID, TRUE, FALSE);
- $priceSet = CRM_Utils_Array::value($this->_priceSetID, $priceSet);
- $this->_feeBlock = CRM_Utils_Array::value('fields', $priceSet);
+ $priceSet = $priceSet[$this->_priceSetID] ?? NULL;
+ $this->_feeBlock = $priceSet['fields'] ?? NULL;
}
/**
$this->_priceSetID = $this->priceSetCreate('Text');
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_eventId, $this->_priceSetID);
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($this->_priceSetID, TRUE, FALSE);
- $priceSet = CRM_Utils_Array::value($this->_priceSetID, $priceSet);
- $this->_feeBlock = CRM_Utils_Array::value('fields', $priceSet);
+ $priceSet = $priceSet[$this->_priceSetID] ?? NULL;
+ $this->_feeBlock = $priceSet['fields'] ?? NULL;
$params = [
'send_receipt' => 1,
'limit' => 0,
],
]);
- $result = CRM_Utils_Array::value('values', $membershipTypesResult, NULL);
+ $result = $membershipTypesResult['values'] ?? NULL;
$this->assertEquals(empty($result), FALSE, 'Verify membership types for organization.');
$membershipTypesResult = civicrm_api3('MembershipType', 'get', [
'limit' => 0,
],
]);
- $result = CRM_Utils_Array::value('values', $membershipTypesResult, NULL);
+ $result = $membershipTypesResult['values'] ?? NULL;
$this->assertEquals(empty($result), TRUE, 'Verify membership types for organization.');
$this->membershipTypeDelete(['id' => $membershipType->id]);
$providerID = $provider['id'];
}
else {
- $providerID = CRM_Utils_Array::value('provider_id', $providerParams);
+ $providerID = $providerParams['provider_id'] ?? NULL;
}
$skipAuth = $providerID ? FALSE : TRUE;
$cacheKey = (int) $providerID;
$this->priceSetID = $this->ids['PriceSet'][] = $this->eventPriceSetCreate(55, 0, 'Radio', $options);
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $event['id'], $this->priceSetID);
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($this->priceSetID, TRUE, FALSE);
- $priceSet = CRM_Utils_Array::value($this->priceSetID, $priceSet);
- $this->eventFeeBlock = CRM_Utils_Array::value('fields', $priceSet);
+ $priceSet = $priceSet[$this->priceSetID] ?? NULL;
+ $this->eventFeeBlock = $priceSet['fields'] ?? NULL;
return $event;
}
else {
$keys[CRM_Utils_Array::value('name', $settings, $field)] = CRM_Utils_Array::value('name', $settings, $field);
}
- $type = CRM_Utils_Array::value('type', $settings);
+ $type = $settings['type'] ?? NULL;
if ($type == CRM_Utils_Type::T_DATE) {
$dateFields[] = $settings['name'];
// we should identify both real names & unique names as dates
*/
public function hook_civicrm_alterPaymentProcessorParams($paymentObj, &$rawParams, &$cookedParams) {
// Ensure total_amount are the same if they're both given.
- $total_amount = CRM_Utils_Array::value('total_amount', $rawParams);
- $amount = CRM_Utils_Array::value('amount', $rawParams);
+ $total_amount = $rawParams['total_amount'] ?? NULL;
+ $amount = $rawParams['amount'] ?? NULL;
if (!empty($total_amount) && !empty($amount) && $total_amount != $amount) {
throw new Exception("total_amount '$total_amount' and amount '$amount' differ.");
}
foreach ($memType as $rowCount => $type) {
$membetype = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($type);
$fieldParams['option_id'] = [1 => $priceFieldValue['id']];
- $fieldParams['option_label'][$rowCount] = CRM_Utils_Array::value('name', $membetype);
+ $fieldParams['option_label'][$rowCount] = $membetype['name'] ?? NULL;
$fieldParams['option_amount'][$rowCount] = $membetype['minimum_fee'] ?? 0;
- $fieldParams['option_weight'][$rowCount] = CRM_Utils_Array::value('weight', $membetype);
- $fieldParams['option_description'][$rowCount] = CRM_Utils_Array::value('description', $membetype);
- $fieldParams['option_financial_type_id'][$rowCount] = CRM_Utils_Array::value('financial_type_id', $membetype);
+ $fieldParams['option_weight'][$rowCount] = $membetype['weight'] ?? NULL;
+ $fieldParams['option_description'][$rowCount] = $membetype['description'] ?? NULL;
+ $fieldParams['option_financial_type_id'][$rowCount] = $membetype['financial_type_id'] ?? NULL;
$fieldParams['membership_type_id'][$rowCount] = $type;
}
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);