protected function parts($parts, $url, &$urls) { if (empty($parts)) { return; } $part = array_shift($parts); if (!isset($urls[$part])) { $urls[$part] = array(); } if (empty($parts)) { $urls[$part][] = $url; } else { $this->parts($parts, $url, $urls[$part]); } }