src/cart/DomainRenewalProduct.php
public function daysBeforeExpireValidator($attribute)
    {
        if (isset($this->daysBeforeExpire[$this->getZone()])) {
            $minDays = $this->daysBeforeExpire[$this->getZone()];
            $interval = (new DateTime())->diff(new DateTime($this->_model->expires));
            $diff = $interval->format('%a') - $minDays;
            if ($diff > 0) {
                $date = Yii::$app->formatter->asDate((new DateTime())->add(new \DateInterval("P{$diff}D")));
                $this->addError('id', Yii::t('hipanel:domain', 'Domains in zone {zone} could be renewed only in last {min, plural, one{# day} other{# days}} before the expiration date. You are able to renew domain {domain} only after {date} (in {days, plural, one{# day} other{# days}})', ['zone' => (string) $this->getZone(), 'min' => (int) $minDays, 'date' => (string) $date, 'days' => (int) $diff, 'domain' => (string) $this->name]));

                return false;
            }
        }

        return true;
    }
public function daysBeforeExpireValidator($attribute)
    {
        if (isset($this->daysBeforeExpire[$this->getZone()])) {
            $minDays = $this->daysBeforeExpire[$this->getZone()];
            $interval = (new DateTime())->diff(new DateTime($this->_model->expires));
            $diff = $interval->format('%a') - $minDays;
            if ($diff > 0) {
                $date = Yii::$app->formatter->asDate((new DateTime())->add(new \DateInterval("P{$diff}D")));
                $this->addError('id', Yii::t('hipanel:domain', 'Domains in zone {zone} could be renewed only in last {min, plural, one{# day} other{# days}} before the expiration date. You are able to renew domain {domain} only after {date} (in {days, plural, one{# day} other{# days}})', ['zone' => (string) $this->getZone(), 'min' => (int) $minDays, 'date' => (string) $date, 'days' => (int) $diff, 'domain' => (string) $this->name]));

                return false;
            }
        }

        return true;
    }
public function daysBeforeExpireValidator ( $ attribute ) { if ( isset ( $ this -> daysBeforeExpire [ $ this -> getZone ( ) ] ) ) { $ minDays = $ this -> daysBeforeExpire [ $ this -> getZone ( ) ] ; $ interval = ( new DateTime ( ) ) -> diff ( new DateTime ( $ this -> _model -> expires ) ) ; $ diff = $ interval -> format ( '%a' ) - $ minDays ; if ( $ diff > 0 ) { $ date = Yii :: $ app -> formatter -> asDate ( ( new DateTime ( ) ) -> add ( new \ DateInterval ( "P{$diff}D" ) ) ) ; $ this -> addError ( 'id' , Yii :: t ( 'hipanel:domain' , 'Domains in zone {zone} could be renewed only in last {min, plural, one{# day} other{# days}} before the expiration date. You are able to renew domain {domain} only after {date} (in {days, plural, one{# day} other{# days}})' , [ 'zone' => ( string ) $ this -> getZone ( ) , 'min' => ( int ) $ minDays , 'date' => ( string ) $ date , 'days' => ( int ) $ diff , 'domain' => ( string ) $ this -> name ] ) ) ; return false ; } } return true ; }
Checks whether domain reached the limit of days before expiration date and can be renewed.

@param $attribute
@return bool
Checks whether domain reached the limit of days before expiration date and can be renewed .