<commit_before><?php

namespace TwigYard\Component;

use Gregwar\Image\Image;

class ImageFactory
{
    /**
     * @var string
     */
    private $cacheDir;

    /**
     * @var string
     */
    private $assetDir;

    /**
     * @var string
     */
    private $basePath;

    /**
     * ImageFactory constructor.
     * @param string $basePath
     * @param string $cacheDir
     */
    public function __construct($basePath, $cacheDir)
    {
        $this->basePath = $basePath;
        $this->cacheDir = $cacheDir;
    }

    /**
     * @param $image
     * @return \Gregwar\Image\Image
     */
    public function getImage($image)
    {
        $image = new Image($this->assetDir . '/' . $image);
        $image->setCacheDir($this->basePath . '/' . $this->cacheDir);
        $image->setActualCacheDir($this->assetDir . '/' . $this->cacheDir);

        return $image;
    }

    /**
     * @param string $assetDir
     */
    public function setAssetDir($assetDir)
    {
        $this->assetDir = $assetDir;
    }
}<commit_msg>Enable progressive images (see #68)<commit_after><?php

namespace TwigYard\Component;

use Gregwar\Image\Image;

class ImageFactory
{
    /**
     * @var string
     */
    private $cacheDir;

    /**
     * @var string
     */
    private $assetDir;

    /**
     * @var string
     */
    private $basePath;

    /**
     * ImageFactory constructor.
     * @param string $basePath
     * @param string $cacheDir
     */
    public function __construct($basePath, $cacheDir)
    {
        $this->basePath = $basePath;
        $this->cacheDir = $cacheDir;
    }

    /**
     * @param $image
     * @return \Gregwar\Image\Image
     */
    public function getImage($image)
    {
        $image = new Image($this->assetDir . '/' . $image);
        $image->setCacheDir($this->basePath . '/' . $this->cacheDir);
        $image->setActualCacheDir($this->assetDir . '/' . $this->cacheDir);
        $image->enableProgressive();

        return $image;
    }

    /**
     * @param string $assetDir
     */
    public function setAssetDir($assetDir)
    {
        $this->assetDir = $assetDir;
    }
}
{'fraction_non_alphanumeric': 0.152797367183827, 'fraction_numerical': 0.0009402914903620122, 'mean_word_length': 1.9679218967921897, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '7645839', 'n_tokens_mistral': 686, 'n_tokens_neox': 670, 'n_words': 125}