Format the arguments with the given printf format string.

@param array $arguments The arguments for vsprintf
@param string $value string to format
@return string The formatted value
@api
190437
public function render(array $arguments, $value = null)
    {
        return self::renderStatic(array('arguments' => $arguments, 'value' => $value), $this->buildRenderChildrenClosure(), $this->renderingContext);
    }
1133635
public function validate($value, array $arguments = [])
    {
        $min = Arr::get($arguments, 'min', false);
        $max = Arr::get($arguments, 'max', false);
        $callable = Arr::get($arguments, 'callable', false);
        $json = Arr::get($arguments, 'json', false);
        $filter = Arr::get($arguments, 'filter', false);

        if ($json && $this->isJson($value)) {
            $value = json_decode($value);
        }

        $isArray = is_array($value);

        if (!$isArray) {
            throw new Exception("O atributo '{$this->getAttribute()}' não é um array!");
        }

        $count = count($value);

        if ($min) {
            $min = intval($min);
        } else {
            $min = false;
        }

        if ($max) {
            $max = intval($max);
        } else {
            $max = false;
        }

        if ($min) {

            if ($count < $min) {
                throw new Exception("O atributo '{$this->getAttribute()}' deve ter no minimo '{$min}' elemento(s)!");
            } elseif ($max && $count > $max) {
                throw new Exception("O atributo '{$this->getAttribute()}' deve ter no máximo '{$max}' elemento(s)!");
            }
        }

        if ($callable) {
            $false = 0;

            if (is_string($callable) && function_exists($callable)) {
                foreach ($value as $item) {
                    if (!call_user_func($callable, $item)) {
                        $false++;
                    }
                }
            } elseif (is_callable($callable)) {
                foreach ($value as $item) {
                    if (!$callable($item)) {
                        $false++;
                    }
                }
            } else {
                throw new Exception("Não foi possivel aplicar a validação no atributo '{$this->getAttribute()}'!");
            }

            if ($false > 0) {
                throw new Exception("{$false} elemento(s) do atributo'{$this->getAttribute()}' não passou(passaram) na validação!");
            }
        }

        if ($filter && $filter instanceof \Closure) {
            $value = $filter($value);
        } elseif ($filter) {
            $value = call_user_func($filter, $value);
        }

        return $value;
    }
937617
public static function format(string $format, ...$arguments): self
    {
        $text = sprintf($format, ...$arguments);

        return new static($text);
    }
331723
protected function formatValue($value)
    {
        if ($this->formatValue !== NULL) {
            return str_replace(static::VALUE_IDENTIFIER, $value, $this->formatValue);
        } else {
            return $value;
        }
    }
799946
private static function formatValue($value)
    {
        // The `$value` argument could be a number (example: 123) or a numeric
        // string (example: '123'). A numeric string is recommended for
        // 32-bit systems to prevent unexpected truncation.
        //
        // To use a numeric string in a WHERE condition, it needs to be
        // wrapped in a pair of quotes.
        // For example:
        //     SELECT Id WHERE Id = '9223372036854775807'
        if (is_numeric($value) && !is_string($value)) {
            return $value;
        }

        return sprintf('\'%s\'', addslashes($value));
    }
525781
public static function arg($value): string
    {
        switch (gettype($value)) {
            case 'NULL':
                return 'NULL';
            case 'boolean':
                return $value ? 'true' : 'false';
            case 'array':
                return 'Array';
            case 'object':
                return 'Object('.get_class($value).')';
            case 'string':
                return "'".self::cutString((string)$value)."'";
            default:
                return (string)$value;
        }
    }
800348
private function filterNumberFormat($value, $argument = null)
    {
        if ($argument and is_int($argument)) {
            $value = number_format($value, $argument);
        }

        return $value;
    }
1123505
public static function format($value)
    {
        $value = Utils::toString($value);
        $bn = Utils::toBn($value);
        $int = (int) $bn->toString();

        return $int;
    }
1203246
public function format($value): string
    {
        $namespace = explode('\\', get_class($value));
        $class = array_pop($namespace);
        $regex = '/(?<!^)((?<![[:upper:]])[[:upper:]]|[[:upper:]](?![[:upper:]]))/';

        return preg_replace($regex, ' $1', $class);
    }
676273
public static function format(float $value) : string
    {
        $formatter = new NumberFormatter(self::translator()->getIETF(), NumberFormatter::DECIMAL);

        return $formatter->format($value);
    }
834527
protected function buildArguments($value, array $args = null)
    {
        if (! $args) {
            return (array) $value;
        }

        $valuePosition = array_search(static::PLACEHOLDER_VALUE, $args, true);

        if ($valuePosition === false) {
            return array_merge((array) $value, $args);
        } else {
            $args[$valuePosition] = $value;
        }

        return $args;
    }
1118752
public function format($value)
    {
        if (!$this->validate($value))
            throw new \InvalidArgumentException("`{$value}` is not a valid HTTP URI");

        $url = Http::createFromString($value);

        if ($url->getScheme() == '') {
            $url = $url->withScheme('http');
        }

        return (String)$url;
    }
652736
public function format($value): string
    {
        $value = $value->rate();

        if ($value instanceof PercentageDiscount) {
            return (new PercentFormatter($value))->format($value);
        }

        if ($value instanceof ValueDiscount) {
            return (new MoneyFormatter())->format($value);
        }
    }
403233
protected function formatParameter($value)
    {
        if (\is_bool($value) || \is_array($value) || (null === $value)) {
            $jsonString = json_encode($value);

            if (preg_match('/^(.{60})./us', $jsonString, $matches)) {
                return $matches[1].'...';
            }

            return $jsonString;
        }

        return (string) $value;
    }
169450
public static function format($value)
    {
        if (isset($value['gas'])) {
            $value['gas'] = QuantityFormatter::format($value['gas']);
        }
        if (isset($value['gasPrice'])) {
            $value['gasPrice'] = QuantityFormatter::format($value['gasPrice']);
        }
        if (isset($value['value'])) {
            $value['value'] = QuantityFormatter::format($value['value']);
        }
        if (isset($value['data'])) {
            $value['data'] = HexFormatter::format($value['data']);
        }
        if (isset($value['nonce'])) {
            $value['nonce'] = QuantityFormatter::format($value['nonce']);
        }
        return $value;
    }
476636
protected static function formatValue($value)
    {
        if ($value instanceof \DateTime) {
            $value = $value->format(\DateTime::ISO8601);
        } elseif (\is_bool($value)) {
            $value = $value ? 'True' : 'False';
        } elseif (\is_array($value) || $value instanceof \IteratorAggregate) {
            $itValue = $value instanceof \IteratorAggregate ? $value->getIterator() : $value;
            $value = [];
            foreach ($itValue as $key => $arrayValue) {
                $value[$key] = static::formatValue($arrayValue);
            }
            $value = implode("\n  ", $value);
        }

        return (string) $value;
    }
1068175
public static function format($value)
    {
        if (isset($value['priority'])) {
            $value['priority'] = QuantityFormatter::format($value['priority']);
        }
        if (isset($value['ttl'])) {
            $value['ttl'] = QuantityFormatter::format($value['ttl']);
        }
        return $value;
    }