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 set the file * * @param FileInterface file */ public function setFile(FileInterface $file) { $this->file = $file; $uri = new UriParser($file->uri()); $this->location = $uri->getLocation(); }