Passed
Push — master ( a034e0...fb1aac )
by
unknown
03:23
created

ConnectionTracking   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A TrackConnection() 0 7 1
1
<?php
2
3
/*
4
 * SPDX-License-Identifier: AGPL-3.0-only
5
 * SPDX-FileCopyrightText: Copyright 2020-2025 grommunio GmbH
6
 */
7
8
class ConnectionTracking extends InterProcessData {
9
	/**
10
	 * Constructor.
11
	 */
12
	public function __construct() {
13
		// initialize super parameters
14
		$this->allocate = 0;
15
		$this->type = "grommunio-sync:connections";
16
		parent::__construct();
17
18
		// initialize params
19
		$this->initializeParams();
20
	}
21
22
	/**
23
	 * Initialize the current request.
24
	 *
25
	 * @return bool
26
	 */
27
	public function TrackConnection() {
28
		// use the email address here
29
		self::$user = Request::GetUserIdentifier();
30
31
		$connectiontracking = ["starttime" => self::$start, "pid" => self::$pid, "command" => Request::GetCommand()];
32
33
		return $this->setDeviceUserData($this->type, $connectiontracking, self::$devid, self::$user, $subkey = -1, $doCas = "replace");
34
	}
35
}
36