Go\Proxy\AbstractProxy::prepareArgsLine PHP Méthode

prepareArgsLine() protected méthode

Prepares a line with args from the method definition
protected prepareArgsLine ( ReflectionFunctionAbstrac\ReflectionFunctionAbstract $functionLike ) : string
$functionLike ReflectionFunctionAbstrac\ReflectionFunctionAbstract
Résultat string
    protected function prepareArgsLine(ReflectionFunctionAbstract $functionLike)
    {
        $argumentsPart = [];
        $arguments = [];
        $hasOptionals = false;
        foreach ($functionLike->getParameters() as $parameter) {
            $byReference = $parameter->isPassedByReference() && !$parameter->isVariadic() ? '&' : '';
            $hasOptionals = $hasOptionals || $parameter->isOptional();
            $arguments[] = $byReference . '$' . $parameter->name;
        }
        $isVariadic = $functionLike->isVariadic();
        if ($isVariadic) {
            $argumentsPart[] = array_pop($arguments);
        }
        if (!empty($arguments)) {
            // Unshifting to keep correct order
            $argumentLine = '[' . join(', ', $arguments) . ']';
            if ($hasOptionals) {
                $argumentLine = "\\array_slice({$argumentLine}, 0, \\func_num_args())";
            }
            array_unshift($argumentsPart, $argumentLine);
        }
        return join(', ', $argumentsPart);
    }