mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
API Make SearchVariant::call(...) arguments variadic
This commit is contained in:
parent
6f8ef48a9b
commit
193fe8139e
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user