Render the arguments of a function.

@param $args
@return string
961865
private function dumpArgs($args)
    {
        foreach ($args as $key => $arg) {
            if (is_object($arg)) {
                $v = '{' . get_class($arg) . '}';
            }
            else if (is_array($arg)) {
                $v = '[' . $this->dumpArgs($arg) . ']';
            }
            else if (is_string($arg)) {
                $v = '"' . (strlen($arg) <= 16 ? $arg : trim(substr($arg, 0, 15)) . '...') . '"';
            }
            else if (is_bool($arg)) {
                $v = $arg ? 'true' : 'false';
            }
            else if ($arg === null) {
                $v = 'null';
            }
            else {
                $v = $arg;
            }

            $args[$key] = is_string($key) ? '"' . $key . '" => ' . $v : $v;
        }

        return implode(', ', $args);
    }
614028
public static function dumpVars(...$args): string
    {
        \ob_start();
        \var_dump(...$args);
        $string = \ob_get_clean();

        return \preg_replace("/=>\n\s+/", '=> ', $string);
    }
859983
protected function processArguments($arguments)
    {
        if (false === is_array($arguments)) {
            return $arguments;
        }

        return array_map(function ($argument) {
            return (string) $argument;
        }, $arguments);
    }
946079
private function formatArgs(array $args)
    {
        $result = array();
        foreach ($args as $key => $item) {
            if ('object' === $item[0]) {
                $formattedValue = sprintf("<em>object</em>(%s)", $this->abbrClass($item[1]));
            } elseif ('array' === $item[0]) {
                $formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
            } elseif ('string'  === $item[0]) {
                $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset));
            } elseif ('null' === $item[0]) {
                $formattedValue = '<em>null</em>';
            } elseif ('boolean' === $item[0]) {
                $formattedValue = '<em>' . strtolower(var_export($item[1], true)) . '</em>';
            } elseif ('resource' === $item[0]) {
                $formattedValue = '<em>resource</em>';
            } else {
                $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), true));
            }

            $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
        }

        return implode(', ', $result);
    }
1300606
protected function callStringCallback($callback, $args = [])
    {
        if (strpos($callback, '@')) {
            list($klass, $method) = explode('@', $callback);
        } else {
            $klass  = $callback;
            $method = 'render';
        }

        $klass = isset($this->instantiatedWidgets[$klass]) ? $this->instantiatedWidgets[$klass] : new $klass;

        return call_user_func_array([$klass, $method], $args);
    }
1139244
public static function _describeArg($arg)
    {
        if (is_array($arg)) {
            return sprintf('array[%d]', count($arg));
        }
        if (is_object($arg)) {
            return sprintf('object[%s]', get_class($arg));
        }

        return Text::toString($arg);
    }
492427
private function parse_args($args = [])
    {
        $args['NAMESPACE'] = '';

        $class_name = $this->sanitise_filename($args['CLASSNAME']);

        if ($this->is_nested_directory($class_name)) {
            $parts = \explode('\\', $class_name);
            $class = \array_pop($parts);

            $args['NAMESPACE'] = '\\' . \implode('\\', $parts);
            $args['CLASSNAME'] = $class;
        }

        return $args;
    }
656230
public function renderCall($method, array $arguments = [], $semicolon = false, $newLine = false)
    {
        return $this->renderCode(
            $method.$this->renderArguments($arguments),
            $semicolon,
            $newLine
        );
    }
1131697
function renderAllowCloning( $args ) {
		$options = get_site_option( $this->getSlug() );
		$this->renderCheckbox(
			[
				'id' => 'enable_cloning',
				'name' => $this->getSlug(),
				'option' => 'enable_cloning',
				'value' => ( isset( $options['enable_cloning'] ) ) ? $options['enable_cloning'] : '',
				'label' => $args[0],
			]
		);
	}
698245
protected function getSafeArguments(array $args)
    {
        $argsSafe = [];
        foreach ($args as $arg) {
            $type = gettype($arg);
            switch ($type) {
                case 'string':
                    $argsSafe[] = sprintf('<span>"%s"</span>', Html::trimText($arg, 30));
                    break;

                case 'integer':
                case 'float':
                    $argsSafe[] = sprintf('<span>%s</span>', $arg);
                    break;

                case 'object':
                    $className = get_class($arg);
                    $shortName = (new \ReflectionClass($arg))->getShortName();
                    $argsSafe[] = sprintf('<abbr title="%s">%s</abbr>', $className, $shortName);
                    break;

                case 'boolean':
                    $argsSafe[] = $arg ? '[true]' : '[false]';
                    break;

                default:
                    $argsSafe[] = '[' . $type . ']';
            }
        }

        return $argsSafe;
    }
1081921
function renderAllowRootApi( $args ) {
		$options = get_site_option( $this->getSlug() );
		$this->renderCheckbox(
			[
				'id' => 'enable_network_api',
				'name' => $this->getSlug(),
				'option' => 'enable_network_api',
				'value' => ( isset( $options['enable_network_api'] ) ) ? $options['enable_network_api'] : '',
				'label' => $args[0],
			]
		);
	}
139206
protected function _translateArgs($args) {
		foreach ((array)$args as $k => $arg) {
			if (is_string($arg)) {
				$args[$k] = __d($this->validationDomain, $arg);
			}
		}
		return $args;
	}
190437
public function render(array $arguments, $value = null)
    {
        return self::renderStatic(array('arguments' => $arguments, 'value' => $value), $this->buildRenderChildrenClosure(), $this->renderingContext);
    }
931748
protected function getArgumentsAsString(array $args)
    {
        $result = [];
        $isNumeric = Jasny\is_numeric_array($args);
        $stringify = function ($input) {
            return sprintf("'%s'", addcslashes($input, "'"));
        };

        foreach ($args as $key => $arg) {
            switch (strtolower(gettype($arg))) {
                case 'string':
                    $string = $stringify($arg);
                    break;

                case 'object':
                    $string = get_class($arg);
                    break;

                case 'array':
                    $string = "[{$this->getArgumentsAsString($arg)}]";
                    break;

                case 'null':
                    $string = 'null';
                    break;

                case 'boolean':
                    $string = $arg ? 'true' : 'false';
                    break;

                case 'resource':
                    $string = sprintf('*%s', get_resource_type($arg));
                    break;

                default:
                    $string = $arg;
            }

            if ($isNumeric === false) {
                $result[] = is_string($key) === true ? $stringify($key) . ' => ' . $string : $string;
            } else {
                $result[] = $string;
            }
        }

        return join(', ', $result);
    }
258115
protected static function renderArgument( $argument )
	{
		switch( gettype( $argument ) )
		{
			case 'NULL':																			//  handle NULL
				return '<em>NULL</em>';
			case 'boolean':																			//  handle boolean
				return $argument ? "<em>TRUE</em>" : "<em>FALSE</em>";
			case 'array':																			//  handle array
				return self::renderArgumentArray( $argument );
			case 'object':																			//  handle object
				return get_class( $argument );
			default:																				//  handle integer/double/float/real/resource/string
				return self::secureString( (string) $argument );
		}
	}
509599
private function getParams(array $args)
    {
        if (count($args) == 0) {
            return [];
        }

        $params = array_slice($args, -1)[0];

        return is_array($params) ? $params : [];
    }
549085
private function renderParams($parameters)
    {
        if(is_array($parameters))
        {
            // We have an array, we'll need to make sure we get all of the items setup correctly
            $paramArray = array();
            foreach($parameters as $param)
            {
                // make it JS ready for all params
                $paramArray[] = json_encode($param, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
            }
            $parameters = implode(", ", $paramArray);
        }
        
        // Return what we were given.. just in a better format!
        return $parameters;
    }