/var/www/html_uk/wp-content/plugins/automatewoo/includes/Rules/Cart_Created_Date.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
43
44
45
46
47
48
49
50
51
<?php

namespace AutomateWoo\Rules;

use 
AutomateWoo\DataTypes\DataTypes;

defined'ABSPATH' ) || exit;

/**
 * Cart created date rule.
 *
 * @class Cart_Created_Date
 */
class Cart_Created_Date extends Abstract_Date {

    
/**
     * Data item type.
     *
     * @var string
     */
    
public $data_item DataTypes::CART;

    
/**
     * Cart_Created_Date constructor.
     */
    
public function __construct() {
        
$this->has_is_past_comparision true;

        
parent::__construct();
    }

    
/**
     * Init.
     */
    
public function init() {
        
$this->title __'Cart - Created Date''automatewoo' );
    }

    
/**
     * Validates rule.
     *
     * @param \AutomateWoo\Cart $cart    The cart.
     * @param string            $compare What variables we're using to compare.
     * @param array|null        $value   The values we have to compare. Null is only allowed when $compare is is_not_set.
     *
     * @return bool
     */
    
public function validate$cart$compare$value null ) {
        return 
$this->validate_date$compare$value$cart->get_date_created() );
    }
}