Returns the arguments to pass to the presenter.

@param mixed   $presenter A PHP callable

@return array

@throws \RuntimeException When value for argument given is not provided

@api
484903
protected function getArguments($presenter)
    {
        if (is_array($presenter)) {
            $r = new \ReflectionMethod($presenter[0], $presenter[1]);
        } elseif (is_object($presenter) && !$presenter instanceof \Closure) {
            $r = new \ReflectionObject($presenter);
            $r = $r->getMethod('__invoke');
        } else {
            $r = new \ReflectionFunction($presenter);
        }

        return $this->doGetArguments($presenter, $r->getParameters());
    }
5622
protected static function runCallback($method, $args)
	{
		$instance = static::resolveFacadeInstance();

		if(empty($args))
		{
			throw new InvalidArgumentException("Please provide an argument to this method");
			
		}

		switch (count($args))
		{
			case 0:
				return $instance->$method();

			case 1:
				return $instance->$method($args[0]);

			case 2:
				return $instance->$method($args[0], $args[1]);

			case 3:
				return $instance->$method($args[0], $args[1], $args[2]);

			case 4:
				return $instance->$method($args[0], $args[1], $args[2], $args[3]);

			default:
				return call_user_func_array(array($instance, $method), $args);
		}
	}
1197301
protected function transformToArray(array $presentation)
    {
        $array = [];

        // iterate over all the presentation values and search for arrays and
        // for the nested special entities, Presentation and Hidden objects
        // and handle each entity in the appropriate way.
        foreach ($presentation as $key => $item) {

            // in case of an array recursively iterate over all the array
            // value and check for special entities.
            if(is_array($item)) {
                $array[$key] = $this->transformToArray($item);
            }

            // if we find an hidden entity ignore the key so it won't be shown in the
            // final presentation then continue to the next item in the presentation
            else if($item instanceof Hidden) {
                continue;
            }

            // if an item is a presentation object run the show function on it to transform
            // the resource presentation tree and save the presentation on the array.
            else if($item instanceof Presentation) {
                $array[$key] = $item->show();
            }

            // on any other value we just save the value and key and move on
            // to the next item.
            else {
                $array[$key] = $item;
            }
        }

        return $array;
    }
429260
protected function resolveCallable($class, $method = '__invoke')
    {
        if ($this->container->has($class)) {
            return [$this->container->get($class), $method];
        }

        if (!class_exists($class)) {
            throw new RuntimeException(sprintf('Callable %s does not exist', $class));
        }

        return [new $class($this->container), $method];
    }
48048
protected function callRenderMethod()
    {
        $renderMethodParameters = [];
        foreach ($this->argumentDefinitions as $argumentName => $argumentDefinition) {
            if ($argumentDefinition instanceof ArgumentDefinition && $argumentDefinition->isMethodParameter()) {
                $renderMethodParameters[$argumentName] = $this->arguments[$argumentName];
            }
        }

        try {
            return call_user_func_array([$this, 'render'], $renderMethodParameters);
        } catch (Exception $exception) {
            if (!$this->objectManager->getContext()->isProduction()) {
                throw $exception;
            }

            $this->logger->error('A Fluid ViewHelper Exception was captured: ' . $exception->getMessage() . ' (' . $exception->getCode() . ')',
                ['exception' => $exception]
            );

            return '';
        }
    }
988248
private function getParameterNamesForDecoratedCall(array $parameters) : array
    {
        return array_map(
            static function (ReflectionParameter $parameter) {
                $name = '';

                if (method_exists($parameter, 'isVariadic')) {
                    if ($parameter->isVariadic()) {
                        $name .= '...';
                    }
                }

                return $name . '$' . $parameter->name;
            },
            $parameters
        );
    }
37415
private static function getArguments(array $arguments = [])
    {
        $args = [];

        foreach ($arguments as $argument) {
            $args[] = $argument instanceof self ? $argument->getMoney() : $argument;
        }

        return $args;
    }
1186773
public function getLink($presenterName, $parameters = array())
	{
		$url = new \Nette\Http\UrlScript($this->context->parameters['selenium']['baseUrl']);
		$url->scriptPath = $url->path;
		$appRequest = new \Nette\Application\Request($presenterName, 'GET', Utils::strToArray($parameters));
		return $this->context->router->constructUrl($appRequest, $url);
	}
779648
protected function getHandler($handler)
    {
        if ($handler instanceof HandlerInterface) {
            return [$handler, 'handleEvent'];
        }

        if (is_callable($handler)) {
            return $handler;
        }

        throw new InvalidArgumentException(
            sprintf('Invalid handler "%s".', is_string($handler) ? $handler : gettype($handler))
        );
    }
145193
public function execute($object)
    {
        $callable = array($object, $this->methodName);

        if (!is_callable($callable)) {
            $className = get_class($object);

            throw new RuntimeException("Method '$this->methodName' does not exist in object of class '$className'");
        }

        return call_user_func_array($callable, $this->params);
    }
549774
public function getArgs($event)
    {
        return [$event->getModel()->getId(), new DcCompat($event->getEnvironment(), $event->getSourceModel())];
    }
365681
public function command($args)
    {
        // Throw if no arguments provided and args less than 2
        if (empty($args) || count($args) < 2) {
            throw new RuntimeException("Invalid argument count");
        }

        $secondArg = $args[1];

        // Output the second argument
        return $secondArg;

    }
297494
private function getArguments(callable $callback, array $callbackArguments)
    {
        $parameters = $this->getParameters($callback);
        $arguments = [];
        foreach ($parameters as $param) {
            if (array_key_exists($param->getName(), $callbackArguments)) {
                $arguments[] = $callbackArguments[$param->getName()];
            } elseif ($param->isDefaultValueAvailable()) {
                $arguments[] = $param->getDefaultValue();
            } else {
                $arguments[$param->getName()] = null;
            }
        }

        return $arguments;
    }
1180725
public function getArgs($event)
    {
        return [
            new DcCompat($event->getEnvironment(), $event->getModel()),
            $event->getModel()->getPropertiesAsArray(),
            $event->getEnvironment()->getDataDefinition()->getName(),
            $event->isCircularReference(),
            $event->getContainedModels(),
            $event->getPrevious() ? $event->getPrevious()->getId() : null,
            $event->getNext() ? $event->getNext()->getId() : null
        ];
    }
479699
public function render(string $presenter = null, bool $specialSidebar = false): string
    {
        $this->resolveItems($this->items);

        if (! is_null($this->view)) {
            return $this->renderView($presenter, $specialSidebar)->render();
        }

        (! $presenter || ! $this->presenterExists($presenter)) || $this->setPresenter($presenter);

        return $this->renderMenu($specialSidebar);
    }
957954
public function render(string $name, string $presenter = null, array $bindings = [], bool $specialSidebar = false): ?string
    {
        if ($this->has($name)) {
            $instance = $this->instance($name);

            $this->callbacks->get($name)->each(function ($callback) use ($instance) {
                $reflectionParams = collect((new ReflectionFunction($callback))->getParameters());
                $reflectionParams->shift();

                collect($reflectionParams)->each(function ($param) use (&$params) {
                    $params[] = Route::current()->hasParameter($param->getName()) ? Route::current()->parameter($param->getName())
                        : (class_exists($param->getClass()->getName()) ? app($param->getClass()->getName()) : null);
                });

                $params ? $callback($instance, ...$params) : $callback($instance);
            });

            return $instance->setBindings($bindings)->render($presenter, $specialSidebar);
        }

        return null;
    }
213131
protected function getPayloadFromEvent($event)
    {
        if (method_exists($event, 'broadcastWith')) {
            return $event->broadcastWith();
        }

        $payload = array();

        //
        $reflection = new ReflectionClass($event);

        foreach ($reflection->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
            $key = $property->getName();

            $value = $property->getValue($event);

            $payload[$key] = $this->formatProperty($value);
        }

        return $payload;
    }