1 | <?php |
||
10 | class History |
||
11 | { |
||
12 | /** |
||
13 | * Cached history data (not persisted yet). |
||
14 | * |
||
15 | * @var array history data. |
||
16 | */ |
||
17 | protected $cachedData; |
||
18 | |||
19 | /** |
||
20 | * Directory where history information will be stored. |
||
21 | * |
||
22 | * @var string directory path. |
||
23 | */ |
||
24 | protected $outputDirectory; |
||
25 | |||
26 | /** |
||
27 | * Set dependencies. |
||
28 | * |
||
29 | * @param string $outputDirectory target directory path. |
||
30 | */ |
||
31 | public function __construct($outputDirectory) |
||
35 | |||
36 | /** |
||
37 | * Finderend analysis result data to the history. |
||
38 | * |
||
39 | * @param AnalysisResult $result analysis result. |
||
40 | * @return void |
||
41 | */ |
||
42 | public function append(AnalysisResult $result) |
||
74 | |||
75 | /** |
||
76 | * Stores history data. |
||
77 | * |
||
78 | * @return boolean true if successfully wrote to the JSON file. |
||
79 | */ |
||
80 | public function save() |
||
85 | |||
86 | /** |
||
87 | * Loads history data from the JSON file (or the cache if already did). |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | public function getData() |
||
105 | |||
106 | /** |
||
107 | * Overwrite current data. |
||
108 | * |
||
109 | * @param array $data history data. |
||
110 | */ |
||
111 | protected function setData(array $data) |
||
115 | |||
116 | /** |
||
117 | * History data |
||
118 | * |
||
119 | * @return array |
||
120 | */ |
||
121 | protected function getHistoryFileContent() |
||
129 | |||
130 | /** |
||
131 | * JSON data file path. |
||
132 | * |
||
133 | * @return string file path. |
||
134 | */ |
||
135 | protected function getHistoryFilePath() |
||
139 | } |
||
140 |