Skip to content

Commit

Permalink
user php's http_build_query instead of AbstractApi::http_build_str
Browse files Browse the repository at this point in the history
  • Loading branch information
kbsali committed Jun 19, 2013
1 parent dbe7fde commit 2c31b72
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 26 deletions.
19 changes: 0 additions & 19 deletions lib/Redmine/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,4 @@ protected function delete($path)
{
return $this->client->delete($path);
}

public function http_build_str($query, $prefix='', $arg_separator='')
{
if (!is_array($query)) {
return null;
}
if ('' === $arg_separator) {
$arg_separator = ini_get('arg_separator.output');
}
$args = array();
foreach ($query as $key => $val) {
$name = $prefix.$key;
if (!is_numeric($name)) {
$args[] = rawurlencode($name).'='.urlencode($val);
}
}

return implode($arg_separator, $args);
}
}
2 changes: 1 addition & 1 deletion lib/Redmine/Api/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function create(array $params = array())
*/
public function show($id, array $params = array())
{
return $this->get('/groups/'.urlencode($id).'.json?'.$this->http_build_str($params));
return $this->get('/groups/'.urlencode($id).'.json?'.http_build_query($params));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Redmine/Api/Issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Issue extends AbstractApi
*/
public function all(array $params = array())
{
return $this->get('/issues.json?'.$this->http_build_str($params));
return $this->get('/issues.json?'.http_build_query($params));
}

/**
Expand All @@ -50,7 +50,7 @@ public function all(array $params = array())
*/
public function show($id, array $params = array())
{
return $this->get('/issues/'.urlencode($id).'.json?'.$this->http_build_str($params));
return $this->get('/issues/'.urlencode($id).'.json?'.http_build_query($params));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Redmine/Api/IssueCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,6 @@ public function update($id, array $params)
*/
public function remove($id, array $params = array())
{
return $this->delete('/issue_categories/'.$id.'.xml?'.$this->http_build_str($params));
return $this->delete('/issue_categories/'.$id.'.xml?'.http_build_query($params));
}
}
2 changes: 1 addition & 1 deletion lib/Redmine/Api/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Project extends AbstractApi
*/
public function all(array $params = array())
{
$this->projects = $this->get('/projects.json?'.$this->http_build_str($params));
$this->projects = $this->get('/projects.json?'.http_build_query($params));

return $this->projects;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Redmine/Api/TimeEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TimeEntry extends AbstractApi
*/
public function all(array $params = array())
{
$this->timeEntries = $this->get('/time_entries.json?'.$this->http_build_str($params));
$this->timeEntries = $this->get('/time_entries.json?'.http_build_query($params));

return $this->timeEntries;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Redmine/Api/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class User extends AbstractApi
*/
public function all(array $params = array())
{
$this->users = $this->get('/users.json?'.$this->http_build_str($params));
$this->users = $this->get('/users.json?'.http_build_query($params));

return $this->users;
}
Expand Down

0 comments on commit 2c31b72

Please sign in to comment.