*
* @return array
*/
- protected static function getPriceSetDetails($params) {
+ protected function getPriceSetDetails(array $params): ?array {
$priceSetID = $params['price_set_id'] ?? NULL;
if ($priceSetID) {
return CRM_Price_BAO_PriceSet::getSetDetail($priceSetID);
*
* @return int
*/
- protected static function getPriceSetID($params) {
+ protected function getPriceSetID(array $params): int {
$priceSetID = $params['price_set_id'] ?? NULL;
if (!$priceSetID) {
- $priceSetDetails = self::getPriceSetDetails($params);
+ $priceSetDetails = $this->getPriceSetDetails($params);
return (int) key($priceSetDetails);
}
return (int) $priceSetID;
*
* @return array
*/
- protected function setPriceSetParameters($formValues) {
- $this->_priceSetId = self::getPriceSetID($formValues);
- $priceSetDetails = self::getPriceSetDetails($formValues);
+ protected function setPriceSetParameters(array $formValues): array {
+ $this->_priceSetId = $this->getPriceSetID($formValues);
+ $priceSetDetails = $this->getPriceSetDetails($formValues);
$this->_priceSet = $priceSetDetails[$this->_priceSetId];
// process price set and get total amount and line items.
$this->ensurePriceParamsAreSet($formValues);
public static function formRule($params, $files, $self) {
$errors = [];
- $priceSetId = self::getPriceSetID($params);
- $priceSetDetails = self::getPriceSetDetails($params);
+ $priceSetId = $self->getPriceSetID($params);
+ $priceSetDetails = $self->getPriceSetDetails($params);
$selectedMemberships = self::getSelectedMemberships($priceSetDetails[$priceSetId], $params);
protected function getOrderParams(): array {
$order = new CRM_Financial_BAO_Order();
$order->setPriceSelectionFromUnfilteredInput($this->_params);
- $order->setPriceSetID(self::getPriceSetID($this->_params));
+ $order->setPriceSetID($this->getPriceSetID($this->_params));
$order->setOverrideTotalAmount($this->_params['total_amount']);
$order->setOverrideFinancialTypeID((int) $this->_params['financial_type_id']);
return [