original_string: private function writeResource($file, $value, $indentation, $requireBraces = true)
      {
          if (\is_int($value)) {
              $this->writeInteger($file, $value);
  
              return;
          }
  
          if ($value instanceof \Traversable) {
              $value = iterator_to_array($value);
          }
  
          if (\is_array($value)) {
              $intValues = \count($value) === \count(array_filter($value, 'is_int'));
  
              $keys = array_keys($value);
  
              // check that the keys are 0-indexed and ascending
              $intKeys = $keys === range(0, \count($keys) - 1);
  
              if ($intValues && $intKeys) {
                  $this->writeIntVector($file, $value, $indentation);
  
                  return;
              }
  
              if ($intKeys) {
                  $this->writeArray($file, $value, $indentation);
  
                  return;
              }
  
              $this->writeTable($file, $value, $indentation);
  
              return;
          }
  
          if (\is_bool($value)) {
              $value = $value ? 'true' : 'false';
          }
  
          $this->writeString($file, (string) $value, $requireBraces);
      }
code: private function writeResource($file, $value, $indentation, $requireBraces = true)
      {
          if (\is_int($value)) {
              $this->writeInteger($file, $value);
  
              return;
          }
  
          if ($value instanceof \Traversable) {
              $value = iterator_to_array($value);
          }
  
          if (\is_array($value)) {
              $intValues = \count($value) === \count(array_filter($value, 'is_int'));
  
              $keys = array_keys($value);
  
              // check that the keys are 0-indexed and ascending
              $intKeys = $keys === range(0, \count($keys) - 1);
  
              if ($intValues && $intKeys) {
                  $this->writeIntVector($file, $value, $indentation);
  
                  return;
              }
  
              if ($intKeys) {
                  $this->writeArray($file, $value, $indentation);
  
                  return;
              }
  
              $this->writeTable($file, $value, $indentation);
  
              return;
          }
  
          if (\is_bool($value)) {
              $value = $value ? 'true' : 'false';
          }
  
          $this->writeString($file, (string) $value, $requireBraces);
      }
code_tokens: private function writeResource ( $ file , $ value , $ indentation , $ requireBraces = true ) { if ( \ is_int ( $ value ) ) { $ this -> writeInteger ( $ file , $ value ) ; return ; } if ( $ value instanceof \ Traversable ) { $ value = iterator_to_array ( $ value ) ; } if ( \ is_array ( $ value ) ) { $ intValues = \ count ( $ value ) === \ count ( array_filter ( $ value , 'is_int' ) ) ; $ keys = array_keys ( $ value ) ; // check that the keys are 0-indexed and ascending $ intKeys = $ keys === range ( 0 , \ count ( $ keys ) - 1 ) ; if ( $ intValues && $ intKeys ) { $ this -> writeIntVector ( $ file , $ value , $ indentation ) ; return ; } if ( $ intKeys ) { $ this -> writeArray ( $ file , $ value , $ indentation ) ; return ; } $ this -> writeTable ( $ file , $ value , $ indentation ) ; return ; } if ( \ is_bool ( $ value ) ) { $ value = $ value ? 'true' : 'false' ; } $ this -> writeString ( $ file , ( string ) $ value , $ requireBraces ) ; }
docstring: Writes a "resource" node.
  
  @param resource $file          The file handle to write to
  @param mixed    $value         The value of the node
  @param int      $indentation   The number of levels to indent
  @param bool     $requireBraces Whether to require braces to be printedaround the value
  
  @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
docstring_tokens: Writes a resource node .