Async_Event::interval()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Abstract class for Async_Events
7
 *
8
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
10
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
11
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
12
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
15
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
18
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19
 *
20
 * @author Glynn Quelch <[email protected]>
21
 * @license http://www.opensource.org/licenses/mit-license.html  MIT License
22
 * @package PinkCrab\Queue
23
 * @since 0.1.0
24
 */
25
26
namespace PinkCrab\Queue\Event;
27
28
use DateTimeImmutable;
29
30
abstract class Async_Event implements Event {
31
32
	/**
33
	 * The event name (Hook)
34
	 *
35
	 * @var string
36
	 */
37
	protected $hook;
38
39
	/**
40
	 * The queue group it belongs to
41
	 *
42
	 * @var string
43
	 */
44
	protected $group = '';
45
46
	/**
47
	 * The data to be passed to the event
48
	 *
49
	 * @var mixed[]|null
50
	 */
51
	protected $data = array();
52
53
	/**
54
	 * Denotes if the event is unique or not
55
	 *
56
	 * @var bool
57
	 */
58
	protected $is_unique = false;
59
60
	/**
61
	 * Get the group for the event.
62
	 *
63
	 * @return string
64
	 */
65
	public function get_group(): string {
66
		return $this->group;
67
	}
68
69
	/**
70
	 * Get the hook for the event.
71
	 *
72
	 * @return string
73
	 */
74
	public function get_hook(): string {
75
		return $this->hook;
76
	}
77
78
	/**
79
	 * Get the data for the event.
80
	 *
81
	 * @return mixed[]|null
82
	 */
83
	public function get_data(): ?array {
84
		return $this->data;
85
	}
86
87
	/**
88
	 * Gets the delayed until date/time for the event.
89
	 *
90
	 * @return \DateTimeImmutable|null
91
	 */
92
	final public function delayed_until(): ?DateTimeImmutable {
93
		return null;
94
	}
95
96
	/**
97
	 * Gets the interval between recurring events.
98
	 *
99
	 * @return int|null
100
	 */
101
	final public function interval(): ?int {
102
		return null;
103
	}
104
105
	/**
106
	 * Is the event unique?
107
	 *
108
	 * @return bool
109
	 */
110
	public function is_unique(): bool {
111
		return $this->is_unique;
112
	}
113
}
114