Code Duplication    Length = 33-33 lines in 2 locations

src/CI_DB_result.php 2 locations

@@ 235-267 (lines=33) @@
232
	 *
233
	 * @return	array
234
	 */
235
	public function result_object()
236
	{
237
		if (count($this->result_object) > 0)
238
		{
239
			return $this->result_object;
240
		}
241
242
		// In the event that query caching is on, the result_id variable
243
		// will not be a valid resource so we'll simply return an empty
244
		// array.
245
		if ( ! $this->result_id OR $this->num_rows === 0)
246
		{
247
			return array();
248
		}
249
250
		if (($c = count($this->result_array)) > 0)
251
		{
252
			for ($i = 0; $i < $c; $i++)
253
			{
254
				$this->result_object[$i] = (object) $this->result_array[$i];
255
			}
256
257
			return $this->result_object;
258
		}
259
260
		is_null($this->row_data) OR $this->data_seek(0);
261
		while ($row = $this->_fetch_object())
262
		{
263
			$this->result_object[] = $row;
264
		}
265
266
		return $this->result_object;
267
	}
268
269
	// --------------------------------------------------------------------
270
@@ 276-308 (lines=33) @@
273
	 *
274
	 * @return	array
275
	 */
276
	public function result_array()
277
	{
278
		if (count($this->result_array) > 0)
279
		{
280
			return $this->result_array;
281
		}
282
283
		// In the event that query caching is on, the result_id variable
284
		// will not be a valid resource so we'll simply return an empty
285
		// array.
286
		if ( ! $this->result_id OR $this->num_rows === 0)
287
		{
288
			return array();
289
		}
290
291
		if (($c = count($this->result_object)) > 0)
292
		{
293
			for ($i = 0; $i < $c; $i++)
294
			{
295
				$this->result_array[$i] = (array) $this->result_object[$i];
296
			}
297
298
			return $this->result_array;
299
		}
300
301
		is_null($this->row_data) OR $this->data_seek(0);
302
		while ($row = $this->_fetch_assoc())
303
		{
304
			$this->result_array[] = $row;
305
		}
306
307
		return $this->result_array;
308
	}
309
310
	// --------------------------------------------------------------------
311