{@inheritdoc}

@param mixed $carrier
@return SpanContext|null

@throws UnsupportedFormat
495113
public function extract($format, $carrier)
    {
        $codec = $this->codecs[$format] ?? null;

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

        try {
            return $codec->extract($carrier);
        } catch (\Throwable $e) {
            $this->logger->warning($e->getMessage());

            return null;
        }
    }
211246
public function forTemplate($holder = true)
    {
        $templates = $this->getRenderTemplates();

        if ($templates) {
            return $this->renderWith($templates);
        }

        return null;
    }
599132
public function extract($format, $carrier){
        if($format == Formats\TEXT_MAP){
            return $this->propagator->extract($format, $carrier);
        }else{
            throw new \Exception("not support format");
        }
    }
19951
public function format($format = null)
    {
        if (func_num_args()) {
            return parent::format($format);
        }
        if ($this->_format === null) {
            $this->negotiate();
        }
        return $this->_format;
    }
132487
public function paragraph(string $text = null): Paragraph
    {
        $paragraph = Paragraph::factory();
        if ($text !== null) {
            $paragraph->text($text);
        }

        /** @var ContainerElement $this */
        return $this->addElement($paragraph);
    }
1115124
def extract(format, carrier)
      case format
      when OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY
        ::Instana.logger.debug 'Unsupported extract format'
      when OpenTracing::FORMAT_RACK
        ::Instana::SpanContext.new(::Instana::Util.header_to_id(carrier['HTTP_X_INSTANA_T']),
                                     ::Instana::Util.header_to_id(carrier['HTTP_X_INSTANA_S']))
      else
        ::Instana.logger.debug 'Unknown inject format'
        nil
      end
    end
330746
public function matcher(Container $container)
    {
        $matcher = $container->get('config')->get('routing.matcher', 'default');

        $matcher = strtolower($matcher) === 'default' ? 'sequential' : $matcher;

        $class = sprintf('Windwalker\Router\Matcher\%sMatcher', ucfirst($matcher));

        if (!class_exists($class)) {
            throw new \DomainException(sprintf('Router Matcher: %s not supported.', ucfirst($matcher)));
        }

        return $container->newInstance($class);
    }
1058608
public function format($format = null)
    {
        $media = $this->_classes['media'];

        if (!func_num_args()) {
            if ($this->_format === null) {
                $this->_format = $media::suitable($this);
            }
            return $this->_format;
        }
        if ($format === null) {
            return $this;
        }

        if (!$mime = $media::mime($format)){
            throw new NetException("The `'{$format}'` format is undefined or has no valid Content-Type defined check the `Media` class.");
        }
        $this->_format = $format;
        $this->mime($mime);

        return $this;
    }
104878
private function normalizeSpan(Span $span)
    {
        return [
            'id' => (string) $span->getIdentifier(),
            'name' => $span->getName(),
            'traceId' => (string) $span->getTraceIdentifier(),
            'parentId' => null !== $span->getParentIdentifier() ? (string) $span->getParentIdentifier() : null,
            'timestamp' => $span->getTimestamp(),
            'duration' => $span->getDuration(),
            'debug' => $span->getDebug(),
            'annotations' => array_map([$this, 'normalizeAnnotation'], $span->getAnnotations()),
            'binaryAnnotations' => array_map([$this, 'normalizeBinaryAnnotation'], $span->getBinaryAnnotations()),
        ];
    }
773012
public function withSpan(Span $span)
    {
        $spanData = $span->spanData();
        $startTime = $spanData->startTime()
            ? (float)($spanData->startTime()->format('U.u'))
            : microtime(true);
        $info = [
            'traceId' => $spanData->traceId(),
            'spanId' => $spanData->spanId(),
            'parentSpanId' => $spanData->parentSpanId(),
            'startTime' => $startTime,
            'attributes' => $spanData->attributes(),
            'stackTrace' => $spanData->stackTrace(),
            'kind' => $spanData->kind(),
            'sameProcessAsParentSpan' => $spanData->sameProcessAsParentSpan()
        ];
        opencensus_trace_begin($spanData->name(), $info);
        $this->hasSpans = true;
        $span->attach();
        foreach ($spanData->timeEvents() as $timeEvent) {
            $this->timeEventAdded($span, $timeEvent);
        }
        foreach ($spanData->links() as $link) {
            $this->linkAdded($span, $link);
        }
        return new Scope(function () {
            opencensus_trace_finish();
        });
    }
594028
public function format(?string $format = null, array $config = []): self
    {
        if (! \is_null($format) && ! empty($format)) {
            $this->setFormat($format);

            if (! empty($config)) {
                $this->when($format, $config);
            }
        }

        return $this;
    }
1048438
public static function spanName($project, $trace, $span)
    {
        return self::getSpanNameTemplate()->render([
            'project' => $project,
            'trace' => $trace,
            'span' => $span,
        ]);
    }
929213
public function build($incoming, Map $context = null)
    {
        $callable = $this->getDelegateBuilder();

        if (null === $context && $this->provide_fallback_context) {
            // Provide a non-null context so null checks aren't later required
            $context = new Map();
        }

        return $callable($incoming, $context);
    }
130535
@Override public <C> void inject(SpanContext spanContext, Format<C> format, C carrier) {
    Injector<TextMap> injector = formatToInjector.get(format);
    if (injector == null) {
      throw new UnsupportedOperationException(format + " not in " + formatToInjector.keySet());
    }
    TraceContext traceContext = ((BraveSpanContext) spanContext).unwrap();
    injector.inject(traceContext, (TextMap) carrier);
  }
1249971
public function extract($carrier)
    {
        $traceId = null;
        $spanId  = null;
        $parentId  = null;
        $flags = null;
        $baggage = null;
        $debugId = null;

        foreach ($carrier as $key => $value) {
            $ucKey = strtolower($key);

            if ($ucKey === $this->traceIdHeader) {
                if ($this->urlEncoding) {
                    $value = urldecode($value);
                }
                list($traceId, $spanId, $parentId, $flags) =
                    $this->spanContextFromString($value);
            } elseif ($this->startsWith($ucKey, $this->baggagePrefix)) {
                if ($this->urlEncoding) {
                    $value = urldecode($value);
                }
                $attrKey = substr($key, $this->prefixLength);
                if ($baggage === null) {
                    $baggage = [strtolower($attrKey) => $value];
                } else {
                    $baggage[strtolower($attrKey)] = $value;
                }
            } elseif ($ucKey === $this->debugIdHeader) {
                if ($this->urlEncoding) {
                    $value = urldecode($value);
                }
                $debugId = $value;
            }
        }

        if ($traceId === null && $baggage !== null) {
            throw new Exception('baggage without trace ctx');
        }

        if ($traceId === null) {
            if ($debugId !== null) {
                return new SpanContext(null, null, null, null, [], $debugId);
            }
            return null;
        }

        return new SpanContext($traceId, $spanId, $parentId, $flags, $baggage);
    }
10848
public function getSpanClassNames(DBViewports $span = null)
    {
        $classes = [];
        
        if (!$span) {
            $span = $this->owner->getSpanViewports();
        }
        
        if ($span->allEqualTo('auto')) {
            
            // Add Span Prefix Only:
            
            $classes[] = $this->spanPrefix;
            
        } elseif ($span->allEmpty()) {
            
            // Add Column Span Defaults:
            
            foreach ($this->columnSpanDefaults as $viewport => $value) {
                $classes[] = $this->getSpanClass($viewport, $value);
            }
            
        } else {
            
            // Add Column Span Field Values:
            
            foreach ($span->getViewports() as $viewport) {
                $classes[] = $this->getSpanClass($viewport, $span->getField($viewport));
            }
            
        }
        
        return $classes;
    }
416160
public function context($context = NULL)
	{
		if ( ! func_num_args())
		{
			return $this->_context;
		}
		$this->_context = $context;
		return $this;
	}