$approved tool name => fingerprint pinned at approval */ public function __construct( public string $id, public string $url, public string $headerName, public string $headerValue, public string $prefix, public float $timeout = 30.0, public int $maxBytes = 1048576, public array $approved = [], ) {} /** * print_r() and var_dump() read this, and show every field with the header value replaced by * `[redacted]`. var_export(), serialize(), json_encode() and an (array) cast do not read it, * and write the value. * * @return array */ public function __debugInfo(): array { return array_replace(get_object_vars($this), ['headerValue' => '[redacted]']); } /** * The row carries `header_value`, so it is a #[\SensitiveParameter]: a trace taken while it is * read, with zend.exception_ignore_args off, holds a SensitiveParameterValue in this frame. * * @param array $row one `toolkits.mcp_servers` row */ public static function fromSettings(#[\SensitiveParameter] array $row): self { $approved = []; foreach ((array) ($row['approved'] ?? []) as $name => $fingerprint) { if (is_string($name) && is_string($fingerprint)) { $approved[$name] = $fingerprint; } } $timeout = (float) ($row['timeout'] ?? 0); $maxBytes = (int) ($row['max_bytes'] ?? 0); return new self( (string) ($row['id'] ?? ''), (string) ($row['url'] ?? ''), (string) ($row['header_name'] ?? ''), (string) ($row['header_value'] ?? ''), (string) ($row['prefix'] ?? ''), $timeout > 0 ? $timeout : 30.0, $maxBytes > 0 ? $maxBytes : 1048576, $approved, ); } }