CoreFiles by mySites.guru
Message.php70 lines, 1,432 bytes, from Joomla_6.2.1-Stable-Full_Package.zip
Raw History Compare with 6.2.0
md5
a3805719b4ae9f0be1c32cffec0c40ce
sha1
9a8895cf20285c2baa594daca2c99edea9e80a87
sha256
6073de0b8d7606aa281294b94ad1f215c1e096b18fcd53dc6a5675ce12ab2cd0
<?php

declare(strict_types=1);

namespace Jose\Component\KeyManagement\Analyzer;

use JsonSerializable;

class Message implements JsonSerializable
{
    final public const SEVERITY_LOW = 'low';

    final public const SEVERITY_MEDIUM = 'medium';

    final public const SEVERITY_HIGH = 'high';

    private function __construct(
        private readonly string $message,
        private readonly string $severity
    ) {
    }

    /**
     * Creates a message with severity=low.
     */
    public static function low(string $message): self
    {
        return new self($message, self::SEVERITY_LOW);
    }

    /**
     * Creates a message with severity=medium.
     */
    public static function medium(string $message): self
    {
        return new self($message, self::SEVERITY_MEDIUM);
    }

    /**
     * Creates a message with severity=high.
     */
    public static function high(string $message): self
    {
        return new self($message, self::SEVERITY_HIGH);
    }

    /**
     * Returns the message.
     */
    public function getMessage(): string
    {
        return $this->message;
    }

    /**
     * Returns the severity of the message.
     */
    public function getSeverity(): string
    {
        return $this->severity;
    }

    public function jsonSerialize(): array
    {
        return [
            'message' => $this->message,
            'severity' => $this->severity,
        ];
    }
}

The same content is in 135 releases, Joomla 5.1.0-beta1 to 6.2.1. See them all, or every version of this file.