/
qK1e
/
php-method-overloading
Обзор
Документация
Войти
/
qK1e
/
php-method-overloading
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.9
src/Call.php
22 строки
511 B
Pavlovich
Version 0.9, First fit algorithm
25 май 2024, 22:24
25 май 2024, 22:24
361c891
Код
Авторство
О чём код?
<?php namespace qK1e\Overloading; use Closure; class Call { /** * @param Closure[]|callable[] $functions */ public static function firstFit(array $functions, $args, $context) { foreach ($functions as $function) { if ((new CandidateFunction($function))->signatureFits($args)) { return $function->call($context, ...$args); } } throw new SignatureException("Not function fits passed arguments"); } }