← All changes
|
vendor/woocommerce/action-scheduler/classes/actions/ActionScheduler_Action.php
+37
-12
1.5.3
→
trunk
View file →
| @@ -3,15 +3,34 @@ | ||
| 3 | 3 | /** |
| 4 | 4 | * Class ActionScheduler_Action |
| 5 | 5 | */ |
| 6 | 6 | class ActionScheduler_Action { |
| 7 | - /** @var string */ | |
| 7 | + /** | |
| 8 | + * Action's hook. | |
| 9 | + * | |
| 10 | + * @var string | |
| 11 | + */ | |
| 8 | 12 | protected $hook = ''; |
| 9 | - /** @var array<string, mixed> */ | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * Action's args. | |
| 16 | + * | |
| 17 | + * @var array<string, mixed> | |
| 18 | + */ | |
| 10 | 19 | protected $args = array(); |
| 11 | - /** @var ActionScheduler_Schedule */ | |
| 12 | - protected $schedule = NULL; | |
| 13 | - /** @var string */ | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * Action's schedule. | |
| 23 | + * | |
| 24 | + * @var ActionScheduler_Schedule | |
| 25 | + */ | |
| 26 | + protected $schedule = null; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * Action's group. | |
| 30 | + * | |
| 31 | + * @var string | |
| 32 | + */ | |
| 14 | 33 | protected $group = ''; |
| 15 | 34 | |
| 16 | 35 | /** |
| 17 | 36 | * Priorities are conceptually similar to those used for regular WordPress actions. |
| @@ -33,14 +52,14 @@ | ||
| 33 | 52 | * @param mixed[] $args Action's arguments. |
| 34 | 53 | * @param null|ActionScheduler_Schedule $schedule Action's schedule. |
| 35 | 54 | * @param string $group Action's group. |
| 36 | 55 | */ |
| 37 | - public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) { | |
| 56 | + public function __construct( $hook, array $args = array(), ?ActionScheduler_Schedule $schedule = null, $group = '' ) { | |
| 38 | 57 | $schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule; |
| 39 | - $this->set_hook($hook); | |
| 40 | - $this->set_schedule($schedule); | |
| 41 | - $this->set_args($args); | |
| 42 | - $this->set_group($group); | |
| 58 | + $this->set_hook( $hook ); | |
| 59 | + $this->set_schedule( $schedule ); | |
| 60 | + $this->set_args( $args ); | |
| 61 | + $this->set_group( $group ); | |
| 43 | 62 | } |
| 44 | 63 | |
| 45 | 64 | /** |
| 46 | 65 | * Executes the action. |
| @@ -92,8 +111,10 @@ | ||
| 92 | 111 | $this->schedule = $schedule; |
| 93 | 112 | } |
| 94 | 113 | |
| 95 | 114 | /** |
| 115 | + * Action's schedule. | |
| 116 | + * | |
| 96 | 117 | * @return ActionScheduler_Schedule |
| 97 | 118 | */ |
| 98 | 119 | public function get_schedule() { |
| 99 | 120 | return $this->schedule; |
| @@ -124,8 +145,10 @@ | ||
| 124 | 145 | $this->group = $group; |
| 125 | 146 | } |
| 126 | 147 | |
| 127 | 148 | /** |
| 149 | + * Action's group. | |
| 150 | + * | |
| 128 | 151 | * @return string |
| 129 | 152 | */ |
| 130 | 153 | public function get_group() { |
| 131 | 154 | return $this->group; |
| @@ -131,12 +154,14 @@ | ||
| 131 | 154 | return $this->group; |
| 132 | 155 | } |
| 133 | 156 | |
| 134 | 157 | /** |
| 135 | - * @return bool If the action has been finished | |
| 158 | + * Action has not finished. | |
| 159 | + * | |
| 160 | + * @return bool | |
| 136 | 161 | */ |
| 137 | 162 | public function is_finished() { |
| 138 | - return FALSE; | |
| 163 | + return false; | |
| 139 | 164 | } |
| 140 | 165 | |
| 141 | 166 | /** |
| 142 | 167 | * Sets the priority of the action. |