public function __construct($contentURLString, $cacheDir = null) { if (!$contentURLString) { error_log("No URL provided"); return; } if ($cacheDir) { $this->_cacheDir = $cacheDir; } $this->_contentURLString = $contentURLString; $path = parse_url($contentURLString, PHP_URL_PATH); if (!$path) { error_log("Malformed URL"); return; } $comps = explode('/', $path); if (!$comps || count($comps) < 5) { error_log("Malformed path"); return; } $this->_userId = $comps[2]; $this->_siteId = $comps[3]; $this->_stackId = $comps[4]; Valid::objectId($this->_userId); Valid::objectId($this->_siteId); Valid::objectId($this->_stackId); }