public static Issue getIssue(Uri uri) {
        List<String> segments = uri.getPathSegments();
        if (segments.size() < 4) {
            return null;
        }
        if (!"issues".equals(segments.get(2)) && !"pull".equals(segments.get(2))) {
            return null;
        }

        String repoOwner = segments.get(0);
        if (!RepositoryUtils.isValidOwner(repoOwner)) {
            return null;
        }

        String repoName = segments.get(1);
        if (!RepositoryUtils.isValidRepo(repoName)) {
            return null;
        }

        String number = segments.get(3);
        if (TextUtils.isEmpty(number)) {
            return null;
        }

        int issueNumber;
        try {
            issueNumber = Integer.parseInt(number);
        } catch (NumberFormatException nfe) {
            return null;
        }
        if (issueNumber < 1) {
            return null;
        }

        Repository repo = InfoUtils.createRepoFromData(repoOwner, repoName);
        return Issue.builder()
                .repository(repo)
                .number(issueNumber)
                .build();
    }
Parse a {@link Issue} from a non-null {@link Uri}

@param uri
@return {@link Issue} or null if none found in given
        {@link Uri}
app/src/main/java/com/github/pockethub/android/core/issue/IssueUriMatcher.java