function StatusData::create
@psalm-param API\StatusCode::STATUS_* $code
1 call to StatusData::create()
- Span::setStatus in vendor/
open-telemetry/ sdk/ Trace/ Span.php - @inheritDoc
File
-
vendor/
open-telemetry/ sdk/ Trace/ StatusData.php, line 23
Class
Namespace
OpenTelemetry\SDK\TraceCode
public static function create(string $code, ?string $description = null) : self {
if (empty($description)) {
switch ($code) {
case API\StatusCode::STATUS_UNSET:
return self::unset();
case API\StatusCode::STATUS_ERROR:
return self::error();
case API\StatusCode::STATUS_OK:
return self::ok();
}
}
// Ignore description for non Error statuses.
if (API\StatusCode::STATUS_ERROR !== $code) {
$description = '';
}
return new self($code, $description);
/** @phan-suppress-current-line PhanTypeMismatchArgumentNullable */
}