Completed
Branch BUG-10878-event-spaces-remaini... (49b4f1)
by
unknown
53:16 queued 42:45
created

EE_Checkin::new_instance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 3
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
3
4
5
/**
6
 * EE_Checkin class
7
 *
8
 * @package            Event Espresso
9
 * @subpackage         includes/classes/EE_Checkin.class.php
10
 * @author             Darren Ethier
11
 */
12
class EE_Checkin extends EE_Base_Class
13
{
14
15
16
    /**
17
     * Used to reference when a registration has been checked out.
18
     *
19
     * @type int
20
     */
21
    const status_checked_out = 0;
22
23
    /**
24
     * Used to reference when a registration has been checked in.
25
     *
26
     * @type int
27
     */
28
    const status_checked_in = 1;
29
30
    /**
31
     * Used to reference when a registration has never been checked in.
32
     *
33
     * @type int
34
     */
35
    const status_checked_never = 2;
36
37
38
39
    /**
40
     *
41
     * @param array  $props_n_values    incoming values
42
     * @param string $timezone          incoming timezone (if not set the timezone set for the website will be used.)
43
     * @param array  $date_formats      incoming date_formats in an array
44
     *                                  where the first value is the date_format
45
     *                                  and the second value is the time format
46
     * @return EE_Checkin
47
     * @throws EE_Error
48
     */
49
    public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array())
50
    {
51
        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
52
        return $has_object
53
            ? $has_object
54
            : new self($props_n_values, false, $timezone, $date_formats);
55
    }
56
57
58
59
    /**
60
     * @param array  $props_n_values  incoming values from the database
61
     * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
62
     *                                the website will be used.
63
     * @return EE_Checkin
64
     * @throws EE_Error
65
     */
66
    public static function new_instance_from_db($props_n_values = array(), $timezone = null)
67
    {
68
        return new self($props_n_values, true, $timezone);
69
    }
70
71
72
    public function ID()
73
    {
74
        return $this->get('CHK_ID');
75
    }
76
77
78
    public function registration_id()
79
    {
80
        return $this->get('REG_ID');
81
    }
82
83
84
    public function datetime_id()
85
    {
86
        return $this->get('DTT_ID');
87
    }
88
89
90
    public function status()
91
    {
92
        return $this->get('CHK_in');
93
    }
94
95
96
    public function timestamp()
97
    {
98
        return $this->get('CHK_timestamp');
99
    }
100
}
101