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

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