Esempio n. 1
0
 protected function addParameters()
 {
     if (!$this->container->getParameters()) {
         return '';
     }
     return YAML::dump(array('parameters' => $this->prepareParameters($this->container->getParameters())), 2);
 }
 protected function loadFile($file)
 {
     return $this->validate(YAML::load($file), $file);
 }
 protected function loadFile($file)
 {
     return YAML::load($file);
 }
Esempio n. 4
0
 protected function getFilesAsArray(array $files)
 {
     $yamls = array();
     foreach ($files as $file) {
         $path = $this->getAbsolutePath($file);
         if (!file_exists($path)) {
             throw new \InvalidArgumentException(sprintf('The service file "%s" does not exist (in: %s).', $file, implode(', ', $this->paths)));
         }
         $yamls[$path] = $this->validate(YAML::load($path), $path);
     }
     return $yamls;
 }
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap.php';
use Symfony\Components\YAML\YAML;
use Symfony\Components\YAML\Parser;
use Symfony\Components\YAML\Dumper;
YAML::setSpecVersion('1.1');
$t = new LimeTest(148);
$parser = new Parser();
$dumper = new Dumper();
$path = __DIR__ . '/../../../../fixtures/Symfony/Components/YAML';
$files = $parser->parse(file_get_contents($path . '/index.yml'));
foreach ($files as $file) {
    $t->diag($file);
    $yamls = file_get_contents($path . '/' . $file . '.yml');
    // split YAMLs documents
    foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) {
        if (!$yaml) {
            continue;
        }
        $test = $parser->parse($yaml);
        if (isset($test['dump_skip']) && $test['dump_skip']) {
            continue;
        } else {