| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace WCPOS\Vendor\Sentry\Context; |
| 5 |
|
| 6 |
/** |
| 7 |
* This class stores information about the current runtime. |
| 8 |
* |
| 9 |
* @author Stefano Arlandini <[email protected]> |
| 10 |
*/ |
| 11 |
final class RuntimeContext |
| 12 |
{ |
| 13 |
/** |
| 14 |
* @var string The name of the runtime |
| 15 |
*/ |
| 16 |
private $name; |
| 17 |
/** |
| 18 |
* @var string|null The version of the runtime |
| 19 |
*/ |
| 20 |
private $version; |
| 21 |
/** |
| 22 |
* @var string|null The SAPI (Server API) name |
| 23 |
*/ |
| 24 |
private $sapi; |
| 25 |
/** |
| 26 |
* Constructor. |
| 27 |
* |
| 28 |
* @param string $name The name of the runtime |
| 29 |
* @param string|null $version The version of the runtime |
| 30 |
* @param string|null $sapi The SAPI name of the runtime |
| 31 |
*/ |
| 32 |
public function __construct(string $name, ?string $version = null, ?string $sapi = null) |
| 33 |
{ |
| 34 |
if (\trim($name) === '') { |
| 35 |
throw new \InvalidArgumentException('The $name argument cannot be an empty string.'); |
| 36 |
} |
| 37 |
$this->name = $name; |
| 38 |
$this->version = $version; |
| 39 |
$this->sapi = $sapi; |
| 40 |
} |
| 41 |
/** |
| 42 |
* Gets the name of the runtime. |
| 43 |
*/ |
| 44 |
public function getName() : string |
| 45 |
{ |
| 46 |
return $this->name; |
| 47 |
} |
| 48 |
/** |
| 49 |
* Sets the name of the runtime. |
| 50 |
* |
| 51 |
* @param string $name The name |
| 52 |
*/ |
| 53 |
public function setName(string $name) : void |
| 54 |
{ |
| 55 |
if (\trim($name) === '') { |
| 56 |
throw new \InvalidArgumentException('The $name argument cannot be an empty string.'); |
| 57 |
} |
| 58 |
$this->name = $name; |
| 59 |
} |
| 60 |
/** |
| 61 |
* Gets the version of the runtime. |
| 62 |
*/ |
| 63 |
public function getVersion() : ?string |
| 64 |
{ |
| 65 |
return $this->version; |
| 66 |
} |
| 67 |
/** |
| 68 |
* Sets the version of the runtime. |
| 69 |
* |
| 70 |
* @param string|null $version The version |
| 71 |
*/ |
| 72 |
public function setVersion(?string $version) : void |
| 73 |
{ |
| 74 |
$this->version = $version; |
| 75 |
} |
| 76 |
/** |
| 77 |
* Gets the SAPI of the runtime. |
| 78 |
*/ |
| 79 |
public function getSAPI() : ?string |
| 80 |
{ |
| 81 |
return $this->sapi; |
| 82 |
} |
| 83 |
/** |
| 84 |
* Sets the SAPI of the runtime. |
| 85 |
* |
| 86 |
* @param string|null $sapi The SAPI name |
| 87 |
*/ |
| 88 |
public function setSAPI(?string $sapi) : void |
| 89 |
{ |
| 90 |
$this->sapi = $sapi; |
| 91 |
} |
| 92 |
} |
| 93 |
|