Code Duplication    Length = 15-15 lines in 4 locations

src/DataSource/DibiFluentMssqlDataSource.php 1 location

@@ 97-111 (lines=15) @@
94
	 * @param  Filter\FilterDateRange $filter
95
	 * @return void
96
	 */
97
	public function applyFilterDateRange(Filter\FilterDateRange $filter)
98
	{
99
		$conditions = $filter->getCondition();
100
101
		$value_from = $conditions[$filter->getColumn()]['from'];
102
		$value_to   = $conditions[$filter->getColumn()]['to'];
103
104
		if ($value_from) {
105
			$this->data_source->where('CONVERT(varchar(10), %n, 112) >= ?', $filter->getColumn(), $value_from);
106
		}
107
108
		if ($value_to) {
109
			$this->data_source->where('CONVERT(varchar(10), %n, 112) <= ?', $filter->getColumn(), $value_to);
110
		}
111
	}
112
113
114
	/**

src/DataSource/NetteDatabaseTableDataSource.php 1 location

@@ 139-153 (lines=15) @@
136
	 * @param  Filter\FilterRange $filter
137
	 * @return void
138
	 */
139
	public function applyFilterRange(Filter\FilterRange $filter)
140
	{
141
		$conditions = $filter->getCondition();
142
143
		$value_from = $conditions[$filter->getColumn()]['from'];
144
		$value_to   = $conditions[$filter->getColumn()]['to'];
145
146
		if ($value_from) {
147
			$this->data_source->where("{$filter->getColumn()} >= ?", $value_from);
148
		}
149
150
		if ($value_to) {
151
			$this->data_source->where("{$filter->getColumn()} <= ?", $value_to);
152
		}
153
	}
154
155
156
	/**

src/DataSource/DibiFluentDataSource.php 1 location

@@ 133-147 (lines=15) @@
130
	 * @param  Filter\FilterRange $filter
131
	 * @return void
132
	 */
133
	public function applyFilterRange(Filter\FilterRange $filter)
134
	{
135
		$conditions = $filter->getCondition();
136
137
		$value_from = $conditions[$filter->getColumn()]['from'];
138
		$value_to   = $conditions[$filter->getColumn()]['to'];
139
140
		if ($value_from) {
141
			$this->data_source->where('%n >= ?', $filter->getColumn(), $value_from);
142
		}
143
144
		if ($value_to) {
145
			$this->data_source->where('%n <= ?', $filter->getColumn(), $value_to);
146
		}
147
	}
148
149
150
	/**

src/DataSource/NextrasDataSource.php 1 location

@@ 155-169 (lines=15) @@
152
	 * @param  Filter\FilterRange $filter
153
	 * @return void
154
	 */
155
	public function applyFilterRange(Filter\FilterRange $filter)
156
	{
157
		$conditions = $filter->getCondition();
158
159
		$value_from = $conditions[$filter->getColumn()]['from'];
160
		$value_to   = $conditions[$filter->getColumn()]['to'];
161
162
		if ($value_from) {
163
			$this->data_source->getQueryBuilder()->andWhere("%column >= %any", $filter->getColumn(), $value_from);
164
		}
165
166
		if ($value_to) {
167
			$this->data_source->getQueryBuilder()->andWhere("%column <= %any", $filter->getColumn(), $value_to);
168
		}
169
	}
170
171
172
	/**