Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
LinkRecommendationMetadata
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 6
42
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 getDatasetChecksums
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getFormatVersion
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getApplicationVersion
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getTaskTimestamp
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace GrowthExperiments\NewcomerTasks\AddLink;
4
5/**
6 * Represents metadata for link recommendation set.
7 */
8class LinkRecommendationMetadata {
9
10    /** @var string */
11    private $applicationVersion;
12    /** @var int */
13    private $formatVersion;
14    /** @var array */
15    private $datasetChecksums;
16    /** @var int */
17    private $taskTimestamp;
18
19    /**
20     * @param string $applicationVersion The git commit hash of the application that generated the recommendation.
21     * @param int $formatVersion The format version for the recommendation.
22     * @param array $datasetChecksums An array of datasets / checksums, keys are the dataset names and values are the
23     *   checksums
24     * @param int $taskTimestamp UNIX timestamp of when the task was created.
25     */
26    public function __construct(
27        string $applicationVersion,
28        int $formatVersion,
29        array $datasetChecksums,
30        int $taskTimestamp
31    ) {
32        $this->applicationVersion = $applicationVersion;
33        $this->formatVersion = $formatVersion;
34        $this->datasetChecksums = $datasetChecksums;
35        $this->taskTimestamp = $taskTimestamp;
36    }
37
38    /** @return array */
39    public function getDatasetChecksums(): array {
40        return $this->datasetChecksums;
41    }
42
43    /** @return int */
44    public function getFormatVersion(): int {
45        return $this->formatVersion;
46    }
47
48    /** @return string */
49    public function getApplicationVersion(): string {
50        return $this->applicationVersion;
51    }
52
53    /** @return int */
54    public function getTaskTimestamp(): int {
55        return $this->taskTimestamp;
56    }
57
58    /** @return array */
59    public function toArray(): array {
60        return [
61            'application_version' => $this->applicationVersion,
62            'dataset_checksums' => $this->datasetChecksums,
63            'format_version' => $this->formatVersion,
64            'task_timestamp' => $this->taskTimestamp,
65        ];
66    }
67
68}