summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/socket/src/UnixSocketPeer.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:23:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:23:16 +0000
commit3e97c51418e6d27e9a81906f347fcb7c78e27d4f (patch)
treeee596ce1bc9840661386f96f9b8d1f919a106317 /vendor/gipfl/socket/src/UnixSocketPeer.php
parentInitial commit. (diff)
downloadicingaweb2-module-incubator-3e97c51418e6d27e9a81906f347fcb7c78e27d4f.tar.xz
icingaweb2-module-incubator-3e97c51418e6d27e9a81906f347fcb7c78e27d4f.zip
Adding upstream version 0.20.0.upstream/0.20.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gipfl/socket/src/UnixSocketPeer.php')
-rw-r--r--vendor/gipfl/socket/src/UnixSocketPeer.php102
1 files changed, 102 insertions, 0 deletions
diff --git a/vendor/gipfl/socket/src/UnixSocketPeer.php b/vendor/gipfl/socket/src/UnixSocketPeer.php
new file mode 100644
index 0000000..409487b
--- /dev/null
+++ b/vendor/gipfl/socket/src/UnixSocketPeer.php
@@ -0,0 +1,102 @@
+<?php
+
+namespace gipfl\Socket;
+
+use gipfl\Json\JsonSerialization;
+
+class UnixSocketPeer implements JsonSerialization
+{
+ /** @var int */
+ protected $pid;
+
+ /** @var int */
+ protected $uid;
+
+ /** @var int */
+ protected $gid;
+
+ /** @var string */
+ protected $username;
+
+ /** @var ?string */
+ protected $fullName;
+
+ /** @var string */
+ protected $groupName;
+
+ public function __construct($pid, $uid, $gid, $username, $fullName, $groupName)
+ {
+ $this->pid = $pid;
+ $this->uid = $uid;
+ $this->gid = $gid;
+ $this->username = $username;
+ $this->fullName = $fullName;
+ $this->groupName = $groupName;
+ }
+
+ /**
+ * @return int
+ */
+ public function getPid()
+ {
+ return $this->pid;
+ }
+
+ /**
+ * @return int
+ */
+ public function getUid()
+ {
+ return $this->uid;
+ }
+
+ /**
+ * @return int
+ */
+ public function getGid()
+ {
+ return $this->gid;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUsername()
+ {
+ return $this->username;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getFullName()
+ {
+ return $this->fullName;
+ }
+
+ /**
+ * @return string
+ */
+ public function getGroupName()
+ {
+ return $this->groupName;
+ }
+
+ public static function fromSerialization($any)
+ {
+ return new static($any->pid, $any->uid, $any->gid, $any->username, $any->fullName, $any->groupName);
+ }
+
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return (object) [
+ 'pid' => $this->pid,
+ 'uid' => $this->uid,
+ 'gid' => $this->gid,
+ 'username' => $this->username,
+ 'fullName' => $this->fullName,
+ 'groupName' => $this->groupName,
+ ];
+ }
+}