/**
  * Validates the "ip" field.
  *
  * @throws APIException if the field is invalid.
  *
  * @param array $interface
  * @param string $interface['ip']
  */
 protected function checkIp(array $interface)
 {
     if ($interface['ip'] === '') {
         return;
     }
     $user_macro_parser = new CUserMacroParser();
     if (preg_match('/^' . ZBX_PREG_MACRO_NAME_FORMAT . '$/', $interface['ip']) || $user_macro_parser->parse($interface['ip']) == CParser::PARSE_SUCCESS) {
         return;
     }
     $ipValidator = new CIPValidator();
     if (!$ipValidator->validate($interface['ip'])) {
         self::exception(ZBX_API_ERROR_PARAMETERS, $ipValidator->getError());
     }
 }
 /**
  * Validates the "ip" field.
  *
  * @throws APIException if the field is invalid.
  *
  * @param array $interface
  */
 protected function checkIp(array $interface)
 {
     if ($interface['ip'] === '') {
         return;
     }
     if (preg_match('/^' . ZBX_PREG_MACRO_NAME_FORMAT . '$/', $interface['ip']) || preg_match('/^' . ZBX_PREG_EXPRESSION_USER_MACROS . '$/', $interface['ip'])) {
         return;
     }
     $ipValidator = new CIPValidator();
     if (!$ipValidator->validate($interface['ip'])) {
         self::exception(ZBX_API_ERROR_PARAMETERS, $ipValidator->getError());
     }
 }