Model/File/Writer/YamlWriter.php
private function generateYaml(array $data)
    {
        $fileContent = array();
        $header = array();
        foreach ($data as $path => $scopes) {
            $paths = explode('/', $path);
            if (!isset($header[$paths[0]])) {
                $header[$paths[0]] = true;
                $length = strlen($paths[0]) + 2;
                $fileContent[] = PHP_EOL . $this->getIndentation($length, '#') . PHP_EOL . '# ' . $paths[0] . PHP_EOL . $this->getIndentation($length, '#');
            }

            $fileContent[] = $path . ':';
            foreach ($scopes as $scope => $scopeValues) {
                $fileContent[] = $this->getIndentation(2) . $scope . ':';
                foreach ($scopeValues as $scopeId => $value) {
                    $fileContent[] = $this->getIndentation(4) . $scopeId . ': ' . $this->prepareValue($value);
                }
            }
        }

        return implode(PHP_EOL, $fileContent);
    }
private function generateYaml(array $data)
    {
        $fileContent = array();
        $header = array();
        foreach ($data as $path => $scopes) {
            $paths = explode('/', $path);
            if (!isset($header[$paths[0]])) {
                $header[$paths[0]] = true;
                $length = strlen($paths[0]) + 2;
                $fileContent[] = PHP_EOL . $this->getIndentation($length, '#') . PHP_EOL . '# ' . $paths[0] . PHP_EOL . $this->getIndentation($length, '#');
            }

            $fileContent[] = $path . ':';
            foreach ($scopes as $scope => $scopeValues) {
                $fileContent[] = $this->getIndentation(2) . $scope . ':';
                foreach ($scopeValues as $scopeId => $value) {
                    $fileContent[] = $this->getIndentation(4) . $scopeId . ': ' . $this->prepareValue($value);
                }
            }
        }

        return implode(PHP_EOL, $fileContent);
    }
private function generateYaml ( array $ data ) { $ fileContent = array ( ) ; $ header = array ( ) ; foreach ( $ data as $ path => $ scopes ) { $ paths = explode ( '/' , $ path ) ; if ( ! isset ( $ header [ $ paths [ 0 ] ] ) ) { $ header [ $ paths [ 0 ] ] = true ; $ length = strlen ( $ paths [ 0 ] ) + 2 ; $ fileContent [ ] = PHP_EOL . $ this -> getIndentation ( $ length , '#' ) . PHP_EOL . '# ' . $ paths [ 0 ] . PHP_EOL . $ this -> getIndentation ( $ length , '#' ) ; } $ fileContent [ ] = $ path . ':' ; foreach ( $ scopes as $ scope => $ scopeValues ) { $ fileContent [ ] = $ this -> getIndentation ( 2 ) . $ scope . ':' ; foreach ( $ scopeValues as $ scopeId => $ value ) { $ fileContent [ ] = $ this -> getIndentation ( 4 ) . $ scopeId . ': ' . $ this -> prepareValue ( $ value ) ; } } } return implode ( PHP_EOL , $ fileContent ) ; }
Custom format with nice headers only for flat structure available

@param array $data
@return string
Custom format with nice headers only for flat structure available