# notifier/2.7.5/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php

WANotifier for Forms and Actions, version 2.7.5. 48 lines.

- Page: https://pluginprobe.com/plugins/notifier/2.7.5/code/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php
- Raw: https://pluginprobe.com/plugins/notifier/2.7.5/raw/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php
- Modified: 2025-04-03T10:32:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/notifier/2.7.5/code/libraries/action-scheduler/classes/ActionScheduler_InvalidActionException.php#L10-L20`.

```php
<?php

/**
 * InvalidAction Exception.
 *
 * Used for identifying actions that are invalid in some way.
 *
 * @package ActionScheduler
 */
class ActionScheduler_InvalidActionException extends \InvalidArgumentException implements ActionScheduler_Exception {

	/**
	 * Create a new exception when the action's schedule cannot be fetched.
	 *
	 * @param string $action_id The action ID with bad args.
	 * @return static
	 */
	public static function from_schedule( $action_id, $schedule ) {
		$message = sprintf(
			/* translators: 1: action ID 2: schedule */
			__( 'Action [%1$s] has an invalid schedule: %2$s', 'action-scheduler' ),
			$action_id,
			var_export( $schedule, true )
		);

		return new static( $message );
	}

	/**
	 * Create a new exception when the action's args cannot be decoded to an array.
	 *
	 * @author Jeremy Pry
	 *
	 * @param string $action_id The action ID with bad args.
	 * @return static
	 */
	public static function from_decoding_args( $action_id, $args = array() ) {
		$message = sprintf(
			/* translators: 1: action ID 2: arguments */
			__( 'Action [%1$s] has invalid arguments. It cannot be JSON decoded to an array. $args = %2$s', 'action-scheduler' ),
			$action_id,
			var_export( $args, true )
		);

		return new static( $message );
	}
}

```
