/var/www/html_uk/wp-content/plugins/automatewoo/includes/Rules/SubscriptionPaymentCount.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

namespace AutomateWoo\Rules;

use 
WC_Subscription;

defined'ABSPATH' ) || exit;

/**
 * SubscriptionPaymentCount rule class.
 */
class SubscriptionPaymentCount extends Abstract_Number {

    
/** @var string */
    
public $data_item 'subscription';

    
/** @var bool */
    
public $support_floats false;

    
/**
     * Initializer
     *
     * @return void
     */
    
public function init() {
        
$this->title __'Subscription - Payment Count''automatewoo' );
    }


    
/**
     * @param WC_Subscription $subscription
     * @param string          $compare
     * @param mixed           $value
     * @return bool
     */
    
public function validate$subscription$compare$value ) {
        
// Method changed in WCS 2.6
        
$payment_count is_callable( [ $subscription'get_payment_count' ] ) ? $subscription->get_payment_count() : $subscription->get_completed_payment_count();

        return 
$this->validate_number$payment_count$compare$value );
    }
}