Merge pull request #180 from creative-commoners/pulls/3.0/symbiote-namespaces-update

API Make SearchVariant::call(...) arguments variadic
This commit is contained in:
Robbie Averill 2017-11-30 13:24:14 +13:00 committed by GitHub
commit 71107e0e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}