Code Duplication    Length = 7-8 lines in 8 locations

framework/Web/UI/WebControls/TDataBoundControl.php 1 location

@@ 224-230 (lines=7) @@
221
	 * @param int $value the zero-based index of the current page
222
	 * @throws TInvalidDataValueException if the value is less than 0
223
	 */
224
	public function setCurrentPageIndex($value)
225
	{
226
		if (($value = TPropertyValue::ensureInteger($value)) < 0) {
227
			$value = 0;
228
		}
229
		$this->setViewState('CurrentPageIndex', $value, 0);
230
	}
231
232
	/**
233
	 * @return int the number of data items on each page. Defaults to 10.

framework/Web/UI/WebControls/TInlineFrame.php 4 locations

@@ 163-169 (lines=7) @@
160
	/**
161
	 * @param int $value the width of the control
162
	 */
163
	public function setWidth($value)
164
	{
165
		if (($value = TPropertyValue::ensureInteger($value)) < 0) {
166
			$value = -1;
167
		}
168
		$this->setViewState('Width', $value, -1);
169
	}
170
171
	/**
172
	 * @return int the height of the control
@@ 182-188 (lines=7) @@
179
	/**
180
	 * @param int $value the height of the control
181
	 */
182
	public function setHeight($value)
183
	{
184
		if (($value = TPropertyValue::ensureInteger($value)) < 0) {
185
			$value = -1;
186
		}
187
		$this->setViewState('Height', $value, -1);
188
	}
189
190
	/**
191
	 * @return int the amount of space, in pixels, that should be left between
@@ 203-209 (lines=7) @@
200
	 * @param int $value the amount of space, in pixels, that should be left between
201
	 * the frame's contents and the left and right margins.
202
	 */
203
	public function setMarginWidth($value)
204
	{
205
		if (($value = TPropertyValue::ensureInteger($value)) < 0) {
206
			$value = -1;
207
		}
208
		$this->setViewState('MarginWidth', $value, -1);
209
	}
210
211
	/**
212
	 * @return int the amount of space, in pixels, that should be left between
@@ 224-230 (lines=7) @@
221
	 * @param int $value the amount of space, in pixels, that should be left between
222
	 * the frame's contents and the top and bottom margins.
223
	 */
224
	public function setMarginHeight($value)
225
	{
226
		if (($value = TPropertyValue::ensureInteger($value)) < 0) {
227
			$value = -1;
228
		}
229
		$this->setViewState('MarginHeight', $value, -1);
230
	}
231
232
	/**
233
	 * Adds attribute name-value pairs to renderer.

framework/Web/UI/WebControls/TListBox.php 1 location

@@ 185-192 (lines=8) @@
182
	/**
183
	 * @param int $value the number of rows to be displayed in the list control
184
	 */
185
	public function setRows($value)
186
	{
187
		$value = TPropertyValue::ensureInteger($value);
188
		if ($value <= 0) {
189
			$value = 4;
190
		}
191
		$this->setViewState('Rows', $value, 4);
192
	}
193
194
	/**
195
	 * @return TListSelectionMode the selection mode (Single, Multiple). Defaults to TListSelectionMode::Single.

framework/Web/UI/WebControls/TListControlValidator.php 2 locations

@@ 85-91 (lines=7) @@
82
	/**
83
	 * @param int $value minimum number of selections.
84
	 */
85
	public function setMinSelection($value)
86
	{
87
		if (($value = TPropertyValue::ensureInteger($value)) < 0) {
88
			$value = -1;
89
		}
90
		$this->setViewState('MinSelection', $value, -1);
91
	}
92
93
	/**
94
	 * @return int max number of selections.  Defaults to -1, meaning not set.
@@ 104-110 (lines=7) @@
101
	/**
102
	 * @param int $value max number of selections.
103
	 */
104
	public function setMaxSelection($value)
105
	{
106
		if (($value = TPropertyValue::ensureInteger($value)) < 0) {
107
			$value = -1;
108
		}
109
		$this->setViewState('MaxSelection', $value, -1);
110
	}
111
112
	/**
113
	 * Get a comma separated list of required selected values.