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/CWidgetFieldRangeControl.php')
-rw-r--r--ui/include/classes/widgets/fields/CWidgetFieldRangeControl.php57
1 files changed, 20 insertions, 37 deletions
diff --git a/ui/include/classes/widgets/fields/CWidgetFieldRangeControl.php b/ui/include/classes/widgets/fields/CWidgetFieldRangeControl.php
index 43246743f36..8e92698fac2 100644
--- a/ui/include/classes/widgets/fields/CWidgetFieldRangeControl.php
+++ b/ui/include/classes/widgets/fields/CWidgetFieldRangeControl.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
@@ -19,65 +19,48 @@
**/
-/**
- * Widget Field for numeric box
- */
-class CWidgetFieldRangeControl extends CWidgetField {
+namespace Zabbix\Widgets\Fields;
- /**
- * Allowed min value
- *
- * @var int
- */
- private $min;
+use Zabbix\Widgets\CWidgetField;
- /**
- * Allowed max value
- *
- * @var int
- */
- private $max;
+class CWidgetFieldRangeControl extends CWidgetField {
- /**
- * Step value
- *
- * @var int
- */
- private $step;
+ private int $min;
+ private int $max;
+ private int $step;
/**
- * A numeric box widget field.
- *
- * @param string $name field name in form
- * @param string $label label for the field in form
- * @param int $min minimal allowed value (this included)
- * @param int $max maximal allowed value (this included)
- * @param int $step step value
+ * @param int $min Minimal allowed value.
+ * @param int $max Maximal allowed value.
*/
- public function __construct($name, $label, $min = 0, $max = ZBX_MAX_INT32, $step = 1) {
+ public function __construct(string $name, string $label = null, int $min = 0, int $max = ZBX_MAX_INT32,
+ int $step = 1) {
parent::__construct($name, $label);
- $this->setSaveType(ZBX_WIDGET_FIELD_TYPE_INT32);
$this->min = $min;
$this->max = $max;
$this->step = $step;
- $this->setExValidationRules(['in' => $this->min.':'.$this->max]);
+
+ $this
+ ->setSaveType(ZBX_WIDGET_FIELD_TYPE_INT32)
+ ->setExValidationRules(['in' => $this->min.':'.$this->max]);
}
- public function setValue($value) {
+ public function setValue($value): self {
$this->value = (int) $value;
+
return $this;
}
- public function getMin() {
+ public function getMin(): int {
return $this->min;
}
- public function getMax() {
+ public function getMax(): int {
return $this->max;
}
- public function getStep() {
+ public function getStep(): int {
return $this->step;
}
}