zrashwani / arachnid

Crawl all unique internal links found on a given website, and extract SEO related information - supports javascript based sites
MIT License
253 stars 60 forks source link

Named array keys #20

Closed butchewing closed 7 years ago

butchewing commented 7 years ago

What is the rationale for using named $nodeUrl and $nodeText array keys?

$childLinks[$hash]['original_urls'][$nodeUrl] = $nodeUrl;
$childLinks[$hash]['links_text'][$nodeText] = $nodeText;

Crawler.php Line 363 & 364

Would it not be more consistent and easier to parse if we changed to numerical keys?

$childLinks[$hash]['original_urls'][] = $nodeUrl;
$childLinks[$hash]['links_text'][] = $nodeText;
zrashwani commented 7 years ago

I made $nodeUrl and $nodeText array keys to avoid duplication in the array and force unique values - in case the same url's exists in many pages with the same link text. do you have better idea how to implement?

butchewing commented 7 years ago

Ah, I see. Good point. I was simply trying to figure out a way to parse through the array without knowing the key name.