src/Store/IdentityMap.php
public function add(ResourceIdentifierInterface $identifier, $record)
    {
        if (!is_object($record) && !is_bool($record)) {
            throw new InvalidArgumentException('Expecting an object or a boolean to add to the identity map.');
        }

        $existing = $this->lookup($identifier);

        if (is_object($existing) && is_bool($record)) {
            throw new InvalidArgumentException('Attempting to push a boolean into the map in place of an object.');
        }

        $this->map[$identifier->toString()] = $record;

        return $this;
    }
public function add(ResourceIdentifierInterface $identifier, $record)
    {
        if (!is_object($record) && !is_bool($record)) {
            throw new InvalidArgumentException('Expecting an object or a boolean to add to the identity map.');
        }

        $existing = $this->lookup($identifier);

        if (is_object($existing) && is_bool($record)) {
            throw new InvalidArgumentException('Attempting to push a boolean into the map in place of an object.');
        }

        $this->map[$identifier->toString()] = $record;

        return $this;
    }
Add a record to the identity map for a resource identifier.

The record can either be a boolean (the result of a store's `exists()` check), or the actual
record itself. However, a boolean cannot be inserted into the map if the map already holds the
record itself.

@param ResourceIdentifierInterface $identifier
@param object|bool $record
@return $this