for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PiedWeb\SeoPocketCrawler;
class Recorder
{
protected $folder;
public function __construct($folder)
$this->folder = $folder;
}
public function record(array $urls)
$fp = fopen($this->folder.'/index.csv', 'w');
if ($fp) {
$fp
false|resource
false
$header = array_keys(get_object_vars(array_values($urls)[0]));
fputcsv($fp, $header);
foreach ($urls as $url) {
fputcsv($fp, get_object_vars($url));
fclose($fp);
return true;
return false;
public function recordInboundLink(Url $from, Url $to)
file_put_contents($this->folder.'/links/To_'.$to->sha1.'.txt', $from->uri, FILE_APPEND);
public function recordOutboundLink(Url $from, array $links)
$links = array_map(function ($link) {
return $link->getUrl();
}, $links);
file_put_contents($this->folder.'/links/From_'.$from->sha1.'.txt', implode(PHP_EOL, $links));