YamlParser::cleanup PHP Method

cleanup() protected method

Cleanups a YAML string to be parsed.
protected cleanup ( $value ) : string
return string A cleaned up YAML string
    protected function cleanup($value)
    {
        $value = str_replace(array("\r\n", "\r"), "\n", $value);
        if (!preg_match("#\n\$#", $value)) {
            $value .= "\n";
        }
        // strip YAML header
        preg_replace('#^\\%YAML[: ][\\d\\.]+.*\\n#s', '', $value);
        // remove ---
        $value = preg_replace('#^\\-\\-\\-.*?\\n#s', '', $value);
        return $value;
    }