| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace ModulesGarden\Servers\KerioEmail\Core\FileReader\Reader;
- use Symfony\Component\Yaml\Yaml;
- use ModulesGarden\Servers\KerioEmail\Core\ServiceLocator;
- /**
- * Description of Yml
- *
- * @author Rafał Ossowski <rafal.os@modulesgarden.com>
- */
- class Yml extends AbstractType
- {
- protected function loadFile()
- {
- $return = [];
- try
- {
- if (file_exists($this->path . DS . $this->file))
- {
- $return = Yaml::parse(file_get_contents($this->path . DS . $this->file));
- $return = array_map(self::class . '::replaceBackslash', $return ? : []);
- }
- }
- catch (\Symfony\Component\Yaml\Exception\ParseException $e)
- {
- ServiceLocator::call('errorManager')->addError(self::class, $e->getMessage(), $e->getTrace());
- }
- $this->data = $return;
- }
- protected static function replaceBackslash($data)
- {
- if (is_array($data))
- {
- return array_map(self::class . '::replaceBackslash', $data);
- }
- else
- {
- return str_replace('\\\\', '\\', $data);
- }
- }
- }
|