Skip to content

Allow to provide parameters for PullRequests list #136

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

Merged
merged 4 commits into from
Jun 24, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions lib/Github/Api/PullRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,13 @@ class PullRequest extends AbstractApi
*
* @param string $username the username
* @param string $repository the repository
* @param string $state the state of the fetched pull requests.
* The API seems to automatically default to 'open'
* @param integer $page the page
* @param integer $perPage the per page
* @param array $params a list of extra parameters.
*
* @return array array of pull requests for the project
*/
public function all($username, $repository, $state = null, $page = 1, $perPage = 30)
public function all($username, $repository, array $params = array())
{
$parameters = array(
'page' => $page,
'per_page' => $perPage,
'state' => $state,
);

return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters);
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space after variable params

}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add $defaults array containing basic values from constructor and merge it

<?php

$parameters = array_merge(array(
    'page' => 1,
    'per_page' => 30
), $params);

Expand Down