* @param int $id
*
* @return array
- * @throws \CiviCRM_API3_Exception
*/
public function getPriceFieldSpec(int $id) :array {
- if (!isset($this->priceFieldMetadata[$id])) {
+ return $this->getPriceFieldsMetadata()[$id];
+ }
+
+ /**
+ * Get the metadata for the fields in the price set.
+ *
+ * @return array
+ */
+ public function getPriceFieldsMetadata(): array {
+ if (empty($this->priceFieldMetadata)) {
$this->priceFieldMetadata = CRM_Price_BAO_PriceSet::getCachedPriceSetDetail($this->getPriceSetID())['fields'];
}
- return $this->priceFieldMetadata[$id];
+ return $this->priceFieldMetadata;
}
/**
*
* @param array $input
*/
- public function setPriceSelectionFromUnfilteredInput(array $input) {
+ public function setPriceSelectionFromUnfilteredInput(array $input): void {
foreach ($input as $fieldName => $value) {
if (strpos($fieldName, 'price_') === 0) {
$fieldID = substr($fieldName, 6);