Completed
Branch BUG-10375-migrations-not-repor... (1e9646)
by
unknown
62:53 queued 49:42
created

TicketSelectorSimple   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A addTemplateArgs() 0 12 1
1
<?php
2
namespace EventEspresso\modules\ticket_selector;
3
4
defined('ABSPATH') || exit;
5
6
7
8
/**
9
 * Class TicketSelectorSimple
10
 * there's one ticket, and max attendees is set to one,
11
 * so if the event is free, then this is a "simple" ticket selector
12
 * a.k.a. "Dude Where's my Ticket Selector?"
13
 *
14
 * @package       Event Espresso
15
 * @author        Brent Christensen
16
 * @since         4.9.18
17
 */
18
class TicketSelectorSimple extends TicketSelector
19
{
20
21
    /**
22
     * @var \EE_Ticket $ticket
23
     */
24
    protected $ticket;
25
26
27
28
    /**
29
     * TicketSelectorSimple constructor.
30
     *
31
     * @param \EE_Event  $event
32
     * @param \EE_Ticket $ticket
33
     * @param int        $max_attendees
34
     * @param array      $template_args
35
     */
36
    public function __construct(\EE_Event $event, \EE_Ticket $ticket, $max_attendees, array $template_args)
37
    {
38
        $this->ticket = $ticket;
39
        parent::__construct($event, array($this->ticket), $max_attendees, $template_args);
40
    }
41
42
43
44
    /**
45
     * sets any and all template args that are required for this Ticket Selector
46
     *
47
     * @return void
48
     */
49
    protected function addTemplateArgs()
50
    {
51
        unset($this->template_args['tickets']);
52
        $this->template_args['ticket'] = $this->ticket;
53
        $ticket_selector_row = new TicketSelectorRowSimple(
54
            $this->ticket,
55
            $this->max_attendees,
56
            $this->template_args['date_format']
57
        );
58
        $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay();
59
        $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php';
60
    }
61
62
63
}
64
// End of file TicketSelectorSimple.php
65
// Location: EventEspresso\modules\ticket_selector/TicketSelectorSimple.php