Added vendor/ directory for Composer's installed files
This commit is contained in:
159
vendor/hassankhan/config/src/AbstractConfig.php
vendored
Executable file
159
vendor/hassankhan/config/src/AbstractConfig.php
vendored
Executable file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus;
|
||||
|
||||
use ArrayAccess;
|
||||
|
||||
/**
|
||||
* Abstract Config class
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
abstract class AbstractConfig implements ArrayAccess, ConfigInterface
|
||||
{
|
||||
/**
|
||||
* Stores the configuration data
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
protected $data = null;
|
||||
|
||||
/**
|
||||
* Caches the configuration data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $cache = array();
|
||||
|
||||
/**
|
||||
* Constructor method and sets default options, if any
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = array_merge($this->getDefaults(), $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method in your own subclass to provide an array of default
|
||||
* options and values
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function getDefaults()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* ConfigInterface Methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
// Check if already cached
|
||||
if (isset($this->cache[$key])) {
|
||||
return $this->cache[$key];
|
||||
}
|
||||
|
||||
$segs = explode('.', $key);
|
||||
$root = $this->data;
|
||||
|
||||
// nested case
|
||||
foreach ($segs as $part) {
|
||||
if (isset($root[$part])) {
|
||||
$root = $root[$part];
|
||||
continue;
|
||||
} else {
|
||||
$root = $default;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// whatever we have is what we needed
|
||||
return ($this->cache[$key] = $root);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
$segs = explode('.', $key);
|
||||
$root = &$this->data;
|
||||
|
||||
// Look for the key, creating nested keys if needed
|
||||
while ($part = array_shift($segs)) {
|
||||
if (!isset($root[$part]) && count($segs)) {
|
||||
$root[$part] = array();
|
||||
}
|
||||
$root = &$root[$part];
|
||||
}
|
||||
|
||||
// Assign value at target node
|
||||
$this->cache[$key] = $root = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* ArrayAccess Methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets a value using the offset as a key
|
||||
*
|
||||
* @param string $offset
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a key exists
|
||||
*
|
||||
* @param string $offset
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return !is_null($this->get($offset));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a value using the offset as a key
|
||||
*
|
||||
* @param string $offset
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a key and its value
|
||||
*
|
||||
* @param string $offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
$this->set($offset, null);
|
||||
}
|
||||
}
|
157
vendor/hassankhan/config/src/Config.php
vendored
Executable file
157
vendor/hassankhan/config/src/Config.php
vendored
Executable file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus;
|
||||
|
||||
use Noodlehaus\Exception\FileNotFoundException;
|
||||
use Noodlehaus\Exception\UnsupportedFormatException;
|
||||
use Noodlehaus\Exception\EmptyDirectoryException;
|
||||
|
||||
/**
|
||||
* Config
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
class Config extends AbstractConfig
|
||||
{
|
||||
/**
|
||||
* All file formats supported by Config
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $supportedFileParsers = array(
|
||||
'Noodlehaus\FileParser\Php',
|
||||
'Noodlehaus\FileParser\Ini',
|
||||
'Noodlehaus\FileParser\Json',
|
||||
'Noodlehaus\FileParser\Xml',
|
||||
'Noodlehaus\FileParser\Yaml'
|
||||
);
|
||||
|
||||
/**
|
||||
* Static method for loading a Config instance.
|
||||
*
|
||||
* @param string|array $path
|
||||
*
|
||||
* @return Config
|
||||
*/
|
||||
public static function load($path)
|
||||
{
|
||||
return new static($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a supported configuration file format.
|
||||
*
|
||||
* @param string|array $path
|
||||
*
|
||||
* @throws EmptyDirectoryException If `$path` is an empty directory
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
$paths = $this->getValidPath($path);
|
||||
$this->data = array();
|
||||
|
||||
foreach ($paths as $path) {
|
||||
|
||||
// Get file information
|
||||
$info = pathinfo($path);
|
||||
$extension = isset($info['extension']) ? $info['extension'] : '';
|
||||
$parser = $this->getParser($extension);
|
||||
|
||||
// Try and load file
|
||||
$this->data = array_replace_recursive($this->data, $parser->parse($path));
|
||||
}
|
||||
|
||||
parent::__construct($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a parser for a given file extension
|
||||
*
|
||||
* @param string $extension
|
||||
*
|
||||
* @return Noodlehaus\File\FileInterface
|
||||
*
|
||||
* @throws UnsupportedFormatException If `$path` is an unsupported file format
|
||||
*/
|
||||
private function getParser($extension)
|
||||
{
|
||||
$parser = null;
|
||||
|
||||
foreach ($this->supportedFileParsers as $fileParser) {
|
||||
$tempParser = new $fileParser;
|
||||
|
||||
if (in_array($extension, $tempParser->getSupportedExtensions($extension))) {
|
||||
$parser = $tempParser;
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If none exist, then throw an exception
|
||||
if ($parser === null) {
|
||||
throw new UnsupportedFormatException('Unsupported configuration format');
|
||||
}
|
||||
|
||||
return $parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks `$path` to see if it is either an array, a directory, or a file
|
||||
*
|
||||
* @param string|array $path
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws EmptyDirectoryException If `$path` is an empty directory
|
||||
*
|
||||
* @throws FileNotFoundException If a file is not found at `$path`
|
||||
*/
|
||||
private function getValidPath($path)
|
||||
{
|
||||
// If `$path` is array
|
||||
if (is_array($path)) {
|
||||
$paths = array();
|
||||
foreach ($path as $unverifiedPath) {
|
||||
try {
|
||||
// Check if `$unverifiedPath` is optional
|
||||
// If it exists, then it's added to the list
|
||||
// If it doesn't, it throws an exception which we catch
|
||||
if ($unverifiedPath[0] !== '?') {
|
||||
$paths = array_merge($paths, $this->getValidPath($unverifiedPath));
|
||||
continue;
|
||||
}
|
||||
$optionalPath = ltrim($unverifiedPath, '?');
|
||||
$paths = array_merge($paths, $this->getValidPath($optionalPath));
|
||||
|
||||
} catch (FileNotFoundException $e) {
|
||||
// If `$unverifiedPath` is optional, then skip it
|
||||
if ($unverifiedPath[0] === '?') {
|
||||
continue;
|
||||
}
|
||||
// Otherwise rethrow the exception
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
|
||||
// If `$path` is a directory
|
||||
if (is_dir($path)) {
|
||||
$paths = glob($path . '/*.*');
|
||||
if (empty($paths)) {
|
||||
throw new EmptyDirectoryException("Configuration directory: [$path] is empty");
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
|
||||
// If `$path` is not a file, throw an exception
|
||||
if (!file_exists($path)) {
|
||||
throw new FileNotFoundException("Configuration file: [$path] cannot be found");
|
||||
}
|
||||
return array($path);
|
||||
}
|
||||
}
|
38
vendor/hassankhan/config/src/ConfigInterface.php
vendored
Executable file
38
vendor/hassankhan/config/src/ConfigInterface.php
vendored
Executable file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus;
|
||||
|
||||
/**
|
||||
* Config interface
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
interface ConfigInterface
|
||||
{
|
||||
/**
|
||||
* Gets a configuration setting using a simple or nested key.
|
||||
* Nested keys are similar to JSON paths that use the dot
|
||||
* dot notation.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null);
|
||||
|
||||
/**
|
||||
* Function for setting configuration values, using
|
||||
* either simple or nested keys.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($key, $value);
|
||||
}
|
9
vendor/hassankhan/config/src/Exception/EmptyDirectoryException.php
vendored
Executable file
9
vendor/hassankhan/config/src/Exception/EmptyDirectoryException.php
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
class EmptyDirectoryException extends Exception
|
||||
{
|
||||
}
|
9
vendor/hassankhan/config/src/Exception/FileNotFoundException.php
vendored
Executable file
9
vendor/hassankhan/config/src/Exception/FileNotFoundException.php
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
class FileNotFoundException extends Exception
|
||||
{
|
||||
}
|
20
vendor/hassankhan/config/src/Exception/ParseException.php
vendored
Executable file
20
vendor/hassankhan/config/src/Exception/ParseException.php
vendored
Executable file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\Exception;
|
||||
|
||||
use ErrorException;
|
||||
|
||||
class ParseException extends ErrorException
|
||||
{
|
||||
public function __construct(array $error)
|
||||
{
|
||||
$message = $error['message'];
|
||||
$code = isset($error['code']) ? $error['code'] : 0;
|
||||
$severity = isset($error['type']) ? $error['type'] : 1;
|
||||
$filename = isset($error['file']) ? $error['file'] : __FILE__;
|
||||
$lineno = isset($error['line']) ? $error['line'] : __LINE__;
|
||||
$exception = isset($error['exception']) ? $error['exception'] : null;
|
||||
|
||||
parent::__construct($message, $code, $severity, $filename, $lineno, $exception);
|
||||
}
|
||||
}
|
9
vendor/hassankhan/config/src/Exception/UnsupportedFormatException.php
vendored
Executable file
9
vendor/hassankhan/config/src/Exception/UnsupportedFormatException.php
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
class UnsupportedFormatException extends Exception
|
||||
{
|
||||
}
|
28
vendor/hassankhan/config/src/FileParser/AbstractFileParser.php
vendored
Executable file
28
vendor/hassankhan/config/src/FileParser/AbstractFileParser.php
vendored
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\FileParser;
|
||||
|
||||
/**
|
||||
* Abstract file parser
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
abstract class AbstractFileParser implements FileParserInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Path to the config file
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
}
|
31
vendor/hassankhan/config/src/FileParser/FileParserInterface.php
vendored
Executable file
31
vendor/hassankhan/config/src/FileParser/FileParserInterface.php
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\FileParser;
|
||||
|
||||
/**
|
||||
* Config file parser interface
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
interface FileParserInterface
|
||||
{
|
||||
/**
|
||||
* Parses a file from `$path` and gets its contents as an array
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function parse($path);
|
||||
|
||||
/**
|
||||
* Returns an array of allowed file extensions for this parser
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSupportedExtensions();
|
||||
}
|
43
vendor/hassankhan/config/src/FileParser/Ini.php
vendored
Executable file
43
vendor/hassankhan/config/src/FileParser/Ini.php
vendored
Executable file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\FileParser;
|
||||
|
||||
use Noodlehaus\Exception\ParseException;
|
||||
|
||||
/**
|
||||
* INI file parser
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
class Ini implements FileParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Parses an INI file as an array
|
||||
*
|
||||
* @throws ParseException If there is an error parsing the INI file
|
||||
*/
|
||||
public function parse($path)
|
||||
{
|
||||
$data = @parse_ini_file($path, true);
|
||||
|
||||
if (!$data) {
|
||||
$error = error_get_last();
|
||||
throw new ParseException($error);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSupportedExtensions()
|
||||
{
|
||||
return array('ini');
|
||||
}
|
||||
}
|
53
vendor/hassankhan/config/src/FileParser/Json.php
vendored
Executable file
53
vendor/hassankhan/config/src/FileParser/Json.php
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\FileParser;
|
||||
|
||||
use Noodlehaus\Exception\ParseException;
|
||||
|
||||
/**
|
||||
* JSON file parser
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
class Json implements FileParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Loads a JSON file as an array
|
||||
*
|
||||
* @throws ParseException If there is an error parsing the JSON file
|
||||
*/
|
||||
public function parse($path)
|
||||
{
|
||||
$data = json_decode(file_get_contents($path), true);
|
||||
|
||||
if (function_exists('json_last_error_msg')) {
|
||||
$error_message = json_last_error_msg();
|
||||
} else {
|
||||
$error_message = 'Syntax error';
|
||||
}
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$error = array(
|
||||
'message' => $error_message,
|
||||
'type' => json_last_error(),
|
||||
'file' => $path,
|
||||
);
|
||||
throw new ParseException($error);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSupportedExtensions()
|
||||
{
|
||||
return array('json');
|
||||
}
|
||||
}
|
61
vendor/hassankhan/config/src/FileParser/Php.php
vendored
Executable file
61
vendor/hassankhan/config/src/FileParser/Php.php
vendored
Executable file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\FileParser;
|
||||
|
||||
use Exception;
|
||||
use Noodlehaus\Exception\ParseException;
|
||||
use Noodlehaus\Exception\UnsupportedFormatException;
|
||||
|
||||
/**
|
||||
* PHP file parser
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
class Php implements FileParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Loads a PHP file and gets its' contents as an array
|
||||
*
|
||||
* @throws ParseException If the PHP file throws an exception
|
||||
* @throws UnsupportedFormatException If the PHP file does not return an array
|
||||
*/
|
||||
public function parse($path)
|
||||
{
|
||||
// Require the file, if it throws an exception, rethrow it
|
||||
try {
|
||||
$temp = require $path;
|
||||
} catch (Exception $exception) {
|
||||
throw new ParseException(
|
||||
array(
|
||||
'message' => 'PHP file threw an exception',
|
||||
'exception' => $exception,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// If we have a callable, run it and expect an array back
|
||||
if (is_callable($temp)) {
|
||||
$temp = call_user_func($temp);
|
||||
}
|
||||
|
||||
// Check for array, if its anything else, throw an exception
|
||||
if (!$temp || !is_array($temp)) {
|
||||
throw new UnsupportedFormatException('PHP file does not return an array');
|
||||
}
|
||||
|
||||
return $temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSupportedExtensions()
|
||||
{
|
||||
return array('php');
|
||||
}
|
||||
}
|
55
vendor/hassankhan/config/src/FileParser/Xml.php
vendored
Executable file
55
vendor/hassankhan/config/src/FileParser/Xml.php
vendored
Executable file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\FileParser;
|
||||
|
||||
use Noodlehaus\Exception\ParseException;
|
||||
|
||||
/**
|
||||
* XML file parser
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
class Xml implements FileParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Parses an XML file as an array
|
||||
*
|
||||
* @throws ParseException If there is an error parsing the XML file
|
||||
*/
|
||||
public function parse($path)
|
||||
{
|
||||
libxml_use_internal_errors(true);
|
||||
|
||||
$data = simplexml_load_file($path, null, LIBXML_NOERROR);
|
||||
|
||||
if ($data === false) {
|
||||
$errors = libxml_get_errors();
|
||||
$latestError = array_pop($errors);
|
||||
$error = array(
|
||||
'message' => $latestError->message,
|
||||
'type' => $latestError->level,
|
||||
'code' => $latestError->code,
|
||||
'file' => $latestError->file,
|
||||
'line' => $latestError->line,
|
||||
);
|
||||
throw new ParseException($error);
|
||||
}
|
||||
|
||||
$data = json_decode(json_encode($data), true);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSupportedExtensions()
|
||||
{
|
||||
return array('xml');
|
||||
}
|
||||
}
|
49
vendor/hassankhan/config/src/FileParser/Yaml.php
vendored
Executable file
49
vendor/hassankhan/config/src/FileParser/Yaml.php
vendored
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Noodlehaus\FileParser;
|
||||
|
||||
use Exception;
|
||||
use Symfony\Component\Yaml\Yaml as YamlParser;
|
||||
use Noodlehaus\Exception\ParseException;
|
||||
|
||||
/**
|
||||
* YAML file parser
|
||||
*
|
||||
* @package Config
|
||||
* @author Jesus A. Domingo <jesus.domingo@gmail.com>
|
||||
* @author Hassan Khan <contact@hassankhan.me>
|
||||
* @link https://github.com/noodlehaus/config
|
||||
* @license MIT
|
||||
*/
|
||||
class Yaml implements FileParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Loads a YAML/YML file as an array
|
||||
*
|
||||
* @throws ParseException If If there is an error parsing the YAML file
|
||||
*/
|
||||
public function parse($path)
|
||||
{
|
||||
try {
|
||||
$data = YamlParser::parse($path);
|
||||
} catch (Exception $exception) {
|
||||
throw new ParseException(
|
||||
array(
|
||||
'message' => 'Error parsing YAML file',
|
||||
'exception' => $exception,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSupportedExtensions()
|
||||
{
|
||||
return array('yaml', 'yml');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user