API Make SearchVariant::call(...) arguments variadic

This commit is contained in:
Raissa North 2017-11-30 12:01:57 +13:00
parent 6f8ef48a9b
commit 193fe8139e
2 changed files with 5 additions and 4 deletions

View File

@ -152,9 +152,10 @@ abstract class SearchVariant
*
* SearchVariant::call(...) ==== SearchVariant::with()->call(...);
*/
public static function call($method, &$a1 = null, &$a2 = null, &$a3 = null, &$a4 = null, &$a5 = null, &$a6 = null, &$a7 = null)
public static function call($method, &...$args)
{
return self::with()->call($method, $a1, $a2, $a3, $a4, $a5, $a6, $a7);
return self::with()->call($method, ...$args);
}
/**

View File

@ -14,13 +14,13 @@ class SearchVariant_Caller
$this->variants = $variants;
}
public function call($method, &$a1 = null, &$a2 = null, &$a3 = null, &$a4 = null, &$a5 = null, &$a6 = null, &$a7 = null)
public function call($method, &...$args)
{
$values = array();
foreach ($this->variants as $variant) {
if (method_exists($variant, $method)) {
$value = $variant->$method($a1, $a2, $a3, $a4, $a5, $a6, $a7);
$value = $variant->$method(...$args);
if ($value !== null) {
$values[] = $value;
}