Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion doc/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ You can sort results using 2-3 arguments.

```php
$repos = $client->api('search')->repositories('...', 'created', 'asc');
$files = $client->api('search')->code('...........', 'indexed', 'desc');
$issues = $client->api('search')->issues('.........', 'comments', 'asc');
$users = $client->api('search')->users('..........', 'followers', 'asc');
$commits = $client->api('search')->commits('..........', 'author-date', 'desc');
Expand Down
12 changes: 5 additions & 7 deletions lib/Github/Api/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ public function issues($q, $sort = 'updated', $order = 'desc')
*
* @link https://developer.github.com/v3/search/#search-code
*
* @param string $q the filter
* @param string $sort the sort field
* @param string $order asc/desc
* @param string $q the filter
*
* @return array list of code found
*/
public function code($q, $sort = 'updated', $order = 'desc')
public function code(string $q)
{
return $this->get('/search/code', ['q' => $q, 'sort' => $sort, 'order' => $order]);
return $this->get('/search/code', ['q' => $q]);
}

/**
Expand All @@ -69,11 +67,11 @@ public function code($q, $sort = 'updated', $order = 'desc')
*
* @return array list of code found
*/
public function codeWithMatch(string $q, string $sort = 'updated', string $order = 'desc'): array
public function codeWithMatch(string $q): array
{
$this->acceptHeaderValue = 'application/vnd.github.v3.text-match+json';

return $this->code($q, $sort, $order);
return $this->code($q);
}

/**
Expand Down