Completed
Push — master ( 014c18...79149c )
by Richard
33s queued 22s
created

iconv()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 1
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
use Symfony\Polyfill\Iconv as p;
13
14
if (!function_exists('iconv')) {
15
    define('ICONV_IMPL', 'Symfony');
16
    define('ICONV_VERSION', '1.0');
17
    define('ICONV_MIME_DECODE_STRICT', 1);
18
    define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
19
20
    function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); }
21
    function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); }
22
    function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); }
23
    function iconv_mime_encode($name, $value, $pref = null) { return p\Iconv::iconv_mime_encode($name, $value, $pref); }
24
    function iconv_mime_decode_headers($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode_headers($encodedHeaders, $mode, $enc); }
25
26
    if (extension_loaded('mbstring')) {
27
        function iconv_strlen($s, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strlen($s, $enc); }
28
        function iconv_strpos($s, $needle, $offset = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strpos($s, $needle, $offset, $enc); }
29
        function iconv_strrpos($s, $needle, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strrpos($s, $needle, 0, $enc); }
30
        function iconv_substr($s, $start, $length = 2147483647, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_substr($s, $start, $length, $enc); }
31
        function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_decode_mimeheader($encodedHeaders, $mode, $enc); }
0 ignored issues
show
Unused Code introduced by
The call to mb_decode_mimeheader() has too many arguments starting with $mode. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return /** @scrutinizer ignore-call */ mb_decode_mimeheader($encodedHeaders, $mode, $enc); }

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
32
    } else {
33
        if (extension_loaded('xml')) {
34
            function iconv_strlen($s, $enc = null) { return p\Iconv::strlen1($s, $enc); }
35
        } else {
36
            function iconv_strlen($s, $enc = null) { return p\Iconv::strlen2($s, $enc); }
37
        }
38
39
        function iconv_strpos($s, $needle, $offset = 0, $enc = null) { return p\Iconv::iconv_strpos($s, $needle, $offset, $enc); }
40
        function iconv_strrpos($s, $needle, $enc = null) { return p\Iconv::iconv_strrpos($s, $needle, $enc); }
41
        function iconv_substr($s, $start, $length = 2147483647, $enc = null) { return p\Iconv::iconv_substr($s, $start, $length, $enc); }
42
        function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode($encodedHeaders, $mode, $enc); }
43
    }
44
}
45