f64b58bc4f19199559d9f80aad5c2bccecb7933f
[yaffs-website] / vendor / symfony / polyfill-php54 / Php54.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
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 <p@tchwork.com>
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 }