outputFormat

@param mixed $value
@param string $name
@return string
761798
public function outputFormat($value, $name)
    {
        $strLen = mb_substr($value, 0, 64);
        $strValue = mb_substr($value, 64);
        $match = [];

        if (preg_match('/^[0]+([a-f0-9]+)$/', $strLen, $match) === 1) {
            $strLen = BigNumberFormatter::format('0x' . $match[1])->toString();
        }
        $strValue = mb_substr($strValue, 0, (int) $strLen * 2);

        return Utils::hexToBin($strValue);
    }
1260058
static function format($value,$format)
    {
        $f = Utility::get($format, "format", true);
        if ($f===false) {
            return $value;
        }
        
        $type = Utility::get($format, "type", "unknown");
        switch($type)
        {
        case "number":
            $decimals = Utility::get($format, "decimals", 0);
            $dec_point = Utility::get(
                $format,
                "decPoint",
                Utility::get(
                    $format,
                    "decimalPoint",
                    Utility::get(
                        $format,
                        "dec_point",
                        "."
                    )
                )
            );

            $thousand_sep = Utility::get(
                $format,
                "thousandSep",
                Utility::get(
                    $format,
                    "thousandSeparator",
                    Utility::get(
                        $format,
                        "thousand_sep",
                        ","
                    )
                )
            );
            $prefix = Utility::get($format, "prefix", "");
            $suffix = Utility::get($format, "suffix", "");
            return $prefix
                .number_format($value, $decimals, $dec_point, $thousand_sep)
                .$suffix;
            break;
        case "string":
            $prefix = Utility::get($format, "prefix", "");
            $suffix = Utility::get($format, "suffix", "");
            return $prefix.$value.$suffix;
            break;
        case "datetime":
            $dateFormat = Utility::get($format, "format", "Y-m-d H:i:s");
        case "date":
            $dateFormat = isset($dateFormat)
                ?$dateFormat
                :Utility::get($format, "format", "Y-m-d");
        case "time":
            $dateFormat = isset($dateFormat)
                ?$dateFormat
                :Utility::get($format, "format", "H:i:s");
            $displayFormat = Utility::get($format, "displayFormat");
            if ($displayFormat && $value) {
                if ($fvalue = \DateTime::createFromFormat($dateFormat, $value)) {
                    return $fvalue->format($displayFormat);
                }
            }
            break;
        }
        return $value;
    }
1169997
protected function format($parameter, $value)
    {
        if ($value) {
            if (is_bool($value)) {
                return strlen($parameter) === 1 ? '-'.$parameter : '--'.$parameter;
            }
            return strlen($parameter) === 1 ? '-'.$parameter.$value : '--'.$parameter.'='.$value;
        }
        return '';
    }
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);
    }
376849
protected function formatValue($value)
    {
        if (\is_object($value)) {
            return sprintf('object(%s)', \get_class($value));
        }

        if (\is_string($value)) {
            return $value;
        }

        return preg_replace("/\n\s*/s", '', var_export($value, true));
    }
1145389
public function decode($value, $offset, $name)
    {
        if ($this->isDynamicArray($name)) {
            $arrayOffset = (int) Utils::toBn('0x' . mb_substr($value, $offset * 2, 64))->toString();
            $length = (int) Utils::toBn('0x' . mb_substr($value, $arrayOffset * 2, 64))->toString();
            $arrayStart = $arrayOffset + 32;

            $nestedName = $this->nestedName($name);
            $nestedStaticPartLength = $this->staticPartLength($nestedName);
            $roundedNestedStaticPartLength = floor(($nestedStaticPartLength + 31) / 32) * 32;
            $result = [];

            for ($i=0; $i<$length * $roundedNestedStaticPartLength; $i+=$roundedNestedStaticPartLength) {
                $result[] = $this->decode($value, $arrayStart + $i, $nestedName);
            }
            return $result;
        } elseif ($this->isStaticArray($name)) {
            $length = $this->staticArrayLength($name);
            $arrayStart = $offset;

            $nestedName = $this->nestedName($name);
            $nestedStaticPartLength = $this->staticPartLength($nestedName);
            $roundedNestedStaticPartLength = floor(($nestedStaticPartLength + 31) / 32) * 32;
            $result = [];

            for ($i=0; $i<$length * $roundedNestedStaticPartLength; $i+=$roundedNestedStaticPartLength) {
                $result[] = $this->decode($value, $arrayStart + $i, $nestedName);
            }
            return $result;
        } elseif ($this->isDynamicType()) {
            $dynamicOffset = (int) Utils::toBn('0x' . mb_substr($value, $offset * 2, 64))->toString();
            $length = (int) Utils::toBn('0x' . mb_substr($value, $dynamicOffset * 2, 64))->toString();
            $roundedLength = floor(($length + 31) / 32);
            $param = mb_substr($value, $dynamicOffset * 2, ( 1 + $roundedLength) * 64);
            return $this->outputFormat($param, $name);
        }
        $length = $this->staticPartLength($name);
        $param = mb_substr($value, $offset * 2, $length * 2);

        return $this->outputFormat($param, $name);
    }
539728
protected function renderItem($name, $value)
    {
        if (is_array($value))
        {
            $lines = $this->renderArrayItem($name, $value);
        }
        else
        {
            $lines = $this->renderStringItem($name, $value);
        }

        return $lines;
    }
384438
public static function format($value)
    {
        $value = Utils::toString($value);

        if (Utils::isZeroPrefixed($value)) {
            // test hex with zero ahead, hardcode 0x0
            if ($value === '0x0' || strpos($value, '0x0') !== 0) {
                return $value;
            }
            $hex = preg_replace('/^0x0+(?!$)/', '', $value);
        } else {
            $bn = Utils::toBn($value);
            $hex = $bn->toHex(true);
        }
        if (empty($hex)) {
            $hex = '0';
        } else {
            $hex = preg_replace('/^0+(?!$)/', '', $hex);
        }
        return '0x' . $hex;
    }
722884
private function IsValidFormat($Name, $Pattern, $Value)
        {
            if (! empty($Value)) {
                if (! preg_match($Pattern, $Value)) {
                    throw new Exception('Invalid '.$Name.'.');
                }
            }
        }
168625
public function usingAutomaticFormatGuessingAction($name)
    {
        $format = $this->get('request')->get('_format');
        
        return $this->render(sprintf('PsPdfBundle:Example:usingAutomaticFormatGuessing.%s.twig', $format), array(
            'name' => $name,
        ));
    }
1103367
public function inputFormat($value, $name)
    {
        if (!Utils::isHex($value)) {
            throw new InvalidArgumentException('The value to inputFormat must be hex bytes.');
        }
        $value = Utils::stripZero($value);

        if (mb_strlen($value) % 2 !== 0) {
            $value = "0" . $value;
            // throw new InvalidArgumentException('The value to inputFormat has invalid length.');
        }
        $bn = Utils::toBn(floor(mb_strlen($value) / 2));
        $bnHex = $bn->toHex(true);
        $padded = mb_substr($bnHex, 0, 1);

        if ($padded !== '0' && $padded !== 'f') {
            $padded = '0';
        }
        $l = floor((mb_strlen($value) + 63) / 64);
        $padding = (($l * 64 - mb_strlen($value) + 1) >= 0) ? $l * 64 - mb_strlen($value) : 0;

        return implode('', array_fill(0, 64-mb_strlen($bnHex), $padded)) . $bnHex . $value . implode('', array_fill(0, $padding, '0'));
    }
661648
protected function getRawOptionValue($name, $value)
    {
        $modelVariable = $this->getSingularVariable($this->modelName);
        $valueString = is_null($value) || $value == 'null' ? 'null' : sprintf("'%s'", $value);
        $accessor = $this->getDefaultValueAccessor($modelVariable, $name, $valueString);
        return sprintf("old('%s', %s)", $name, $accessor);
    }
774244
public static function formatSiret($value): string
    {
        $value = (string) (int) $value;
        if (!self::isSiret($value)) {
            return '';
        }
        return preg_replace('/^([0-9]{3})([0-9]{3})([0-9]{3})([0-9]{5})$/', '$1 $2 $3 $4', $value);
    }
292780
public static function format(string $value)
    {
        $value = explode(',', $value);
        if (!is_array($value)) {
            $value = [$value];
        }
        return $value;
    }
659474
final public function output(string $name = null)
    {
        $result = implode(static::EOL, $this->registries) . static::EOL
            . static::EOF;

        if ($name === null) {
            return $result;
        }

        Utils::checkOutput(pathinfo($name)['extension'] ?? '');

        header('Content-Type: text/plain');
        header('Content-Length: ' . strlen($result));
        header('Content-Disposition: attachment; filename="' . $name . '"');
        echo $result;
    }
255938
public function getSymbol($name, $value=null, $verbosity = FormatterContract::SHORT)
    {
        $key = $this->getSymbolKey($name, $value, $verbosity);

        if (!isset($this->formatCache[$key])) {
            $this->formatCache[$key] = $this->loadFormat($key);
        }

        if ($name == self::WEEKDAY || $name == self::MONTH) {
            $this->dateFormatCache = [];
        }

        return $this->formatCache[$key];
    }
1277804
public function dump($value) : string
    {
        if (! is_numeric($value))
            throw new DumpException($this, $value, self::ERROR);

        return ''. $value;
    }