original_string: public static function getFirstIpFromList($csv, $excludedIps = null)
      {
          $p = strrpos($csv, ',');
          if ($p !== false) {
              $elements = explode(',', $csv);
              foreach ($elements as $ipString) {
                  $element = trim(Common::sanitizeInputValue($ipString));
                  if(empty($element)) {
                      continue;
                  }
                  $ip = \Piwik\Network\IP::fromStringIP(IPUtils::sanitizeIp($element));
                  if (empty($excludedIps) || (!in_array($element, $excludedIps) && !$ip->isInRanges($excludedIps))) {
                      return $element;
                  }
              }
  
              return '';
          }
          return trim(Common::sanitizeInputValue($csv));
      }
code: public static function getFirstIpFromList($csv, $excludedIps = null)
      {
          $p = strrpos($csv, ',');
          if ($p !== false) {
              $elements = explode(',', $csv);
              foreach ($elements as $ipString) {
                  $element = trim(Common::sanitizeInputValue($ipString));
                  if(empty($element)) {
                      continue;
                  }
                  $ip = \Piwik\Network\IP::fromStringIP(IPUtils::sanitizeIp($element));
                  if (empty($excludedIps) || (!in_array($element, $excludedIps) && !$ip->isInRanges($excludedIps))) {
                      return $element;
                  }
              }
  
              return '';
          }
          return trim(Common::sanitizeInputValue($csv));
      }
code_tokens: public static function getFirstIpFromList ( $ csv , $ excludedIps = null ) { $ p = strrpos ( $ csv , ',' ) ; if ( $ p !== false ) { $ elements = explode ( ',' , $ csv ) ; foreach ( $ elements as $ ipString ) { $ element = trim ( Common :: sanitizeInputValue ( $ ipString ) ) ; if ( empty ( $ element ) ) { continue ; } $ ip = \ Piwik \ Network \ IP :: fromStringIP ( IPUtils :: sanitizeIp ( $ element ) ) ; if ( empty ( $ excludedIps ) || ( ! in_array ( $ element , $ excludedIps ) && ! $ ip -> isInRanges ( $ excludedIps ) ) ) { return $ element ; } } return '' ; } return trim ( Common :: sanitizeInputValue ( $ csv ) ) ; }
docstring: Returns the last IP address in a comma separated list, subject to an optional exclusion list.
  
  @param string $csv Comma separated list of elements.
  @param array $excludedIps Optional list of excluded IP addresses (or IP address ranges).
  @return string Last (non-excluded) IP address in the list or an empty string if all given IPs are excluded.
docstring_tokens: Returns the last IP address in a comma separated list subject to an optional exclusion list .