src/IdentityMap.php
public static function with(array $theseObjects): MapsObjectsByIdentity
    {
        $objects = [];
        $entityIds = [];
        foreach ($theseObjects as $id => $object) {
            $objects = IdentityMap::addTo($objects, (string) $id, $object);
            $entityIds[theInstanceIdOf($object)] = (string) $id;
        }
        return new self($objects, $entityIds);
    }
public static function with(array $theseObjects): MapsObjectsByIdentity
    {
        $objects = [];
        $entityIds = [];
        foreach ($theseObjects as $id => $object) {
            $objects = IdentityMap::addTo($objects, (string) $id, $object);
            $entityIds[theInstanceIdOf($object)] = (string) $id;
        }
        return new self($objects, $entityIds);
    }
Produces a new identity map that contains the objects.

@param object[] $theseObjects The objects to add, as [id => object]
@return MapsObjectsByIdentity The map of objects.