for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace TechDeCo\ElasticApmAgent\Message;
use JsonSerializable;
use TechDeCo\ElasticApmAgent\Serialization;
final class Service implements JsonSerializable
{
/**
* @var VersionedName
*/
private $agent;
* @var string
private $name;
* @var VersionedName|null
private $framework;
private $language;
* @var string|null
private $environment;
private $runtime;
private $version;
public function __construct(VersionedName $agent, string $name)
$this->agent = $agent;
$this->name = $name;
}
public function usingFramework(VersionedName $framework): self
$me = clone $this;
$me->framework = $framework;
return $me;
public function usingLanguage(VersionedName $language): self
$me->language = $language;
public function inEnvironment(string $environment): self
$me->environment = $environment;
public function withRuntime(VersionedName $runtime): self
$me->runtime = $runtime;
public function atVersion(string $version): self
$me->version = $version;
* @return mixed[]
public function jsonSerialize(): array
return Serialization::filterUnset([
'agent' => Serialization::serializeOr($this->agent),
'framework' => Serialization::serializeOr($this->framework),
'language' => Serialization::serializeOr($this->language),
'name' => $this->name,
'environment' => $this->environment,
'runtime' => Serialization::serializeOr($this->runtime),
'version' => $this->version,
]);