for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dotor\Loader;
use Dotor\Loader;
class ArrayLoader implements Loader
{
private $config = [];
/**
* @param array $config
* @return ArrayLoader
*/
public static function create($config = [])
$instance = new ArrayLoader();
$instance->load($config);
return $instance;
}
public function load($config = [])
$this->config = $config;
* @param string $path
public static function createFromFile($path)
$instance->loadFromFile($path);
* @throws Exception\FileNotReturnAnArrayException
* @throws Exception\FileIsNotReadableException
public function loadFromFile($path)
if (!is_readable($path)) {
throw new Loader\Exception\FileIsNotReadableException();
$config = include($path);
if (!is_array($config)) {
throw new Loader\Exception\FileNotReturnAnArrayException();
$this->load($config);
* @return array
public function get()
return $this->config;