original_string: public function convertIpToNumber($ipGiven)
      {
          if (filter_var($ipGiven, FILTER_VALIDATE_IP)) {
              if (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                  $ips = explode('.', $ipGiven);
                  return $ips[3] + $ips[2] * 256 + $ips[1] * 65536 + $ips[0] * 16777216;
              } elseif (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                  return $this->convertIpV6ToNumber($ipGiven);
              }
          }
          return 'invalid IP';
      }
code: public function convertIpToNumber($ipGiven)
      {
          if (filter_var($ipGiven, FILTER_VALIDATE_IP)) {
              if (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                  $ips = explode('.', $ipGiven);
                  return $ips[3] + $ips[2] * 256 + $ips[1] * 65536 + $ips[0] * 16777216;
              } elseif (filter_var($ipGiven, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                  return $this->convertIpV6ToNumber($ipGiven);
              }
          }
          return 'invalid IP';
      }
code_tokens: public function convertIpToNumber ( $ ipGiven ) { if ( filter_var ( $ ipGiven , FILTER_VALIDATE_IP ) ) { if ( filter_var ( $ ipGiven , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { $ ips = explode ( '.' , $ ipGiven ) ; return $ ips [ 3 ] + $ ips [ 2 ] * 256 + $ ips [ 1 ] * 65536 + $ ips [ 0 ] * 16777216 ; } elseif ( filter_var ( $ ipGiven , FILTER_VALIDATE_IP , FILTER_FLAG_IPV6 ) ) { return $ this -> convertIpV6ToNumber ( $ ipGiven ) ; } } return 'invalid IP' ; }
docstring: Converts IP to a number
  
  @param type $ipGiven
  @return string|int
docstring_tokens: Converts IP to a number