Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Mailpoet_Segment_Conditions
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 instance
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 require_segment_conditions
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/*
3 * Jetpack CRM
4 * https://jetpackcrm.com
5 *
6 * MailPoet: Segment Conditions
7 *
8 */
9namespace Automattic\JetpackCRM;
10
11// block direct access
12defined( 'ZEROBSCRM_PATH' ) || exit( 0 );
13
14/**
15 * MailPoet Segment Conditions class
16 */
17class Mailpoet_Segment_Conditions {
18
19    /**
20     * An array of our segment condition class instances
21     */
22    public $conditions = array();
23
24    /**
25     * The single instance of the class.
26     */
27    protected static $_instance = null;
28
29    /**
30     * Setup Segment conditions
31     */
32    public function __construct() {
33
34        // Require segment conditions when jpcrm is ready
35        add_action( 'jpcrm_post_init', array( $this, 'require_segment_conditions' ), 1 );
36    }
37
38    /**
39     * Main Class Instance.
40     *
41     * Ensures only one instance of Mailpoet_Segment_Conditions is loaded or can be loaded.
42     *
43     * @since 2.0
44     * @static
45     * @see
46     * @return Mailpoet_Segment_Conditions main instance
47     */
48    public static function instance() {
49        if ( self::$_instance === null ) {
50            self::$_instance = new self();
51        }
52        return self::$_instance;
53    }
54
55    /**
56     * Require segment conditions
57     */
58    public function require_segment_conditions() {
59
60        // is mailpoet subscriber
61        require_once JPCRM_MAILPOET_ROOT_PATH . 'includes/segment-conditions/class-segment-condition-mailpoet-subscriber.php';
62        $this->conditions['is_mailpoet_customer'] = new \Segment_Condition_Mailpoet_Subscriber();
63    }
64}