This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
rangitaki/res/php/Config.php
2016-04-17 17:00:18 +02:00

58 lines
1.2 KiB
PHP

<?php
/**
* PHP Version 7
*
* Configuration parser for yaml configuration files
*
* @category Configuration
* @package Rbe
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*/
namespace mmk2410\rbe\config;
/**
* PHP Version 7
*
* Configuration parser for yaml configuration files
*
* @category Configuration
* @package Rbe
* @author Marcel Kapfer (mmk2410) <marcelmichaelkapfer@yahoo.co.nz>
* @license MIT License
* @link http://marcel-kapfer.de/rangitaki
*/
class Config
{
/**
* Path to yaml file
* @var string
*/
private $file;
/**
* Constructor for the Config class
*
* @param $config path to the yaml file
* @param $composer path to the composer autoload
*/
public function __construct($config, $composer)
{
$this->file = $config;
require $composer;
}
/**
* Return yaml config as PHP array
*
* @return config array
*/
public function getConfig()
{
$yaml = new \Symfony\Component\Yaml\Parser();
return $yaml->parse(file_get_contents($this->file));
}
}