src/Relay/Connection/ArrayConnection.php
public static function cursorToOffsetWithDefault($cursor, $default, $array = [])
    {
        if (!is_string($cursor)) {
            return $default;
        }

        $key = self::cursorToKey($cursor);
        if (empty($array)) {
          $offset = $key;
        }
        else {
          $offset = array_search($key, array_keys($array));
        }

        return is_null($offset) ? $default : (int) $offset;
    }
public static function cursorToOffsetWithDefault($cursor, $default, $array = [])
    {
        if (!is_string($cursor)) {
            return $default;
        }

        $key = self::cursorToKey($cursor);
        if (empty($array)) {
          $offset = $key;
        }
        else {
          $offset = array_search($key, array_keys($array));
        }

        return is_null($offset) ? $default : (int) $offset;
    }
Converts a cursor to an array offset.

@param $cursor
The cursor string.
@param $default
The default value, in case the cursor is not given.
@param array $array
The array to use in counting the offset. If empty, assumed to be an indexed array.
@return int|null