1 | <?php |
||
2 | |||
3 | /* |
||
4 | * @copyright 2015 Mautic Contributors. All rights reserved |
||
5 | * @author Mautic |
||
6 | * |
||
7 | * @link http://mautic.org |
||
8 | * |
||
9 | * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html |
||
10 | */ |
||
11 | |||
12 | namespace Mautic\CampaignBundle\Event; |
||
13 | |||
14 | use Mautic\CampaignBundle\Entity\LeadEventLog; |
||
15 | use Symfony\Component\EventDispatcher\Event; |
||
16 | |||
17 | /** |
||
18 | * Class CampaignDecisionEvent. |
||
19 | * |
||
20 | * @deprecated 2.13.0; to be removed in 3.0 |
||
21 | */ |
||
22 | class CampaignDecisionEvent extends Event |
||
23 | { |
||
24 | protected $lead; |
||
25 | protected $events; |
||
26 | protected $decisionType; |
||
27 | protected $decisionEventDetails; |
||
28 | protected $eventSettings; |
||
29 | protected $isRootLevel; |
||
30 | protected $decisionTriggered = false; |
||
31 | protected $logs; |
||
32 | |||
33 | /** |
||
34 | * @param $lead |
||
35 | * @param $decisionType |
||
36 | * @param $decisionEventDetails |
||
37 | * @param $events |
||
38 | * @param $eventSettings |
||
39 | * @param $isRootLevel |
||
40 | * @param LeadEventLog[] $logs |
||
41 | */ |
||
42 | public function __construct($lead, $decisionType, $decisionEventDetails, $events, $eventSettings, $isRootLevel = false, $logs = []) |
||
43 | { |
||
44 | $this->lead = $lead; |
||
45 | $this->decisionType = $decisionType; |
||
46 | $this->decisionEventDetails = $decisionEventDetails; |
||
47 | $this->events = $events; |
||
48 | $this->eventSettings = $eventSettings; |
||
49 | $this->isRootLevel = $isRootLevel; |
||
50 | $this->logs = $logs; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return mixed |
||
55 | */ |
||
56 | public function getLead() |
||
57 | { |
||
58 | return $this->lead; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function getEvents() |
||
65 | { |
||
66 | return $this->events; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return mixed |
||
71 | */ |
||
72 | public function getDecisionType() |
||
73 | { |
||
74 | return $this->decisionType; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function getDecisionEventDetails() |
||
81 | { |
||
82 | return $this->decisionEventDetails; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @param null $eventType |
||
87 | * @param null $type |
||
88 | * |
||
89 | * @return bool |
||
90 | */ |
||
91 | public function getEventSettings($eventType = null, $type = null) |
||
92 | { |
||
93 | if ($type) { |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
94 | return (!empty($this->eventSettings[$eventType][$type])) ? $this->eventSettings[$eventType][$type] : false; |
||
95 | } elseif ($eventType) { |
||
0 ignored issues
–
show
|
|||
96 | return (!empty($this->eventSettings[$eventType])) ? $this->eventSettings[$eventType] : false; |
||
97 | } |
||
98 | |||
99 | return $this->eventSettings; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Is the decision used as a root level event? |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | public function isRootLevel() |
||
108 | { |
||
109 | return $this->isRootLevel; |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * Set if the decision has already been triggered and if so, child events will be executed. |
||
114 | * |
||
115 | * @param bool|true $triggered |
||
116 | */ |
||
117 | public function setDecisionAlreadyTriggered($triggered = true) |
||
118 | { |
||
119 | $this->decisionTriggered = $triggered; |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * Returns if the decision has already been triggered. |
||
124 | * |
||
125 | * @return mixed |
||
126 | */ |
||
127 | public function wasDecisionTriggered() |
||
128 | { |
||
129 | return $this->decisionTriggered; |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * @return array|LeadEventLog[] |
||
134 | */ |
||
135 | public function getLogs() |
||
136 | { |
||
137 | return $this->logs; |
||
138 | } |
||
139 | } |
||
140 |