X

Create New Item

File Folder

X

Search Results

File "DefaultValue.php"

Full path: /home/orbitecv/orbite-school.orbit.et/vendor/kreait/firebase-php/src/Firebase/RemoteConfig/DefaultValue.php
File size: 1.1 KiB (1127 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Edit   Back

<?php

declare(strict_types=1);

namespace Kreait\Firebase\RemoteConfig;

use JsonSerializable;

/**
 * @phpstan-import-type RemoteConfigParameterValueShape from ParameterValue
 *
 * @todo Deprecate/Remove in 8.0
 *
 * @see ParameterValue
 */
class DefaultValue implements JsonSerializable
{
    private function __construct(private readonly ParameterValue $value)
    {
    }

    public static function useInAppDefault(): self
    {
        return new self(ParameterValue::inAppDefault());
    }

    public static function with(string $value): self
    {
        return new self(ParameterValue::withValue($value));
    }

    /**
     * @param RemoteConfigParameterValueShape $data
     */
    public static function fromArray(array $data): self
    {
        return new self(ParameterValue::fromArray($data));
    }

    /**
     * @return RemoteConfigParameterValueShape
     */
    public function toArray(): array
    {
        return $this->value->toArray();
    }

    /**
     * @return RemoteConfigParameterValueShape
     */
    public function jsonSerialize(): array
    {
        return $this->toArray();
    }
}