PHP Classes

File: src/Config.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   Halite   src/Config.php   Download  
File: src/Config.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Halite
Perform cryptography operations with libsodium
Author: By
Last change: For version 2, let's use strict types!
Date: 8 years ago
Size: 872 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);
namespace
ParagonIE\Halite;

use
ParagonIE\Halite\Alerts as CryptoException;

/**
 * Encapsulates the configuration for a specific version of Halite
 */
class Config
{
    private
$config;
   
    public function
__construct(array $set = [])
    {
       
$this->config = $set;
    }
   
   
/**
     * Getter
     *
     * @param string $key
     * @return mixed
     * @throws CryptoException\ConfigDirectiveNotFound
     */
   
public function __get(string $key)
    {
        if (\
array_key_exists($key, $this->config)) {
            return
$this->config[$key];
        }
        throw new
CryptoException\ConfigDirectiveNotFound($key);
    }
   
   
/**
     * Setter (NOP)
     *
     * @param mixed $key
     * @param mixed $value
     */
   
public function __set(string $key, $value = null)
    {
        return
false;
    }
}