_yearMaxValue = $yearMaxValue; $this->_yearMinValue = $yearMinValue; } /** * Validate timestamp * * @param int|string $timestamp * @param int|string $toDate * @return void * @throws \Magento\Framework\Exception\ValidatorException */ public function validate($timestamp, $toDate) { $transitionYear = date('Y', $timestamp); if ($transitionYear > $this->_yearMaxValue || $transitionYear < $this->_yearMinValue) { throw new ValidatorException( new Phrase( "The transition year isn't included in the system date range. " . "Verify the year date range and try again." ) ); } if ((int) $timestamp > (int) $toDate) { throw new ValidatorException( new Phrase('Transition year is out of specified date range.') ); } } }