HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/demo.sports-crowd.com/vendor/dnetix/redirection/src/Entities/Status.php
<?php

namespace Dnetix\Redirection\Entities;

use Dnetix\Redirection\Contracts\Entity;

class Status extends Entity
{
    public const ST_OK = 'OK';
    public const ST_FAILED = 'FAILED';
    public const ST_APPROVED = 'APPROVED';
    public const ST_APPROVED_PARTIAL = 'APPROVED_PARTIAL';
    public const ST_REJECTED = 'REJECTED';
    public const ST_PENDING = 'PENDING';
    public const ST_PENDING_VALIDATION = 'PENDING_VALIDATION';
    public const ST_REFUNDED = 'REFUNDED';
    public const ST_ERROR = 'ERROR';
    public const ST_UNKNOWN = 'UNKNOWN';

    protected string $status;
    protected string $reason;
    protected string $message = '';
    protected string $date = '';

    protected static array $STATUSES = [
        self::ST_OK,
        self::ST_FAILED,
        self::ST_APPROVED,
        self::ST_APPROVED_PARTIAL,
        self::ST_REJECTED,
        self::ST_PENDING,
        self::ST_PENDING_VALIDATION,
        self::ST_REFUNDED,
        self::ST_ERROR,
        self::ST_UNKNOWN,
    ];

    public function __construct(array $data)
    {
        $this->load($data, ['status', 'reason', 'message', 'date']);
    }

    public function status(): string
    {
        return $this->status ?? self::ST_ERROR;
    }

    public function reason(): string
    {
        return $this->reason;
    }

    public function message(): string
    {
        return $this->message;
    }

    public function date(): string
    {
        return $this->date;
    }

    public function isSuccessful(): bool
    {
        return $this->status() == self::ST_OK;
    }

    public function isApproved(): bool
    {
        return $this->status() == self::ST_APPROVED;
    }

    public function isRejected(): bool
    {
        return $this->status() == self::ST_REJECTED;
    }

    public function isError(): bool
    {
        return $this->status() == self::ST_ERROR;
    }

    public function toArray(): array
    {
        return [
            'status' => $this->status(),
            'reason' => $this->reason(),
            'message' => $this->message(),
            'date' => $this->date(),
        ];
    }

    public static function quick(string $status, string $reason, string $message = '', string $date = ''): self
    {
        return new self([
            'status' => $status,
            'reason' => $reason,
            'message' => $message,
            'date' => $date ?: date('c'),
        ]);
    }
}