1 | <?php |
||
10 | class History |
||
11 | { |
||
12 | /** |
||
13 | * Cached history data (not persisted yet). |
||
14 | * @var array history data. |
||
15 | */ |
||
16 | protected $cachedData; |
||
17 | |||
18 | /** |
||
19 | * Directory where history information will be stored. |
||
20 | * @var string directory path. |
||
21 | */ |
||
22 | protected $outputDirectory; |
||
23 | |||
24 | /** |
||
25 | * Set dependencies. |
||
26 | * @param string $outputDirectory target directory path. |
||
27 | */ |
||
28 | public function __construct($outputDirectory) |
||
32 | |||
33 | /** |
||
34 | * Append analysis result data to the history. |
||
35 | * @param AnalysisResult $result analysis result. |
||
36 | * @return void |
||
37 | */ |
||
38 | public function append(AnalysisResult $result) |
||
70 | |||
71 | /** |
||
72 | * Stores history data. |
||
73 | * @return boolean true if successfully wrote to the JSON file. |
||
74 | */ |
||
75 | public function save() |
||
80 | |||
81 | /** |
||
82 | * Loads history data from the JSON file (or the cache if already did). |
||
83 | * @return array |
||
84 | */ |
||
85 | public function getData() |
||
99 | |||
100 | /** |
||
101 | * Overwrite current data. |
||
102 | * @param array $data history data. |
||
103 | */ |
||
104 | protected function setData(array $data) |
||
108 | |||
109 | /** |
||
110 | * History data |
||
111 | * @return array |
||
112 | */ |
||
113 | protected function getHistoryFileContent() |
||
121 | |||
122 | /** |
||
123 | * JSON data file path. |
||
124 | * @return string file path. |
||
125 | */ |
||
126 | protected function getHistoryFilePath() |
||
130 | } |
||
131 |