Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / src / Util / Json.php
1 <?php
2
3 /*
4  * This file is part of Psy Shell.
5  *
6  * (c) 2012-2018 Justin Hileman
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 Psy\Util;
13
14 /**
15  * A static class to wrap JSON encoding/decoding with PsySH's default options.
16  */
17 class Json
18 {
19     /**
20      * Encode a value as JSON.
21      *
22      * @param mixed $val
23      * @param int   $opt
24      *
25      * @return string
26      */
27     public static function encode($val, $opt = 0)
28     {
29         $opt |= JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
30
31         return \json_encode($val, $opt);
32     }
33 }