Give_Payment::maybe_alter_stats PHP Метод

maybe_alter_stats() приватный Метод

Used during the process of moving to refunded or pending, to decrement stats
С версии: 1.5
private maybe_alter_stats ( boolean $alter_store_earnings, boolean $alter_customer_value, boolean $alter_customer_purchase_count ) : void
$alter_store_earnings boolean If the method should alter the store earnings
$alter_customer_value boolean If the method should reduce the customer value
$alter_customer_purchase_count boolean If the method should reduce the customer's purchase count
Результат void
    private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count)
    {
        give_undo_purchase(false, $this->ID);
        // Decrease store earnings
        if (true === $alter_store_earnings) {
            give_decrease_total_earnings($this->total);
        }
        // Decrement the stats for the customer
        if (!empty($this->customer_id)) {
            $customer = new Give_Customer($this->customer_id);
            if (true === $alter_customer_value) {
                $customer->decrease_value($this->total);
            }
            if (true === $alter_customer_purchase_count) {
                $customer->decrease_purchase_count();
            }
        }
    }