Skip to content

Commit

Permalink
Merge pull request #91 from Arul-/patch-2
Browse files Browse the repository at this point in the history
Fix: method validation in both send and call
  • Loading branch information
sc0Vu authored Jun 14, 2018
2 parents be7403a + 3d8a567 commit d0559b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ public function send()
$method = array_splice($arguments, 0, 1)[0];
$callback = array_pop($arguments);

if (!is_string($method) && !isset($this->functions[$method])) {
throw new InvalidArgumentException('Please make sure the method is existed.');
if (!is_string($method) || !isset($this->functions[$method])) {
throw new InvalidArgumentException('Please make sure the method exists.');
}
$function = $this->functions[$method];

Expand Down Expand Up @@ -468,8 +468,8 @@ public function call()
$method = array_splice($arguments, 0, 1)[0];
$callback = array_pop($arguments);

if (!is_string($method) && !isset($this->functions[$method])) {
throw new InvalidArgumentException('Please make sure the method is existed.');
if (!is_string($method) || !isset($this->functions[$method])) {
throw new InvalidArgumentException('Please make sure the method exists.');
}
$function = $this->functions[$method];

Expand Down Expand Up @@ -621,4 +621,4 @@ public function getData()
return $functionData;
}
}
}
}

0 comments on commit d0559b8

Please sign in to comment.