Code Duplication    Length = 13-22 lines in 4 locations

class/adodb.php 2 locations

@@ 388-400 (lines=13) @@
385
	 * @param mixed	&$s	Source to convert
386
	 * @return mixed
387
	 */
388
	public function EncodingConvert (&$s) {
389
		if (is_array($s) && !empty($s)) {
390
			foreach ($s as &$val)
391
				$this->EncodingConvert($val);
392
			unset($val);
393
		}
394
395
		if (is_string($s)) {
396
			if ($this->sSysCharset != $this->aDbProfile['lang'])
397
				$s = mb_convert_encoding($s, $this->sSysCharset, $this->aDbProfile['lang']);
398
		}
399
		return $s;
400
	} // end of func EncodingConvert
401
402
403
	/**
@@ 411-423 (lines=13) @@
408
	 * @param mixed	&$s	Source to convert
409
	 * @return mixed
410
	 */
411
	public function EncodingConvertReverse (&$s) {
412
		if (is_array($s) && !empty($s)) {
413
			foreach ($s as &$val)
414
				$this->EncodingConvertReverse($val);
415
			unset($val);
416
		}
417
418
		if (is_string($s)) {
419
			if ($this->sSysCharset != $this->aDbProfile['lang'])
420
				$s = mb_convert_encoding($s, $this->aDbProfile['lang'], $this->sSysCharset);
421
		}
422
		return $s;
423
	} // end of func EncodingConvertReverse
424
425
426
	/**

src/Fwlib/Bridge/Adodb.php 2 locations

@@ 362-383 (lines=22) @@
359
     * @param   array|string    &$result    Array or string, not RecordSet object
360
     * @return  array|string
361
     */
362
    public function convertEncodingResult(&$result)
363
    {
364
        if (empty($result) || $this->charsetPhp == $this->profile['lang']) {
365
            return $result;
366
        }
367
368
        if (is_array($result)) {
369
            foreach ($result as &$value) {
370
                $this->convertEncodingResult($value);
371
            }
372
            unset($value);
373
374
        } elseif (is_string($result)) {
375
            $result = mb_convert_encoding(
376
                $result,
377
                $this->charsetPhp,
378
                $this->profile['lang']
379
            );
380
        }
381
382
        return $result;
383
    }
384
385
386
    /**
@@ 394-414 (lines=21) @@
391
     * @param   mixed   &$sql
392
     * @return  mixed
393
     */
394
    public function convertEncodingSql(&$sql)
395
    {
396
        if (empty($sql) || $this->charsetPhp == $this->profile['lang']) {
397
            return $sql;
398
        }
399
400
        if (is_array($sql)) {
401
            foreach ($sql as &$val) {
402
                $this->convertEncodingSql($val);
403
            }
404
            unset($val);
405
        } elseif (is_string($sql)) {
406
            $sql = mb_convert_encoding(
407
                $sql,
408
                $this->profile['lang'],
409
                $this->charsetPhp
410
            );
411
        }
412
413
        return $sql;
414
    }
415
416
417
    /**