oss/libs/symfony/yaml/Symfony/Component/Yaml/Inline.php
public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true)
    {
        if (in_array($scalar[$i], $stringDelimiters)) {
            // quoted scalar
            $output = self::parseQuotedScalar($scalar, $i);

            if (null !== $delimiters) {
                $tmp = ltrim(substr($scalar, $i), ' ');
                if (!in_array($tmp[0], $delimiters)) {
                    throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)));
                }
            }
        } else {
            // "normal" string
            if (!$delimiters) {
                $output = substr($scalar, $i);
                $i += strlen($output);

                // remove comments
                if (false !== $strpos = strpos($output, ' #')) {
                    $output = rtrim(substr($output, 0, $strpos));
                }
            } elseif (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {
                $output = $match[1];
                $i += strlen($output);
            } else {
                throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar));
            }

            $output = $evaluate ? self::evaluateScalar($output) : $output;
        }

        return $output;
    }
public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true)
    {
        if (in_array($scalar[$i], $stringDelimiters)) {
            // quoted scalar
            $output = self::parseQuotedScalar($scalar, $i);

            if (null !== $delimiters) {
                $tmp = ltrim(substr($scalar, $i), ' ');
                if (!in_array($tmp[0], $delimiters)) {
                    throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)));
                }
            }
        } else {
            // "normal" string
            if (!$delimiters) {
                $output = substr($scalar, $i);
                $i += strlen($output);

                // remove comments
                if (false !== $strpos = strpos($output, ' #')) {
                    $output = rtrim(substr($output, 0, $strpos));
                }
            } elseif (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {
                $output = $match[1];
                $i += strlen($output);
            } else {
                throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar));
            }

            $output = $evaluate ? self::evaluateScalar($output) : $output;
        }

        return $output;
    }
public static function parseScalar ( $ scalar , $ delimiters = null , $ stringDelimiters = array ( '"' , "'" ) , & $ i = 0 , $ evaluate = true ) { if ( in_array ( $ scalar [ $ i ] , $ stringDelimiters ) ) { // quoted scalar $ output = self :: parseQuotedScalar ( $ scalar , $ i ) ; if ( null !== $ delimiters ) { $ tmp = ltrim ( substr ( $ scalar , $ i ) , ' ' ) ; if ( ! in_array ( $ tmp [ 0 ] , $ delimiters ) ) { throw new ParseException ( sprintf ( 'Unexpected characters (%s).' , substr ( $ scalar , $ i ) ) ) ; } } } else { // "normal" string if ( ! $ delimiters ) { $ output = substr ( $ scalar , $ i ) ; $ i += strlen ( $ output ) ; // remove comments if ( false !== $ strpos = strpos ( $ output , ' #' ) ) { $ output = rtrim ( substr ( $ output , 0 , $ strpos ) ) ; } } elseif ( preg_match ( '/^(.+?)(' . implode ( '|' , $ delimiters ) . ')/' , substr ( $ scalar , $ i ) , $ match ) ) { $ output = $ match [ 1 ] ; $ i += strlen ( $ output ) ; } else { throw new ParseException ( sprintf ( 'Malformed inline YAML string (%s).' , $ scalar ) ) ; } $ output = $ evaluate ? self :: evaluateScalar ( $ output ) : $ output ; } return $ output ; }
Parses a scalar to a YAML string.

@param scalar $scalar
@param string $delimiters
@param array  $stringDelimiters
@param integer &$i
@param Boolean $evaluate

@return string A YAML string

@throws ParseException When malformed inline YAML string is parsed
Parses a scalar to a YAML string .