public function testUriParser() { $uri = 'http://www.softservlet.com:1234/asdf/1234?q=1#f=2'; $parser = new UriParser($uri); $this->assertEquals($parser->getSchema(), 'http'); $this->assertEquals($parser->getLocation(), 'www.softservlet.com:1234/asdf/1234'); $this->assertEquals($parser->getQuery(), 'q=1'); $this->assertEquals($parser->getFragment(), 'f=2'); }
/** * (non-PHPdoc) * @see \Softservlet\FileManager\Deliver\DeliveryInterface::httpUrl() */ public function httpUrl(FileInterface $file) { $uri = new UriParser($file->uri()); if ($uri->getSchema() !== 'file') { throw new Exception("This driver supports only the 'file' schema"); } $path = base_path(); $location = str_replace($path, '', $uri->getLocation()); $location = trim($location, '/'); return asset($location); }
/** * @brief forward calls to specifi storage driver * */ public function __call($name, $params) { if ($params[0] instanceof FileInterface) { $uri = new UriParser($params[0]->uri()); $driver = $this->findBySchema($uri->getSchema()); return call_user_func_array(array($driver, $name), $params); } else { parent::__callStatic($name, $params); } }