<commit_before><?php


namespace Imagery;

/**
 * Class Image
 * @package Imagery
 */
final class Image extends \SplFileInfo
{

    /**
     * @var int
     */
    private $width;

    /**
     * @var int
     */
    private $height;

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

    /**
     * @var int
     */
    private $imageType;

    /**
     * @var \Imagery\DataCollection
     */
    private $iptc;

    /**
     * @var \Imagery\DataCollection
     */
    private $exif;

    /**
     * @param string $file_name
     */
    public function __construct($file_name)
    {
        parent::__construct($file_name);

        $info = @getimagesize($this->getPathname(), $iptc);

        if (!$info) {
            throw new \LogicException(sprintf("File %s is not an image", $this->getPathname()));
        }

        $this->width     = $info[0];
        $this->height    = $info[1];
        $this->imageType = $info[2];
        $this->mimeType  = $info['mime'];

        if ($this->isJpeg()) {
            $this->iptc = new DataCollection((new Extractor\Iptc())->extract($this->getPathname()));
            $this->exif = new DataCollection((new Extractor\Exif())->extract($this->getPathname()));
        }
    }

    /**
     * @return int
     */
    public function getWidth()
    {
        return $this->width;
    }

    /**
     * @return int
     */
    public function getHeight()
    {
        return $this->height;
    }

    /**
     * @return string
     */
    public function getMimeType()
    {
        return $this->mimeType;
    }

    /**<commit_msg>Image passes array to extractors<commit_after><?php


namespace Imagery;

/**
 * Class Image
 * @package Imagery
 */
final class Image extends \SplFileInfo
{

    /**
     * @var int
     */
    private $width;

    /**
     * @var int
     */
    private $height;

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

    /**
     * @var int
     */
    private $imageType;

    /**
     * @var \Imagery\DataCollection
     */
    private $iptc;

    /**
     * @var \Imagery\DataCollection
     */
    private $exif;

    /**
     * @param string $file_name
     */
    public function __construct($file_name)
    {
        parent::__construct($file_name);

        $info = @getimagesize($this->getPathname(), $iptc);

        if (!$info) {
            throw new \LogicException(sprintf("File %s is not an image", $this->getPathname()));
        }

        $this->width     = $info[0];
        $this->height    = $info[1];
        $this->imageType = $info[2];
        $this->mimeType  = $info['mime'];

        if ($this->isJpeg()) {

            var_dump($iptc);
            if (is_array($iptc)) {
                $this->iptc = new DataCollection((new Extractor\Iptc())->extract($iptc));
            }
            if (function_exists("exif_read_data")) {
                $sections = @exif_read_data($this->getPathname(), null, true, false);
                $this->exif = new DataCollection((new Extractor\Exif())->extract($sections));
            }
        }
    }

    /**
     * @return int
     */
    public function getWidth()
    {
        return $this->width;
    }

    /**
     * @return int
     */
    public function getHeight()
    {
        return $this->height;
    }

    /**
     * @return string
     */
    public function getMimeType()
    {
        return $this->mimeType;
    }

    /**
{'fraction_non_alphanumeric': 0.16024698618053515, 'fraction_numerical': 0.0017641870038224052, 'mean_word_length': 1.6829652996845426, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, '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': '5964683', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1064, 'n_words': 206}