提取
@param string $format
@param $carrier
336765
public function extract($format, $carrier){
        $spanContext = new SpanContext(0, 0, 0, null, 0);
        foreach ($carrier as $k => $v){
            $k = strtolower($k);
            $v = urldecode($v);
            if($k == Constants\Tracer_State_Header_Name){
                list($traceId, $spanId, $parentId,$flags) = explode(':', $carrier[strtoupper($k)]);

                $spanContext->spanId = $spanContext->hexToSignedInt($spanId);
                $spanContext->parentId = $spanContext->hexToSignedInt($parentId);
                $spanContext->flags = $flags;
                $spanContext->traceIdToString($traceId);

            }elseif(stripos($k, Constants\Trace_Baggage_Header_Prefix) !== false){
                $safeKey = str_replace(Constants\Trace_Baggage_Header_Prefix, "", $k);
                $spanContext->withBaggageItem($safeKey, $v);
            }elseif($k == Constants\Jaeger_Debug_Header){
                $spanContext->debugId = $v;
            }elseif($k == Constants\Jaeger_Baggage_Header){
                // Converts a comma separated key value pair list into a map
                // e.g. key1=value1, key2=value2, key3 = value3
                // is converted to array { "key1" : "value1",
                //                                     "key2" : "value2",
                //                                     "key3" : "value3" }
                $parseVal = explode(',', $v);
                foreach ($parseVal as $val){
                    $kv = explode('=', trim($val));
                    if(count($kv)){
                        $spanContext->withBaggageItem($kv[0], $kv[1]);
                    }
                }
            }
        }


        return $spanContext;
    }
962685
public function setFormat($format)
    {
        $result = true;
        if (($this->debug === true) && !empty($this->evidence) && isset(Formats::$$this->evidence)) {
            if (array_key_exists($format, array_flip(Formats::$$this->evidence))
                === false) {
                $result = false;
            }
        }
        if ($result === true) {
            $this->format = $format;
            $this->updateApiURL();
        }
        return $result;
    }
356630
public function format($format)
    {
        if(Format::exist($format))
            $this->format = Format::get($format);
        else
            Format::invalidType();

        return $this;
    }
146526
public function setFormat($format, $placeholder = NULL)
	{
		$this->format = $format;

		if ($placeholder === NULL) {
			$placeholder = self::makeFormatPlaceholder($format);
		}
		if (!empty($placeholder)) {
			$this->setPlaceholder($placeholder);
		}

		return $this;
	}
472532
public function assertStringMatchesFormat($format, $message = '')
    {
        Assert::assertStringMatchesFormat($format, $this->getData(), $message);

        return $this;
    }
692190
public function formatPhone(string $phone, string $format = '(###) ###-####'): string
    {
        return $this->formatPhoneMask($this->stripNonNumeric($phone), strlen($this->stripNonNumeric($phone)), $format);
    }
156208
public static function dateFormat($val, $format = 'Y-m-d'): bool
    {
        if (!$val || !($unixTime = \strtotime($val))) {
            return false;
        }

        // 校验日期的格式有效性
        return \date($format, $unixTime) === $val;
    }
454189
public function setFormat($format) {
        $upperFormat = strtoupper($format);
        $this->searchParams->config->searchFormat = array_search($upperFormat, SearchFormat::$__names);
    }
99794
protected function parse_format($format) {
		$format = parent::parse_format($format);
		return str_replace(array_keys(static::$days), static::$days, $format);
	}
653170
public static function validateDateFormat($format)
    {
        $format = str_replace(array_keys(static::$_map['date']), '', $format); // remove placeholders
        $format = preg_replace("/'(.*)'/", '', $format); // remove literals
        $format = preg_replace('/[^a-z]/i', '', $format);
        $format = trim($format);

        return empty($format);
    }
268328
private function formatEcho(Format $format, $args)
    {
        foreach ($args as $group => $list) {
            if (is_array($list)) {
                $this->writeln($format->format($group));
                foreach ($list as $name => $desc) {
                    $this->writeln($format->format('  ' . $name . str_repeat(' ', $this->commandLength - 2 - strlen($name)) . $desc));
                }
            } else {
                $this->writeln($format->format($group . str_repeat(' ', $this->commandLength - strlen($group)) . $list));
            }
        }
    }
636255
protected function date($format){

		$timestamp = $this->getTimestamp();
		
	    list($gYear, $gMonth, $gDay, $gWeek) = explode('-', date('Y-m-d-w', $timestamp));
	    list($pYear, $pMonth, $pDay) = static::getJalali($gYear, $gMonth, $gDay);
	    $pWeek = ($gWeek + 1);

	    if ($pWeek >= 7) {
	        $pWeek = 0;
	    }

	    if ($format == '\\') {
	        $format = '//';
	    }

	    $lenghFormat = strlen($format);
	    $i = 0;
	    $result = '';

	    while ($i < $lenghFormat) {
	        $par = $format{$i};
	        if ($par == '\\') {
	            $result .= $format{ ++$i};
	            $i ++;
	            continue;
	        }
	        switch ($par) {
	            # Day
	            case 'd':
	                $result .= sprintf('%02s', $pDay);
	                break;

	            case 'D':
	                $result .= substr(static::$dayWeek[$pWeek], 0, 2);
	                break;

	            case 'j':
	                $result .= $pDay;
	                break;

	            case 'l':
	                $result .= static::$dayWeek[$pWeek];
	                break;

	            case 'N':
	                $result .= $pWeek + 1;
	                break;

	            case 'w':
	                $result .= $pWeek;
	                break;

	            case 'z':
	                $result .= $this->daysYear($pMonth, $pDay);
	                break;

	            case 'S':
	                $result .= self::NUMBER_TH;
	                break;

	            # Week
	            case 'W':
	                $result .= ceil($this->daysYear($pMonth, $pDay) / 7);
	                break;

	            # Month
	            case 'F':
	                $result .= static::$monthYear[$pMonth-1];
	                break;

	            case 'm':
	                $result .= sprintf('%02s', $pMonth);
	                break;

	            case 'M':
	                $result .= substr(static::$monthYear[$pMonth-1], 0, 6);
	                break;

	            case 'n':
	                $result .= $pMonth;
	                break;

	            case 't':
	                $result .= static::isLeapYear($pYear) && ($pMonth == 12) ? 30 : static::$daysMonthJalali[intval($pMonth)-1];
	                break;

	            # Years
	            case 'L':
	                $result .= intval($this->isLeapYear($pYear));
	                break;

	            case 'Y':
	            case 'o':
	                $result .= $pYear;
	                break;

	            case 'y':
	                $result .= substr($pYear, 2);
	                break;

	            # Time
	            case 'a':
	            case 'A':
	                if (date('a', $timestamp) == 'am') {
	                    $result .= (($par == 'a') ? self::AM : self::ANTE_MERIDIEM);
	                } else {
	                    $result .= (($par == 'a') ? self::PM : self::POST_MERIDIEM);
	                }
	                break;

	            case 'B':
	            case 'g':
	            case 'G':
	            case 'h':
	            case 'H':
	            case 's':
	            case 'u':
	            case 'i':
	            # Timezone
	            case 'e':
	            case 'I':
	            case 'O':
	            case 'P':
	            case 'T':
	            case 'Z':
	                $result .= date($par, $timestamp);
	                break;

	            # Full Date/Time
	            case 'c':
	                $result .= ($pYear . '-' . $pMonth . '-' . $pDay . ' ' . date('H:i:s P', $timestamp));
	                break;

	            case 'r':
	                $result .= (substr(static::$dayWeek[$pWeek], 0, 2) . '، ' . $pDay . ' ' . substr(static::$monthYear[$pMonth], 0, 6) . ' ' . $pYear . ' ' . date('H:i:s P', $timestamp));
	                break;

	            case 'U':
	                $result .= $timestamp;
	                break;

	            default:
	                $result .= $par;
	        }
	        $i ++;
	    }

	    return $result;
	}
152656
public function setFormat($type, $format)
    {
        if ($this->typeIsAvailable($type)) {
            $this->formats[$type] = $format;
        }

        return $this;
    }
162394
public function inject(OTSpanContext $spanContext, $format, &$carrier)
    {
        if ($spanContext instanceof SpanContext) {
            $codec = $this->codecs[$format] ?? null;

            if ($codec == null) {
                throw UnsupportedFormat::forFormat(is_scalar($format) ? $format : gettype($format));
            }


            $codec->inject($spanContext, $carrier);
            return;
        }

        $message = sprintf(
            'Invalid span context. Expected Jaeger\SpanContext, got %s.',
            is_object($spanContext) ? get_class($spanContext) : gettype($spanContext)
        );

        $this->logger->warning($message);
    }
93774
public function setFormat($format)
    {
        if (!in_array($format, self::$supportedFormats)) {
            throw new BuildException(
                sprintf(
                    'Invalid output format "%s", allowed are: %s',
                    $format,
                    implode(', ', self::$supportedFormats)
                )
            );
        }
        $this->format = $format;
    }
839036
final public function format($format)
    {
        if(is_null($this->value)) {
            return null;
        } else {
            return $this->value->format($format);
        }
    }
836010
public function tzFormat($format, $tz = null)
    {
        if (isset($tz)) {
            $this->setTimezone(new DateTimeZone($tz));
        }

        return $this->format($format);
    }