* Create JobOptions from an associative array. * * @param array $options */
(array $options)
| 108 | * @param array<string, mixed> $options |
| 109 | */ |
| 110 | public static function fromArray(array $options): self |
| 111 | { |
| 112 | $instance = new self(); |
| 113 | |
| 114 | if (isset($options['jobId'])) { |
| 115 | $instance->jobId = (string) $options['jobId']; |
| 116 | } |
| 117 | if (isset($options['timestamp'])) { |
| 118 | $instance->timestamp = (int) $options['timestamp']; |
| 119 | } |
| 120 | if (isset($options['delay'])) { |
| 121 | $instance->delay = (int) $options['delay']; |
| 122 | } |
| 123 | if (isset($options['attempts'])) { |
| 124 | $instance->attempts = (int) $options['attempts']; |
| 125 | } |
| 126 | if (isset($options['backoff'])) { |
| 127 | $instance->backoff = $options['backoff']; |
| 128 | } |
| 129 | if (isset($options['removeOnComplete'])) { |
| 130 | $instance->removeOnComplete = $options['removeOnComplete']; |
| 131 | } |
| 132 | if (isset($options['removeOnFail'])) { |
| 133 | $instance->removeOnFail = $options['removeOnFail']; |
| 134 | } |
| 135 | if (isset($options['priority'])) { |
| 136 | $instance->priority = (int) $options['priority']; |
| 137 | } |
| 138 | if (isset($options['lifo'])) { |
| 139 | $instance->lifo = (bool) $options['lifo']; |
| 140 | } |
| 141 | if (isset($options['stackTraceLimit'])) { |
| 142 | $instance->stackTraceLimit = (int) $options['stackTraceLimit']; |
| 143 | } |
| 144 | if (isset($options['failParentOnFailure'])) { |
| 145 | $instance->failParentOnFailure = (bool) $options['failParentOnFailure']; |
| 146 | } |
| 147 | if (isset($options['continueParentOnFailure'])) { |
| 148 | $instance->continueParentOnFailure = (bool) $options['continueParentOnFailure']; |
| 149 | } |
| 150 | if (isset($options['removeDependencyOnFailure'])) { |
| 151 | $instance->removeDependencyOnFailure = (bool) $options['removeDependencyOnFailure']; |
| 152 | } |
| 153 | if (isset($options['keepLogs'])) { |
| 154 | $instance->keepLogs = (int) $options['keepLogs']; |
| 155 | } |
| 156 | if (isset($options['parent'])) { |
| 157 | $instance->parent = $options['parent']; |
| 158 | } |
| 159 | if (isset($options['deduplication'])) { |
| 160 | $instance->deduplication = $options['deduplication']; |
| 161 | } |
| 162 | |
| 163 | return $instance; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Convert to an associative array. |
no outgoing calls