Skip to content

Commit

Permalink
✨ Add getUrl method.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Apr 2, 2017
1 parent fd7bbcc commit 1091825
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ array $flysystem->getMetadata('file.md');

int $flysystem->getSize('file.md');

string $flysystem->getUrl('file.md');

string $flysystem->getMimetype('file.md');

int $flysystem->getTimestamp('file.md');
Expand Down
14 changes: 13 additions & 1 deletion src/QiniuAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ public function has($path)
return !$error || is_array($response);
}

/**
* Get resource url.
*
* @param string $path
*
* @return string
*/
public function getUrl($path)
{
return $this->normalizeHost($this->domain).$path;
}

/**
* Read a file.
*
Expand All @@ -219,7 +231,7 @@ public function has($path)
*/
public function read($path)
{
$contents = file_get_contents($this->normalizeHost($this->domain).$path);
$contents = file_get_contents($this->getUrl($path));

return compact('contents', 'path');
}
Expand Down

0 comments on commit 1091825

Please sign in to comment.