original_string: static protected function parseMapping($mapping, &$i = 0)
    {
      $output = array();
      $len = strlen($mapping);
      $i += 1;
  
      // {foo: bar, bar:foo, ...}
      while ($i < $len)
      {
        switch ($mapping[$i])
        {
          case ' ':
          case ',':
            ++$i;
            continue 2;
          case '}':
            return $output;
        }
  
        // key
        $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false);
  
        // value
        $done = false;
        while ($i < $len)
        {
          switch ($mapping[$i])
          {
            case '[':
              // nested sequence
              $output[$key] = self::parseSequence($mapping, $i);
              $done = true;
              break;
            case '{':
              // nested mapping
              $output[$key] = self::parseMapping($mapping, $i);
              $done = true;
              break;
            case ':':
            case ' ':
              break;
            default:
              $output[$key] = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i);
              $done = true;
              --$i;
          }
  
          ++$i;
  
          if ($done)
          {
            continue 2;
          }
        }
      }
  
      throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $mapping));
    }
code: static protected function parseMapping($mapping, &$i = 0)
    {
      $output = array();
      $len = strlen($mapping);
      $i += 1;
  
      // {foo: bar, bar:foo, ...}
      while ($i < $len)
      {
        switch ($mapping[$i])
        {
          case ' ':
          case ',':
            ++$i;
            continue 2;
          case '}':
            return $output;
        }
  
        // key
        $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false);
  
        // value
        $done = false;
        while ($i < $len)
        {
          switch ($mapping[$i])
          {
            case '[':
              // nested sequence
              $output[$key] = self::parseSequence($mapping, $i);
              $done = true;
              break;
            case '{':
              // nested mapping
              $output[$key] = self::parseMapping($mapping, $i);
              $done = true;
              break;
            case ':':
            case ' ':
              break;
            default:
              $output[$key] = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i);
              $done = true;
              --$i;
          }
  
          ++$i;
  
          if ($done)
          {
            continue 2;
          }
        }
      }
  
      throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $mapping));
    }
code_tokens: static protected function parseMapping ( $ mapping , & $ i = 0 ) { $ output = array ( ) ; $ len = strlen ( $ mapping ) ; $ i += 1 ; // {foo: bar, bar:foo, ...} while ( $ i < $ len ) { switch ( $ mapping [ $ i ] ) { case ' ' : case ',' : ++ $ i ; continue 2 ; case '}' : return $ output ; } // key $ key = self :: parseScalar ( $ mapping , array ( ':' , ' ' ) , array ( '"' , "'" ) , $ i , false ) ; // value $ done = false ; while ( $ i < $ len ) { switch ( $ mapping [ $ i ] ) { case '[' : // nested sequence $ output [ $ key ] = self :: parseSequence ( $ mapping , $ i ) ; $ done = true ; break ; case '{' : // nested mapping $ output [ $ key ] = self :: parseMapping ( $ mapping , $ i ) ; $ done = true ; break ; case ':' : case ' ' : break ; default : $ output [ $ key ] = self :: parseScalar ( $ mapping , array ( ',' , '}' ) , array ( '"' , "'" ) , $ i ) ; $ done = true ; -- $ i ; } ++ $ i ; if ( $ done ) { continue 2 ; } } } throw new InvalidArgumentException ( sprintf ( 'Malformed inline YAML string %s' , $ mapping ) ) ; }
docstring: Parses a mapping to a YAML string.
  
  @param string  $mapping
  @param integer $i
  
  @return string A YAML string
docstring_tokens: Parses a mapping to a YAML string .