<?php

namespace Openguru\OpenCartFramework\Config;

use Openguru\OpenCartFramework\Support\Arr;

class Settings
{
    private array $config;

    public function __construct(array $config)
    {
        $this->config = $config;
    }

    public function get(string $key, $default = null)
    {
        return Arr::get($this->getAll(), $key, $default);
    }

    public function has(string $key): bool
    {
        return Arr::get($this->getAll(), $key) !== null;
    }

    public function getAll(): array
    {
        return $this->config;
    }

    public function getHash(): string
    {
        return md5(serialize($this->getAll()));
    }
}
