Dependencies
This commit is contained in:
31
aldarien/config/app/Contract/Config.php
Normal file
31
aldarien/config/app/Contract/Config.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace App\Contract;
|
||||
|
||||
use App\Definition\Contract;
|
||||
use App\Service\Config AS ConfigService;
|
||||
|
||||
class Config
|
||||
{
|
||||
use Contract;
|
||||
|
||||
protected static function newInstance()
|
||||
{
|
||||
return new ConfigService();
|
||||
}
|
||||
public static function get($name = null)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
return $instance->get($name);
|
||||
}
|
||||
public static function set($name, $value)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
return $instance->set($name, $value);
|
||||
}
|
||||
public static function addFile($filename)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
return $instance->loadFile($filename);
|
||||
}
|
||||
}
|
||||
?>
|
21
aldarien/config/app/Contract/YamlWrapper.php
Normal file
21
aldarien/config/app/Contract/YamlWrapper.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace App\Contract;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class YamlWrapper
|
||||
{
|
||||
public static function load($filename, $flags = 0)
|
||||
{
|
||||
return self::parse(file_get_contents($filename), $flags);
|
||||
}
|
||||
public static function parse($input, $flags = 0)
|
||||
{
|
||||
return Yaml::parse($input, $flags);
|
||||
}
|
||||
public static function dump($array, $inline = 2, $indent = 4, $flags = 0)
|
||||
{
|
||||
return Yaml::dump($array, $inline, $indent, $flags);
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user