You are here

protected function Job::assertState in Advanced Queue 8

Asserts that the given job state is valid.

Parameters

string $state: The job state, a Job::STATE_ constant.

Throws

\InvalidArgumentException Thrown if the job state is invalid.

2 calls to Job::assertState()
Job::setState in src/Job.php
Sets the job state.
Job::__construct in src/Job.php
Constructs a new Job object.

File

src/Job.php, line 143

Class

Job
Represents a job.

Namespace

Drupal\advancedqueue

Code

protected function assertState($state) {
  $states = [
    self::STATE_QUEUED,
    self::STATE_PROCESSING,
    self::STATE_SUCCESS,
    self::STATE_FAILURE,
  ];
  if (!in_array($state, $states)) {
    throw new \InvalidArgumentException(sprintf('Invalid state "%s" given.', $state));
  }
}