1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 
<?php
/**
 * Copyright (C) Marcelle Hövelmanns, art solution - All Rights Reserved
 *
 * @file   Config.php
 * @author Marcelle Hövelmanns
 * @site   http://www.artsolution.de
 * @date   29.10.17
 */

namespace AffiliconApiClient\Services;


use AffiliconApiClient\Exceptions\ConfigurationInvalid;

/**
 * Class ConfigService
 * @package AffiliconApiClient\Services
 */
class ConfigService
{
    protected $data;

    public function __construct()
    {
        try {

            $global = include __DIR__ . "/../config/config.php";
            $routes = include __DIR__ . "/../config/routes.php";

        } catch (\Exception $e) {

            throw new ConfigurationInvalid('configuration is missing or invalid');

        }

        $this->data = array_merge($global, $routes);
    }

    /**
     * @param $key
     * @return array|string
     */
    public function get($key)
    {
        $config = array_get($this->data, $key);

        return $config;
    }

}