src/Compare.php
public static function identifier($id, ?string $type): array
    {
        if ($id instanceof UrlRoutable) {
            $id = (string) $id->getRouteKey();
        }

        if (is_string($id) || is_int($id)) {
            return ['type' => $type, 'id' => (string) $id];
        }

        if (!Compare::hash($id)) {
            throw new \InvalidArgumentException('Expecting a URL routable, string, integer or array hash.');
        }

        if (isset($id['id']) && $id['id'] instanceof UrlRoutable) {
            $id['id'] = (string) $id['id']->getRouteKey();
        }

        if ($type && !array_key_exists('type', $id)) {
            $id['type'] = $type;
        }

        return $id;
    }
public static function identifier($id, ?string $type): array
    {
        if ($id instanceof UrlRoutable) {
            $id = (string) $id->getRouteKey();
        }

        if (is_string($id) || is_int($id)) {
            return ['type' => $type, 'id' => (string) $id];
        }

        if (!Compare::hash($id)) {
            throw new \InvalidArgumentException('Expecting a URL routable, string, integer or array hash.');
        }

        if (isset($id['id']) && $id['id'] instanceof UrlRoutable) {
            $id['id'] = (string) $id['id']->getRouteKey();
        }

        if ($type && !array_key_exists('type', $id)) {
            $id['type'] = $type;
        }

        return $id;
    }
Ensure the value is a resource identifier.

@param UrlRoutable|string|int|array $id
@param string|null $type
the type to use if $id does not already have a type.
@return array