4 * This file is a part of dflydev/dot-access-configuration.
6 * (c) Dragonfly Development Inc.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Dflydev\DotAccessConfiguration;
14 use Psr\Log\InvalidArgumentException;
15 use Symfony\Component\Yaml\Yaml;
17 class YamlConfigurationBuilder extends AbstractConfigurationBuilder
29 * @param string|null $input
31 public function __construct($input = null)
33 $this->input = $input;
39 public function internalBuild(ConfigurationInterface $configuration)
41 if (null !== $this->input) {
43 $yml = Yaml::parse($this->input, true);
44 } catch (\Exception $e) {
45 throw new InvalidArgumentException($e->getMessage(), 0, $e);
49 throw(new \InvalidArgumentException('Yaml could not be parsed, parser detected a string.'));
51 $configuration->importRaw($yml);