| Server IP : 185.143.234.238 / Your IP : 185.215.232.195 Web Server : LiteSpeed System : Linux saman.shetabanhost.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : behrakir ( 1361) PHP Version : 8.1.34 Disable Function : symlink,shell_exec,show_source,exec,popen,system,passthru,proc_open,proc_close,pcntl_exec,mail MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/behrakir/khanomam.com/wp-content/plugins/sync-basalam/includes/Jobs/ |
Upload File : |
<?php
namespace SyncBasalam\Jobs;
use SyncBasalam\Jobs\Exceptions\JobException;
defined('ABSPATH') || exit;
class JobResult
{
private $success;
private $exception;
private $data;
private function __construct(bool $success, $exception = null, array $data = [])
{
$this->success = $success;
$this->exception = $exception;
$this->data = $data;
}
public static function success(array $data = []): self
{
return new self(true, null, $data);
}
public static function failed(JobException $exception, array $data = []): self
{
return new self(false, $exception, $data);
}
public function isSuccessful(): bool
{
return $this->success;
}
public function shouldRetry(): bool
{
return !$this->success && $this->exception && $this->exception->shouldRetry();
}
public function getException(): ?JobException
{
return $this->exception;
}
public function getData(): array
{
return $this->data;
}
public function getErrorMessage(): ?string
{
return $this->exception ? $this->exception->getMessage() : null;
}
public function getErrorContext(): array
{
return $this->exception ? $this->exception->getErrorContext() : [];
}
}