protected function matchedId($filter): bool
    {
        if (!$this instanceof IdentifiableEntity) {
            return false;
        }

        $id = $this->getId();

        return is_scalar($id) && is_scalar($filter) ? (string)$id === (string)$filter : $id === $filter;
    }