Skip to content

Commit

Permalink
Fix issue where calling methods with positional parameters causes par…
Browse files Browse the repository at this point in the history
…ameters to be lost if the first is null (e.g. $api->findLeads(null, 'id', 'asc', 50))
  • Loading branch information
Mason Malone committed Jul 13, 2012
1 parent 5248e81 commit f8bde55
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions NutshellApi.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@ function __destruct() {
*/ */
public function __call($name, $args) { public function __call($name, $args) {
$params = null; $params = null;
if (isset($args[0])) { if (count($args) === 1 && is_array($args[0])) {
if (is_array($args[0])) { // e.g. $api->getLead(array('leadId' => 11))
// e.g. $api->getLead(array('leadId' => 11)) $params = $args[0];
$params = $args[0]; } else {
} else { // e.g. $api->getLead(11)
// e.g. $api->getLead(11) $params = $args;
$params = $args;
}
} }
return $this->call($name, $params); return $this->call($name, $params);
} }
Expand Down

0 comments on commit f8bde55

Please sign in to comment.