Skip to content

Commit

Permalink
Public methods for getting host and extension on media
Browse files Browse the repository at this point in the history
  • Loading branch information
bHelland committed Sep 8, 2015
1 parent 12e6a8a commit a489779
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Keyteq/Keymedia/Model/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ public function getUrl()
return $this->file['url'];
}

protected function getHost($protocol = 'http')
/**
* @param string/false $protocol false to get host without protocol
* @return string
*/
public function getHost($protocol = 'http')
{
return "{$protocol}://{$this->host}";
return $protocol === false ? $this->host : "{$protocol}://{$this->host}";
}

public function getShareUrl()
Expand Down Expand Up @@ -89,7 +93,7 @@ protected function getImageThumbnailUrl($width, $height)
return $this->buildUrl("{$width}x{$height}/{$this->_id}.{$ending}");
}

protected function getExtension()
public function getExtension()
{
if ($this->file && isset($this->file['ending'])) {
$ending = $this->file['ending'];
Expand Down

0 comments on commit a489779

Please sign in to comment.