Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify ResultPager instantiation #46

Closed
wants to merge 1 commit into from
Closed

Simplify ResultPager instantiation #46

wants to merge 1 commit into from

Conversation

spawnia
Copy link
Contributor

@spawnia spawnia commented Feb 27, 2024

This simplifies the usage as follows

$manager = app(GitLabManager::class);
-$pager = new ResultPager($manager->connection());
+$pager = $manager->resultPager();

More importantly, it improves discoverability.
Method completion on GitLabManager now provides access to the ResultPager.

This simplifies the usage as follows

```diff
$manager = app(GitLabManager::class);
-$pager = new ResultPager($manager->connection());
+$pager = $manager->resultPager();
```

More importantly, it improves discoverability.
Method completion on `GitLabManager` now provides access to the `ResultPager`.
@GrahamCampbell
Copy link
Owner

Thanks for the idea here, though I'm not sure this makes much of a difference since we still need to get the client object anyway to call something like ->issues(). I'll have a think on how to do this in a more slick way.

@spawnia
Copy link
Contributor Author

spawnia commented Mar 18, 2024

I do not get your point. What do you mean by the client object? For example, the call to ->issues() is indeed simplified by this.

-(new ResultPager($gitlab->connection()))
+$gitlab->resultPager()
    ->fetchAll($gitlab->issues())

There might be ways to improve this further, but why not include a small incremental improvement first?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants