h=UP >XA`A`Ap A@&A(@(@xZ|&A&AA8AX\@X\@^A^A9@ %A?@@@!A!A d&A d&AXA؀@؀@h&Ah @&A&A^A^A %APG!APG!A!A!A%ApA @C@C@&A(%A(%A{@y@y@P&AP&A\&A\&A%A`@`@(@(\A(\A &Ap&A(@7A%AD@C&AC&A0[&AX[&A[&A6@!A!AHA!AHA!A@HA!A@HA!AHA!A@^A^A!A8A8A@%A@%AF AF AAAAA!A&A&A&A&AF AF AAAHA؉!AHA؉!Ay@y@!A!Ay@y@HA؉!AHAP!AHAP!AHAHC@X5&AX5&Ap>&A8&A@ AxAp AP>@w&A<HA@!A`E=U return $this->args_hash; } /** * Gets the task's data. * * @since 0.0.1 * * @return string The task's data. */ public function get_data(): string { return $this->data; } /** * Gets the task's current try. * * @since 0.0.1 * * @return int The task's current try. */ public function get_current_try(): int { return $this->current_try; } /** * Gets the task's arguments. * * @since 0.0.1 * * @return array The task's arguments. */ public function get_args(): array { return $this->args; } /** * Gets the table interface for the task. * * @since 0.0.1 * * @return Table_Abstract The table interface. */ public function get_table_interface(): Table_Abstract { return Config::get_container()->get(static::TABLE_INTERFACE); } /** * Saves the task. * * @since 0.0.1 * * @return int The id of the saved task. * * @throws ShepherdTaskAlreadyExistsException If multiple tasks are found with the same arguments hash. * @throws RuntimeException If multiple tasks are found with the same arguments hash. */ public function save(): int { $task_id = parent::save(); $table_interface = Config::get_container()->get(static::TABLE_INTERFACE); $tasks = $table_interface::get_by_args_hash($this->get_args_hash()); if (count($tasks) === 1) { return $task_id; } $action_ids = array_map(fn(Task $task) => $task->get_action_id(), $tasks); $number_of_actions = count($action_ids); $number_of_unique_actions = count(array_unique($action_ids)); if ($number_of_actions !== $number_of_unique_actions) { throw new ShepherdTaskAlreadyExistsException('Multiple tasks found with the same arguments hash.'); } $pending_actions = Action_Scheduler_Methods::get_pending_actions_by_ids($action_ids); if (count($pending_actions) > 1) { throw new RuntimeException('Multiple tasks found with the same arguments hash.'); } return $task_id; } }