API/library/Config.php

44 lines
711 B
PHP
Raw Normal View History

<?php
namespace Shikiryu\LBCReposter;
class Config
{
protected $data = [];
/**
* Config constructor.
* @param array $data
*/
public function __construct(array $data = [])
{
$this->parseData($data);
}
/**
* @param string $name
*
* @return string
*/
public function __get($name)
{
return $this->data[$name];
}
/**
* @param array $data
*/
private function parseData(array $data)
{
foreach ($data as $name => $item) {
if (is_array($item)) {
$this->parseData($item);
} else {
$this->data[$name] = $item;
}
}
}
}