$required) { $vars[$key] = isset($post[$key]) && ((bool)$post[$key]) && strtolower((string)$post[$key]) != "off" ? htmlspecialchars($post[$key], ENT_QUOTES | ENT_SUBSTITUTE) : null; if ($vars[$key] == null && $required) throw new \Symfony\Component\HttpClient\Exception\InvalidArgumentException( sprintf("Missing required argmuent: %s", $key) ); } return new static(...array_values($vars)); } final public static function getPostParams(): array { $vars = []; foreach ((new ReflectionClass(static::class))->getConstructor()->getParameters() as $param) $vars[$param->getName()] = !$param->isOptional() || !$param->allowsNull(); return $vars; } }