original_string: protected function cast(\SimpleXMLElement $xml, $type = 'string')
      {
          switch ($type) {
              case 'string':
                  return (string) $xml;
              case 'int':
                  return (int) $xml;
              case 'double':
                  return (double) $xml;
              case 'boolean' :
                  return (bool) ((string) $xml);
              case 'datetime':
                  $date = (string) $xml;
                  if (empty($date)) {
                      return null;
                  }
                  return new \DateTime($date);
              default:
                  return $xml;
          }
      }
code: protected function cast(\SimpleXMLElement $xml, $type = 'string')
      {
          switch ($type) {
              case 'string':
                  return (string) $xml;
              case 'int':
                  return (int) $xml;
              case 'double':
                  return (double) $xml;
              case 'boolean' :
                  return (bool) ((string) $xml);
              case 'datetime':
                  $date = (string) $xml;
                  if (empty($date)) {
                      return null;
                  }
                  return new \DateTime($date);
              default:
                  return $xml;
          }
      }
code_tokens: protected function cast ( \ SimpleXMLElement $ xml , $ type = 'string' ) { switch ( $ type ) { case 'string' : return ( string ) $ xml ; case 'int' : return ( int ) $ xml ; case 'double' : return ( double ) $ xml ; case 'boolean' : return ( bool ) ( ( string ) $ xml ) ; case 'datetime' : $ date = ( string ) $ xml ; if ( empty ( $ date ) ) { return null ; } return new \ DateTime ( $ date ) ; default : return $ xml ; } }
docstring: casts a simple xml element to a type
  
  @param        $xml
  @param string $type
  
  @return float|int|null|string|\DateTime
docstring_tokens: casts a simple xml element to a type