<commit_before><?php

namespace Keyteq\Keymedia\Model;

use Keyteq\Keymedia\API\Request;

class Media extends Item
{
    protected $_id;
    protected $file;
    protected $name;
    protected $host;
    protected $shareUrl;

    public function getId()
    {
        return $this->_id;
    }

    public function getName()
    {
        return $this->name;
    }

    public function getType()
    {
        return $this->file['type'];
    }

    public function isImage(array $types = array())
    {
        list($general,$type) = explode('/', $this->getType());
        return $general === 'image' && (!$types || in_array($type, $types));
    }

    public function getUrl()
    {
        return $this->file['url'];
    }

    protected function getHost($protocol = 'http')
    {
        return "{$protocol}://{$this->host}";
    }

    public function getShareUrl()
    {
        return $this->shareUrl;
    }

    public function getThumbnailUrl($width = null, $height = null)
    {
        if ($this->isImage(array('png', 'jpg', 'jpeg', 'gif'))) {
            if (!(is_int($width) && is_int($height))) {
                throw new \InvalidArgumentException('Image thumbnails require dimensions!');
            }
            return $this->getImageThumbnailUrl($width, $height);
        }
        elseif ($this->isImage(array('svg+xml'))) {
            return $this->file['url'];
        }
        return $this->getTypeThumbnailUrl();
    }

    protected function getTypeThumbnailUrl()
    {
        $extension = $this->getExtension();
        $type = $this->mapExtensionToType($extension);
        $url = $this->buildUrl("images/filetypes/{$type}.png");

        return $url;
    }

    protected function getImageThumbnailUrl($width, $height)
    {
        $ending = $this->getExtension();
        return $this->buildUrl("{$width}x{$height}/{$this->_id}.{$ending}");
    }
<commit_msg>Use shareUrl for getThumbnailUrl() for svgs<commit_after><?php

namespace Keyteq\Keymedia\Model;

use Keyteq\Keymedia\API\Request;

class Media extends Item
{
    protected $_id;
    protected $file;
    protected $name;
    protected $host;
    protected $shareUrl;

    public function getId()
    {
        return $this->_id;
    }

    public function getName()
    {
        return $this->name;
    }

    public function getType()
    {
        return $this->file['type'];
    }

    public function isImage(array $types = array())
    {
        list($general,$type) = explode('/', $this->getType());
        return $general === 'image' && (!$types || in_array($type, $types));
    }

    public function getUrl()
    {
        return $this->file['url'];
    }

    protected function getHost($protocol = 'http')
    {
        return "{$protocol}://{$this->host}";
    }

    public function getShareUrl()
    {
        return $this->shareUrl;
    }

    public function getThumbnailUrl($width = null, $height = null)
    {
        if ($this->isImage(array('png', 'jpg', 'jpeg', 'gif'))) {
            if (!(is_int($width) && is_int($height))) {
                throw new \InvalidArgumentException('Image thumbnails require dimensions!');
            }
            return $this->getImageThumbnailUrl($width, $height);
        }
        elseif ($this->isImage(array('svg+xml'))) {
            return $this->shareUrl;
        }
        return $this->getTypeThumbnailUrl();
    }

    protected function getTypeThumbnailUrl()
    {
        $extension = $this->getExtension();
        $type = $this->mapExtensionToType($extension);
        $url = $this->buildUrl("images/filetypes/{$type}.png");

        return $url;
    }

    protected function getImageThumbnailUrl($width, $height)
    {
        $ending = $this->getExtension();
        return $this->buildUrl("{$width}x{$height}/{$this->_id}.{$ending}");
    }

{'fraction_non_alphanumeric': 0.16067209241270675, 'fraction_numerical': 0.0, 'mean_word_length': 2.4201077199281866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1194495', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1131, 'n_words': 229}