public function __construct(array
$links,
$context = NULL
) { assert(Inspector::
assertAll(function D
$key) { return static::
validKey($key);
},
array_keys($links)));
assert(Inspector::
assertAll(function D
$link) { return $link instanceof Link ||
is_array($link) && Inspector::
assertAllObjects($link, Link::
class);
},
$links));
assert(is_null($context) || Inspector::
assertAllObjects([$context], JsonApiDocumentTopLevel::
class, ResourceObject::
class, Relationship::
class));
ksort($links);
$this->links =
array_map(function D
$link) { return is_array($link) ?
$link :
[$link];
},
$links);
$this->context =
$context;
}