Debian Codegraph @

includes/libs/WRStats/SequenceSpec.php

raw symbols SCIP
1 <?php
2
3 namespace Wikimedia\WRStats;
4
5 /**
6 * Class representation of normalized sequence specifications.
7 *
8 * @internal
9 */
10 class SequenceSpec {
11 /** The default time bucket size (seconds) */
12 public const DEFAULT_TIME_STEP = 600;
13
14 /** The default expiry time (seconds) */
15 public const DEFAULT_EXPIRY = 3600;
16
17 /** @var string */
18 public $name;
19 /** @var float|int */
20 public $timeStep;
21 /** @var float|int */
22 public $softExpiry;
23 /** @var int */
24 public $hardExpiry;
25
26 /**
27 * @param array $spec
28 */
29 public function __construct( array $spec ) {
30 $this->timeStep = $spec['timeStep'] ?? self::DEFAULT_TIME_STEP;
31 $this->softExpiry = $spec['expiry'] ?? self::DEFAULT_EXPIRY;
32 $this->hardExpiry = (int)ceil( $this->softExpiry + $this->timeStep );
33 $this->name = $spec['name'] ?? '';
34 }
35 }