Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ui/include/classes/widgets/fields/CWidgetFieldUrl.php')
-rw-r--r--ui/include/classes/widgets/fields/CWidgetFieldUrl.php36
1 files changed, 15 insertions, 21 deletions
diff --git a/ui/include/classes/widgets/fields/CWidgetFieldUrl.php b/ui/include/classes/widgets/fields/CWidgetFieldUrl.php
index 31c760be381..7d8706deb1a 100644
--- a/ui/include/classes/widgets/fields/CWidgetFieldUrl.php
+++ b/ui/include/classes/widgets/fields/CWidgetFieldUrl.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
@@ -19,39 +19,33 @@
**/
+namespace Zabbix\Widgets\Fields;
+
+use Zabbix\Widgets\CWidgetField;
+
class CWidgetFieldUrl extends CWidgetField {
- /**
- * URL widget field.
- *
- * @param string $name field name in form
- * @param string $label label for the field in form
- */
- public function __construct($name, $label) {
+ public const DEFAULT_VALUE = '';
+
+ public function __construct(string $name, string $label = null) {
parent::__construct($name, $label);
- $this->setSaveType(ZBX_WIDGET_FIELD_TYPE_STR);
- $this->setValidationRules(['type' => API_URL, 'flags' => API_ALLOW_USER_MACRO]);
- $this->setDefault('');
+ $this
+ ->setDefault(self::DEFAULT_VALUE)
+ ->setSaveType(ZBX_WIDGET_FIELD_TYPE_STR)
+ ->setValidationRules(['type' => API_URL, 'flags' => API_ALLOW_USER_MACRO]);
}
- /**
- * Set additional flags, which can be used in configuration form.
- *
- * @param int $flags
- *
- * @return $this
- */
- public function setFlags($flags) {
+ public function setFlags(int $flags): self {
parent::setFlags($flags);
- if ($flags & self::FLAG_NOT_EMPTY) {
+ if (($flags & self::FLAG_NOT_EMPTY) !== 0) {
$strict_validation_rules = $this->getValidationRules();
self::setValidationRuleFlag($strict_validation_rules, API_NOT_EMPTY);
$this->setStrictValidationRules($strict_validation_rules);
}
else {
- $this->setStrictValidationRules(null);
+ $this->setStrictValidationRules();
}
return $this;