Compat/src/Yaml/Parser.php
private function cleanup($value)
    {
        $value = str_replace(array("\r\n", "\r"), "\n", $value);

        // strip YAML header
        $count = 0;
        $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count);
        $this->offset += $count;

        // remove leading comments
        $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
        if (1 == $count) {
            // items have been removed, update the offset
            $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
            $value = $trimmedValue;
        }

        // remove start of the document marker (---)
        $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
        if (1 == $count) {
            // items have been removed, update the offset
            $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
            $value = $trimmedValue;

            // remove end of the document marker (...)
            $value = preg_replace('#\.\.\.\s*$#', '', $value);
        }

        return $value;
    }
private function cleanup($value)
    {
        $value = str_replace(array("\r\n", "\r"), "\n", $value);

        // strip YAML header
        $count = 0;
        $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count);
        $this->offset += $count;

        // remove leading comments
        $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
        if (1 == $count) {
            // items have been removed, update the offset
            $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
            $value = $trimmedValue;
        }

        // remove start of the document marker (---)
        $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
        if (1 == $count) {
            // items have been removed, update the offset
            $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
            $value = $trimmedValue;

            // remove end of the document marker (...)
            $value = preg_replace('#\.\.\.\s*$#', '', $value);
        }

        return $value;
    }
private function cleanup ( $ value ) { $ value = str_replace ( array ( "\r\n" , "\r" ) , "\n" , $ value ) ; // strip YAML header $ count = 0 ; $ value = preg_replace ( '#^\%YAML[: ][\d\.]+.*\n#u' , '' , $ value , - 1 , $ count ) ; $ this -> offset += $ count ; // remove leading comments $ trimmedValue = preg_replace ( '#^(\#.*?\n)+#s' , '' , $ value , - 1 , $ count ) ; if ( 1 == $ count ) { // items have been removed, update the offset $ this -> offset += substr_count ( $ value , "\n" ) - substr_count ( $ trimmedValue , "\n" ) ; $ value = $ trimmedValue ; } // remove start of the document marker (---) $ trimmedValue = preg_replace ( '#^\-\-\-.*?\n#s' , '' , $ value , - 1 , $ count ) ; if ( 1 == $ count ) { // items have been removed, update the offset $ this -> offset += substr_count ( $ value , "\n" ) - substr_count ( $ trimmedValue , "\n" ) ; $ value = $ trimmedValue ; // remove end of the document marker (...) $ value = preg_replace ( '#\.\.\.\s*$#' , '' , $ value ) ; } return $ value ; }
Cleanups a YAML string to be parsed.

@param string $value The input YAML string

@return string A cleaned up YAML string
Cleanups a YAML string to be parsed .