original_string: public static function ip($check, $type = 'both')
      {
          $type = strtolower($type);
          $flags = 0;
          if ($type === 'ipv4') {
              $flags = FILTER_FLAG_IPV4;
          }
          if ($type === 'ipv6') {
              $flags = FILTER_FLAG_IPV6;
          }
  
          return (bool)filter_var($check, FILTER_VALIDATE_IP, ['flags' => $flags]);
      }
code: public static function ip($check, $type = 'both')
      {
          $type = strtolower($type);
          $flags = 0;
          if ($type === 'ipv4') {
              $flags = FILTER_FLAG_IPV4;
          }
          if ($type === 'ipv6') {
              $flags = FILTER_FLAG_IPV6;
          }
  
          return (bool)filter_var($check, FILTER_VALIDATE_IP, ['flags' => $flags]);
      }
code_tokens: public static function ip ( $ check , $ type = 'both' ) { $ type = strtolower ( $ type ) ; $ flags = 0 ; if ( $ type === 'ipv4' ) { $ flags = FILTER_FLAG_IPV4 ; } if ( $ type === 'ipv6' ) { $ flags = FILTER_FLAG_IPV6 ; } return ( bool ) filter_var ( $ check , FILTER_VALIDATE_IP , [ 'flags' => $ flags ] ) ; }
docstring: Validation of an IP address.
  
  @param string $check The string to test.
  @param string $type The IP Protocol version to validate against
  @return bool Success
docstring_tokens: Validation of an IP address .