| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace WCPOS\Vendor\Sentry\Context; |
| 5 |
|
| 6 |
/** |
| 7 |
* This class stores information about the operating system of the server. |
| 8 |
* |
| 9 |
* @author Stefano Arlandini <[email protected]> |
| 10 |
*/ |
| 11 |
final class OsContext |
| 12 |
{ |
| 13 |
/** |
| 14 |
* @var string The name of the operating system |
| 15 |
*/ |
| 16 |
private $name; |
| 17 |
/** |
| 18 |
* @var string|null The version of the operating system |
| 19 |
*/ |
| 20 |
private $version; |
| 21 |
/** |
| 22 |
* @var string|null The internal build revision of the operating system |
| 23 |
*/ |
| 24 |
private $build; |
| 25 |
/** |
| 26 |
* @var string|null An independent kernel version string |
| 27 |
*/ |
| 28 |
private $kernelVersion; |
| 29 |
/** |
| 30 |
* @var string|null |
| 31 |
*/ |
| 32 |
private $machineType; |
| 33 |
/** |
| 34 |
* Constructor. |
| 35 |
* |
| 36 |
* @param string $name The name of the operating system |
| 37 |
* @param string|null $version The version of the operating system |
| 38 |
* @param string|null $build The internal build revision of the operating system |
| 39 |
* @param string|null $kernelVersion An independent kernel version string |
| 40 |
* @param string|null $machineType The machine type |
| 41 |
*/ |
| 42 |
public function __construct(string $name, ?string $version = null, ?string $build = null, ?string $kernelVersion = null, ?string $machineType = null) |
| 43 |
{ |
| 44 |
if (\trim($name) === '') { |
| 45 |
throw new \InvalidArgumentException('The $name argument cannot be an empty string.'); |
| 46 |
} |
| 47 |
$this->name = $name; |
| 48 |
$this->version = $version; |
| 49 |
$this->build = $build; |
| 50 |
$this->kernelVersion = $kernelVersion; |
| 51 |
$this->machineType = $machineType; |
| 52 |
} |
| 53 |
/** |
| 54 |
* Gets the name of the operating system. |
| 55 |
*/ |
| 56 |
public function getName() : string |
| 57 |
{ |
| 58 |
return $this->name; |
| 59 |
} |
| 60 |
/** |
| 61 |
* Sets the name of the operating system. |
| 62 |
* |
| 63 |
* @param string $name The name |
| 64 |
*/ |
| 65 |
public function setName(string $name) : void |
| 66 |
{ |
| 67 |
if (\trim($name) === '') { |
| 68 |
throw new \InvalidArgumentException('The $name argument cannot be an empty string.'); |
| 69 |
} |
| 70 |
$this->name = $name; |
| 71 |
} |
| 72 |
/** |
| 73 |
* Gets the version of the operating system. |
| 74 |
*/ |
| 75 |
public function getVersion() : ?string |
| 76 |
{ |
| 77 |
return $this->version; |
| 78 |
} |
| 79 |
/** |
| 80 |
* Sets the version of the operating system. |
| 81 |
* |
| 82 |
* @param string|null $version The version |
| 83 |
*/ |
| 84 |
public function setVersion(?string $version) : void |
| 85 |
{ |
| 86 |
$this->version = $version; |
| 87 |
} |
| 88 |
/** |
| 89 |
* Gets the build of the operating system. |
| 90 |
*/ |
| 91 |
public function getBuild() : ?string |
| 92 |
{ |
| 93 |
return $this->build; |
| 94 |
} |
| 95 |
/** |
| 96 |
* Sets the build of the operating system. |
| 97 |
* |
| 98 |
* @param string|null $build The build |
| 99 |
*/ |
| 100 |
public function setBuild(?string $build) : void |
| 101 |
{ |
| 102 |
$this->build = $build; |
| 103 |
} |
| 104 |
/** |
| 105 |
* Gets the version of the kernel of the operating system. |
| 106 |
*/ |
| 107 |
public function getKernelVersion() : ?string |
| 108 |
{ |
| 109 |
return $this->kernelVersion; |
| 110 |
} |
| 111 |
/** |
| 112 |
* Sets the version of the kernel of the operating system. |
| 113 |
* |
| 114 |
* @param string|null $kernelVersion The kernel version |
| 115 |
*/ |
| 116 |
public function setKernelVersion(?string $kernelVersion) : void |
| 117 |
{ |
| 118 |
$this->kernelVersion = $kernelVersion; |
| 119 |
} |
| 120 |
public function getMachineType() : ?string |
| 121 |
{ |
| 122 |
return $this->machineType; |
| 123 |
} |
| 124 |
/** |
| 125 |
* @param string|null $machineType The machine type |
| 126 |
*/ |
| 127 |
public function setMachineType(?string $machineType) : void |
| 128 |
{ |
| 129 |
$this->machineType = $machineType; |
| 130 |
} |
| 131 |
} |
| 132 |
|