| 1 |
<?php |
| 2 |
|
| 3 |
namespace Wikimedia\WRStats; |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
class SequenceSpec { |
| 11 |
|
| 12 |
public const DEFAULT_TIME_STEP = 600; |
| 13 |
|
| 14 |
|
| 15 |
public const DEFAULT_EXPIRY = 3600; |
| 16 |
|
| 17 |
|
| 18 |
public $name; |
| 19 |
|
| 20 |
public $timeStep; |
| 21 |
|
| 22 |
public $softExpiry; |
| 23 |
|
| 24 |
public $hardExpiry; |
| 25 |
|
| 26 |
|
| 27 |
|
| 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 |
} |