JFIF  x x C         C     "        } !1AQa "q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz        w !1AQ aq"2B #3Rbr{ gilour

File "VersionNumber.php"

Full Path: /home/palsarh/web/palsarh.in/public_html/vendor/kreait/firebase-php/src/Firebase/RemoteConfig/VersionNumber.php
File size: 1.05 KB
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

namespace Kreait\Firebase\RemoteConfig;

use JsonSerializable;
use Kreait\Firebase\Exception\InvalidArgumentException;
use Stringable;

use function ctype_digit;

final class VersionNumber implements JsonSerializable, Stringable
{
    /**
     * @param non-empty-string $value
     */
    private function __construct(private readonly string $value)
    {
    }

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

    public static function fromValue($value): self
    {
        $valueString = (string) $value;

        if (!ctype_digit($valueString)) {
            throw new InvalidArgumentException('A version number should only consist of digits');
        }

        return new self($valueString);
    }

    /**
     * @return non-empty-string
     */
    public function jsonSerialize(): string
    {
        return $this->value;
    }

    /**
     * @param self|non-empty-string $other
     */
    public function equalsTo($other): bool
    {
        return $this->value === (string) $other;
    }
}