GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ModularTemplate/src/classes/APIRequestBody.php at master · FedgeNo/ModularTemplate Expand file tree/ Copy pathAPIRequestBody.phpMore file actions 37 lines (30 loc) · 986 Bytes / Copy pathAPIRequestBody.phpFile metadata and controls37 lines (30 loc) · 986 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 <?php declare(strict_types=1); /** The size and shape every ordinary application API request may carry. */ final class APIRequestBody { public const MAX_BYTES = 24 * 1024; /** Whether a valid JSON body is one object whose fields are all scalar or null. */ public static function hasOnlyTopLevelFields(string $body): bool { if ($body === '') { return true; } try { $payload = json_decode($body, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException) { // Endpoint validation already reports malformed input as missing // fields; this shared layer is only the nesting boundary. return true; } if (!is_object($payload)) { return false; } foreach (get_object_vars($payload) as $value) { if (is_array($value) || is_object($value)) { return false; } } return true; } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |