Passed
Push — profile-edit-layout ( 21f10e...3e6a81 )
by
unknown
12:21
created

Php54   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hex2bin() 0 15 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
namespace Symfony\Polyfill\Php54;
13
14
/**
15
 * @author Nicolas Grekas <[email protected]>
16
 *
17
 * @internal
18
 */
19
final class Php54
20
{
21
    public static function hex2bin($data)
22
    {
23
        $len = strlen($data);
24
25
        if (null === $len) {
26
            return;
27
        }
28
        if ($len % 2) {
29
            trigger_error('hex2bin(): Hexadecimal input string must have an even length', E_USER_WARNING);
30
31
            return false;
32
        }
33
34
        return pack('H*', $data);
35
    }
36
}
37