X7ROOT File Manager
Current Path:
/home/prisjneg/public_html/vendor/nette/utils/src/Utils
home
/
prisjneg
/
public_html
/
vendor
/
nette
/
utils
/
src
/
Utils
/
📁
..
📄
ArrayHash.php
(1.86 KB)
📄
ArrayList.php
(2.61 KB)
📄
Arrays.php
(13.59 KB)
📄
Callback.php
(3.5 KB)
📄
DateTime.php
(5.12 KB)
📄
FileInfo.php
(1.26 KB)
📄
FileSystem.php
(9.48 KB)
📄
Finder.php
(13.04 KB)
📄
Floats.php
(2.07 KB)
📄
Helpers.php
(2.56 KB)
📄
Html.php
(19.03 KB)
📄
Image.php
(23.54 KB)
📄
ImageColor.php
(1.6 KB)
📄
ImageType.php
(421 B)
📄
Iterables.php
(5.64 KB)
📄
Json.php
(2.22 KB)
📄
ObjectHelpers.php
(6.85 KB)
📄
Paginator.php
(4.38 KB)
📄
Random.php
(1.2 KB)
📄
Reflection.php
(8.47 KB)
📄
ReflectionMethod.php
(812 B)
📄
Strings.php
(22.41 KB)
📄
Type.php
(6.36 KB)
📄
Validators.php
(10.41 KB)
📄
exceptions.php
(760 B)
Editing: Json.php
<?php /** * This file is part of the Nette Framework (https://nette.org) * Copyright (c) 2004 David Grudl (https://davidgrudl.com) */ declare(strict_types=1); namespace Nette\Utils; use Nette; /** * JSON encoder and decoder. */ final class Json { use Nette\StaticClass; /** @deprecated use Json::decode(..., forceArrays: true) */ public const FORCE_ARRAY = JSON_OBJECT_AS_ARRAY; /** @deprecated use Json::encode(..., pretty: true) */ public const PRETTY = JSON_PRETTY_PRINT; /** @deprecated use Json::encode(..., asciiSafe: true) */ public const ESCAPE_UNICODE = 1 << 19; /** * Converts value to JSON format. Use $pretty for easier reading and clarity, $asciiSafe for ASCII output * and $htmlSafe for HTML escaping, $forceObjects enforces the encoding of non-associateve arrays as objects. * @throws JsonException */ public static function encode( mixed $value, bool|int $pretty = false, bool $asciiSafe = false, bool $htmlSafe = false, bool $forceObjects = false, ): string { if (is_int($pretty)) { // back compatibility $flags = ($pretty & self::ESCAPE_UNICODE ? 0 : JSON_UNESCAPED_UNICODE) | ($pretty & ~self::ESCAPE_UNICODE); } else { $flags = ($asciiSafe ? 0 : JSON_UNESCAPED_UNICODE) | ($pretty ? JSON_PRETTY_PRINT : 0) | ($forceObjects ? JSON_FORCE_OBJECT : 0) | ($htmlSafe ? JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG : 0); } $flags |= JSON_UNESCAPED_SLASHES | (defined('JSON_PRESERVE_ZERO_FRACTION') ? JSON_PRESERVE_ZERO_FRACTION : 0); // since PHP 5.6.6 & PECL JSON-C 1.3.7 $json = json_encode($value, $flags); if ($error = json_last_error()) { throw new JsonException(json_last_error_msg(), $error); } return $json; } /** * Parses JSON to PHP value. The $forceArrays enforces the decoding of objects as arrays. * @throws JsonException */ public static function decode(string $json, bool|int $forceArrays = false): mixed { $flags = is_int($forceArrays) // back compatibility ? $forceArrays : ($forceArrays ? JSON_OBJECT_AS_ARRAY : 0); $flags |= JSON_BIGINT_AS_STRING; $value = json_decode($json, flags: $flags); if ($error = json_last_error()) { throw new JsonException(json_last_error_msg(), $error); } return $value; } }
Upload File
Create Folder