PluginProbe
Packeta / trunk
Packeta vtrunk
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Module / Framework / ActionSchedulerTrait.php

ActionSchedulerTrait.php in Packeta trunk, at src/Packetery/Module/Framework/ActionSchedulerTrait.php

43 lines 910 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class ActionSchedulerTrait.
4 *
5 * @package Packetery
6 */
7
8 declare( strict_types=1 );
9
10 namespace Packetery\Module\Framework;
11
12 /**
13 * Class ActionSchedulerTrait.
14 *
15 * @package Packetery
16 */
17 trait ActionSchedulerTrait {
18 /**
19 * Schedule an action to run one time.
20 *
21 * @param int $timestamp Timestamp.
22 * @param string $hook Hook.
23 * @param array $args Arguments.
24 *
25 * @return void
26 */
27 public function asScheduleSingleAction( int $timestamp, string $hook, array $args = [] ): void {
28 as_schedule_single_action( $timestamp, $hook, $args );
29 }
30
31 /**
32 * @param string $hook
33 * @param array<array-key, mixed> $args
34 */
35 public function asEnqueueAsyncAction( string $hook, array $args = [] ): void {
36 as_enqueue_async_action( $hook, $args );
37 }
38
39 public function isActionSchedulerEnqueueAvailable(): bool {
40 return function_exists( 'as_enqueue_async_action' );
41 }
42 }
43