| Total Complexity | 5 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Coverage | 76.19% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class Recorder |
||
| 6 | { |
||
| 7 | 2 | public function __construct($folder) |
|
| 10 | 2 | } |
|
| 11 | |||
| 12 | 2 | public function record(array $urls) |
|
| 13 | { |
||
| 14 | 2 | $fp = fopen($this->folder.'/index.csv', 'w'); |
|
| 15 | |||
| 16 | 2 | $header = array_keys(get_object_vars(array_values($urls)[0])); |
|
| 17 | 2 | fputcsv($fp, $header); |
|
| 18 | |||
| 19 | 2 | foreach ($urls as $url) { |
|
| 20 | 2 | fputcsv($fp, get_object_vars($url)); |
|
| 21 | } |
||
| 22 | |||
| 23 | 2 | fclose($fp); |
|
| 24 | 2 | } |
|
| 25 | |||
| 26 | 2 | public function recordInboundLink(Url $from, Url $to) |
|
| 27 | { |
||
| 28 | 2 | file_put_contents($this->folder.'/links/To_'.$to->sha1.'.txt', $from->uri, FILE_APPEND); |
|
| 29 | 2 | } |
|
| 30 | |||
| 31 | 2 | public function recordOutboundLink(Url $from, array $links) |
|
| 35 | 2 | } |
|
| 36 | } |
||
| 37 |