<?php

namespace DhlPolskaVendor\WPDesk\License\Changelog\Filter;

use FilterIterator;
use Iterator;
/**
 * Filters items by version.
 *
 * @package WPDesk\License\Changelog
 */
class ByVersion extends FilterIterator
{
    /**
     * @var string
     */
    private $version;
    /**
     * Updates constructor.
     *
     * @param Iterator $changes
     * @param string   $version
     */
    public function __construct(Iterator $changes, string $version)
    {
        parent::__construct($changes);
        $this->version = $version;
    }
    public function accept(): bool
    {
        $change = $this->getInnerIterator()->current();
        return (bool) version_compare($change['version'], $this->version, '>');
    }
}
