original_string: public static function set_variable($name, $value, $usevar = true) {
          $output = '';
  
          if ($usevar) {
              if (strpos($name, '.')) {
                  $output .= '';
              } else {
                  $output .= 'var ';
              }
          }
  
          $output .= "$name = ".json_encode($value).";";
  
          return $output;
      }
code: public static function set_variable($name, $value, $usevar = true) {
          $output = '';
  
          if ($usevar) {
              if (strpos($name, '.')) {
                  $output .= '';
              } else {
                  $output .= 'var ';
              }
          }
  
          $output .= "$name = ".json_encode($value).";";
  
          return $output;
      }
code_tokens: public static function set_variable ( $ name , $ value , $ usevar = true ) { $ output = '' ; if ( $ usevar ) { if ( strpos ( $ name , '.' ) ) { $ output .= '' ; } else { $ output .= 'var ' ; } } $ output .= "$name = " . json_encode ( $ value ) . ";" ; return $ output ; }
docstring: Returns code setting value to variable
  
  @param string $name
  @param mixed $value json serialised value
  @param bool $usevar add var definition, ignored for nested properties
  @return string JS code fragment
docstring_tokens: Returns code setting value to variable