# sync-basalam/1.10.7/includes/Jobs/JobResult.php

ووسلام – همگام سازی ووکامرس و باسلام, version 1.10.7. 62 lines.

- Page: https://pluginprobe.com/plugins/sync-basalam/1.10.7/code/includes/Jobs/JobResult.php
- Raw: https://pluginprobe.com/plugins/sync-basalam/1.10.7/raw/includes/Jobs/JobResult.php
- Modified: 2026-08-11T19:30:02+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/sync-basalam/1.10.7/code/includes/Jobs/JobResult.php#L10-L20`.

```php
<?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() : [];
    }
}

```
