Passed
Push — master ( 79ff33...925332 )
by Glynn
07:58 queued 05:49
created
src/Queue_Driver/Queue.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 	 * @param Event $event
58 58
 	 * @return int|null
59 59
 	 */
60
-	public function dispatch( Event $event ): ?int;
60
+	public function dispatch(Event $event): ?int;
61 61
 
62 62
 	/**
63 63
 	 * Cancel next occurrence of Event
64 64
 	 *
65 65
 	 * @param Event $event
66 66
 	 */
67
-	public function cancel_next( Event $event ): void;
67
+	public function cancel_next(Event $event): void;
68 68
 
69 69
 	/**
70 70
 	 * Cancel all occurrences of Event
71 71
 	 *
72 72
 	 * @param Event $event
73 73
 	 */
74
-	public function cancel_all( Event $event ): void;
74
+	public function cancel_all(Event $event): void;
75 75
 
76 76
 	/**
77 77
 	 * Get next occurrence of Event
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @param Event $event
80 80
 	 * @return DateTimeImmutable|null
81 81
 	 */
82
-	public function find_next( Event $event ): ?DateTimeImmutable;
82
+	public function find_next(Event $event): ?DateTimeImmutable;
83 83
 
84 84
 	/**
85 85
 	 * Get all occurrences of Event
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param Event $event
88 88
 	 * @return DateTimeImmutable[]
89 89
 	 */
90
-	public function find_all( Event $event ): array;
90
+	public function find_all(Event $event): array;
91 91
 
92 92
 
93 93
 	/**
@@ -96,5 +96,5 @@  discard block
 block discarded – undo
96 96
 	 * @param Event $event
97 97
 	 * @return bool
98 98
 	 */
99
-	public function is_scheduled( Event $event ): bool;
99
+	public function is_scheduled(Event $event): bool;
100 100
 }
Please login to merge, or discard this patch.
src/Queue_Driver/Action_Scheduler/Action_Scheduler_Dispatcher.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 
109 109
 		/**
110
- * @var DateTimeImmutable
110
+		 * @var DateTimeImmutable
111 111
 */
112 112
 		$delayed_until = $event->delayed_until();
113 113
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 
134 134
 		/**
135
- * @var DateTimeImmutable
135
+		 * @var DateTimeImmutable
136 136
 */
137 137
 		$delayed_until = $event->delayed_until() instanceof \DateTimeImmutable
138 138
 			? $event->delayed_until()->setTimezone( wp_timezone() )
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	 * @param Event $event
40 40
 	 * @return integer|null Returns the event id.
41 41
 	 */
42
-	public function dispatch( Event $event ): ?int {
42
+	public function dispatch(Event $event): ?int {
43 43
 		// @phpstan-ignore-next-line
44
-		$queue_id = \call_user_func( array( $this, $this->get_dispatch_type( $event ) ), $event );
45
-		return \is_int( $queue_id ) ? $queue_id : null;
44
+		$queue_id = \call_user_func(array($this, $this->get_dispatch_type($event)), $event);
45
+		return \is_int($queue_id) ? $queue_id : null;
46 46
 	}
47 47
 
48 48
 	/**
@@ -51,33 +51,33 @@  discard block
 block discarded – undo
51 51
 	 * @param Event $event
52 52
 	 * @return string
53 53
 	 */
54
-	private function get_dispatch_type( Event $event ): string {
54
+	private function get_dispatch_type(Event $event): string {
55 55
 		// If the event is async or there is no delay or interval.
56
-		if ( $event instanceof Async_Event
57
-		|| ( is_null( $event->delayed_until() ) && is_null( $event->interval() ) )
56
+		if ($event instanceof Async_Event
57
+		|| (is_null($event->delayed_until()) && is_null($event->interval()))
58 58
 		) {
59 59
 			// Return async.
60 60
 			return 'dispatch_async';
61 61
 		}
62 62
 
63 63
 		// If the event is delayed or has no interval.
64
-		if ( $event instanceof Delayed_Event
65
-		|| ( $event->delayed_until() instanceof DateTimeImmutable && is_null( $event->interval() ) )
64
+		if ($event instanceof Delayed_Event
65
+		|| ($event->delayed_until() instanceof DateTimeImmutable && is_null($event->interval()))
66 66
 		) {
67 67
 			// Return delayed.
68 68
 			return 'dispatch_at';
69 69
 		}
70 70
 
71 71
 		// If the event is a recurring event and has an interval.
72
-		if ( $event instanceof Recurring_Event
73
-		|| ( is_int( $event->interval() ) && $event->interval() > 0 )
72
+		if ($event instanceof Recurring_Event
73
+		|| (is_int($event->interval()) && $event->interval() > 0)
74 74
 		) {
75 75
 			// Return recurring.
76 76
 			return 'dispatch_recurring';
77 77
 		}
78 78
 
79 79
 		// If we get to the end and none has passed, throw exception.
80
-		throw new \Exception( 'Unable to determine dispatch type.' );
80
+		throw new \Exception('Unable to determine dispatch type.');
81 81
 	}
82 82
 
83 83
 	/**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @param Event $event
87 87
 	 * @return integer Returns the event id.
88 88
 	 */
89
-	private function dispatch_async( Event $event ): int {
89
+	private function dispatch_async(Event $event): int {
90 90
 		return \as_enqueue_async_action(
91 91
 			$event->get_hook(),
92 92
 			$event->get_data() ?? array(),
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param Event $event
102 102
 	 * @return integer Returns the event id.
103 103
 	 */
104
-	private function dispatch_at( Event $event ): int {
105
-		if ( ! $event->delayed_until() instanceof DateTimeImmutable ) {
106
-			throw new \InvalidArgumentException( 'Event must have a delayed_until date/time.' );
104
+	private function dispatch_at(Event $event): int {
105
+		if ( ! $event->delayed_until() instanceof DateTimeImmutable) {
106
+			throw new \InvalidArgumentException('Event must have a delayed_until date/time.');
107 107
 		}
108 108
 
109 109
 		/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		$delayed_until = $event->delayed_until();
113 113
 
114 114
 		return as_schedule_single_action(
115
-			(int) $delayed_until->setTimezone( wp_timezone() )->format( 'U' ),
115
+			(int) $delayed_until->setTimezone(wp_timezone())->format('U'),
116 116
 			$event->get_hook(),
117 117
 			$event->get_data() ?? array(),
118 118
 			$event->get_group(),
@@ -126,20 +126,20 @@  discard block
 block discarded – undo
126 126
 	 * @param Event $event
127 127
 	 * @return integer Returns the event id.
128 128
 	 */
129
-	private function dispatch_recurring( Event $event ): int {
130
-		if ( $event->interval() === null ) {
131
-			throw new \InvalidArgumentException( 'Event must have an for it to be recurring.' );
129
+	private function dispatch_recurring(Event $event): int {
130
+		if ($event->interval() === null) {
131
+			throw new \InvalidArgumentException('Event must have an for it to be recurring.');
132 132
 		}
133 133
 
134 134
 		/**
135 135
  * @var DateTimeImmutable
136 136
 */
137 137
 		$delayed_until = $event->delayed_until() instanceof \DateTimeImmutable
138
-			? $event->delayed_until()->setTimezone( wp_timezone() )
139
-			: DateTimeImmutable::createFromFormat( 'U', '0', wp_timezone() );
138
+			? $event->delayed_until()->setTimezone(wp_timezone())
139
+			: DateTimeImmutable::createFromFormat('U', '0', wp_timezone());
140 140
 
141 141
 		return as_schedule_recurring_action(
142
-			(int) $delayed_until->format( 'U' ),
142
+			(int) $delayed_until->format('U'),
143 143
 			$event->interval(),
144 144
 			$event->get_hook(),
145 145
 			$event->get_data() ?? array(),
Please login to merge, or discard this patch.
src/Queue_Driver/Action_Scheduler/Action_Scheduler_Driver.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	/** @var bool */
47 47
 	private static $included = false;
48 48
 
49
-	public function __construct( Action_Scheduler_Dispatcher $dispatcher, Action_Scheduler_Queue_Manager $queue_manager ) {
49
+	public function __construct(Action_Scheduler_Dispatcher $dispatcher, Action_Scheduler_Queue_Manager $queue_manager) {
50 50
 		$this->dispatcher    = $dispatcher;
51 51
 		$this->queue_manager = $queue_manager;
52 52
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function setup(): void {
73 73
 
74 74
 		// If the lib has already been included, bail.
75
-		if ( self::$included ) {
75
+		if (self::$included) {
76 76
 			return;
77 77
 		}
78 78
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$path = join(
81 81
 			\DIRECTORY_SEPARATOR,
82 82
 			array(
83
-				dirname( __DIR__, 3 ),
83
+				dirname(__DIR__, 3),
84 84
 				'lib',
85 85
 				'action-scheduler',
86 86
 				'action-scheduler.php',
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 		);
89 89
 
90 90
 		// Filter the path to the action-scheduler path.
91
-		$path = apply_filters( 'pinkcrab_queue_action_scheduler_path', $path );
91
+		$path = apply_filters('pinkcrab_queue_action_scheduler_path', $path);
92 92
 
93 93
 		// Check if the file exists.
94
-		if ( ! file_exists( $path ) ) {
95
-			throw new \RuntimeException( 'Action Scheduler is not installed.' );
94
+		if ( ! file_exists($path)) {
95
+			throw new \RuntimeException('Action Scheduler is not installed.');
96 96
 		}
97 97
 
98 98
 		// Include the Action Scheduler plugin.
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @param Event $event
129 129
 	 */
130
-	public function dispatch( Event $event ): ?int {
131
-		$result = $this->dispatcher->dispatch( $event );
132
-		return \is_int( $result ) ? $result : null;
130
+	public function dispatch(Event $event): ?int {
131
+		$result = $this->dispatcher->dispatch($event);
132
+		return \is_int($result) ? $result : null;
133 133
 	}
134 134
 
135 135
 	/**
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @param Event $event
139 139
 	 */
140
-	public function cancel_next( Event $event ): void {
141
-		$this->queue_manager->cancel( $event, true );
140
+	public function cancel_next(Event $event): void {
141
+		$this->queue_manager->cancel($event, true);
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param Event $event
148 148
 	 */
149
-	public function cancel_all( Event $event ): void {
150
-		$this->queue_manager->cancel( $event, false );
149
+	public function cancel_all(Event $event): void {
150
+		$this->queue_manager->cancel($event, false);
151 151
 	}
152 152
 
153 153
 	/**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	 * @param Event $event
157 157
 	 * @return DateTimeImmutable|null
158 158
 	 */
159
-	public function find_next( Event $event ): ?DateTimeImmutable {
160
-		return $this->queue_manager->find_next( $event );
159
+	public function find_next(Event $event): ?DateTimeImmutable {
160
+		return $this->queue_manager->find_next($event);
161 161
 	}
162 162
 
163 163
 	/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 * @param Event $event
167 167
 	 * @return DateTimeImmutable[]
168 168
 	 */
169
-	public function find_all( Event $event ): array {
170
-		return $this->queue_manager->find_all( $event );
169
+	public function find_all(Event $event): array {
170
+		return $this->queue_manager->find_all($event);
171 171
 	}
172 172
 
173 173
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param Event $event
178 178
 	 * @return bool
179 179
 	 */
180
-	public function is_scheduled( Event $event ): bool {
181
-		return $this->queue_manager->exists( $event );
180
+	public function is_scheduled(Event $event): bool {
181
+		return $this->queue_manager->exists($event);
182 182
 	}
183 183
 }
Please login to merge, or discard this patch.
src/Listener/Abstract_Listener.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	final public function __invoke(): void {
54 54
 		$args = func_get_args();
55
-		$this->handle( $args );
55
+		$this->handle($args);
56 56
 	}
57 57
 
58 58
 	/**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 * @param \PinkCrab\Loader\Hook_Loader $loader
62 62
 	 * @return void
63 63
 	 */
64
-	final public function register( Hook_Loader $loader ): void {
65
-		$loader->action( $this->hook, $this );
64
+	final public function register(Hook_Loader $loader): void {
65
+		$loader->action($this->hook, $this);
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,5 +71,5 @@  discard block
 block discarded – undo
71 71
 	 * @param mixed[] $args
72 72
 	 * @return void
73 73
 	 */
74
-	abstract protected function handle( array $args ): void;
74
+	abstract protected function handle(array $args): void;
75 75
 }
Please login to merge, or discard this patch.