public function setExpirationDate($date)
    {
        if (is_int($date) || ctype_digit(strval($date))) {
            $expirationDate = intval($date);
        } else {
            $expirationDate = strtotime($date);
        }

        if ($expirationDate === false) {
            throw new InvalidArgumentException(
                sprintf(
                    'Invalid expiration date format: "%s". Please use a ' .
                    'format compatible with PHP\'s strtotime().',
                    $date
                )
            );
        }

        if ($expirationDate !== 0 && $expirationDate < time() + 86400) {
            throw new InvalidArgumentException(
                'Expiration date must be at least a day in the future.'
            );
        }

        // GnuPG suffers from the 2038 bug
        if ($expirationDate > 2147483647) {
            throw new InvalidArgumentException(
                'Expiration date must not be greater than 2038-01-19T03:14:07.'
            );
        }

        $this->expirationDate = $expirationDate;

        return $this;
    }
public function setExpirationDate($date)
    {
        if (is_int($date) || ctype_digit(strval($date))) {
            $expirationDate = intval($date);
        } else {
            $expirationDate = strtotime($date);
        }

        if ($expirationDate === false) {
            throw new InvalidArgumentException(
                sprintf(
                    'Invalid expiration date format: "%s". Please use a ' .
                    'format compatible with PHP\'s strtotime().',
                    $date
                )
            );
        }

        if ($expirationDate !== 0 && $expirationDate < time() + 86400) {
            throw new InvalidArgumentException(
                'Expiration date must be at least a day in the future.'
            );
        }

        // GnuPG suffers from the 2038 bug
        if ($expirationDate > 2147483647) {
            throw new InvalidArgumentException(
                'Expiration date must not be greater than 2038-01-19T03:14:07.'
            );
        }

        $this->expirationDate = $expirationDate;

        return $this;
    }
public function setExpirationDate ( $ date ) { if ( is_int ( $ date ) || ctype_digit ( strval ( $ date ) ) ) { $ expirationDate = intval ( $ date ) ; } else { $ expirationDate = strtotime ( $ date ) ; } if ( $ expirationDate === false ) { throw new InvalidArgumentException ( sprintf ( 'Invalid expiration date format: "%s". Please use a ' . 'format compatible with PHP\'s strtotime().' , $ date ) ) ; } if ( $ expirationDate !== 0 && $ expirationDate < time ( ) + 86400 ) { throw new InvalidArgumentException ( 'Expiration date must be at least a day in the future.' ) ; } // GnuPG suffers from the 2038 bug if ( $ expirationDate > 2147483647 ) { throw new InvalidArgumentException ( 'Expiration date must not be greater than 2038-01-19T03:14:07.' ) ; } $ this -> expirationDate = $ expirationDate ; return $ this ; }
Sets the expiration date of generated keys

@param string|integer $date either a string that may be parsed by
PHP's strtotime() function, or an integer
timestamp representing the number of seconds
since the UNIX epoch. This date must be at
least one date in the future. Keys that
expire in the past may not be generated. Use
an expiration date of 0 for keys that do not
expire.

@throws InvalidArgumentException if the date is not a valid format, or
if the date is not at least one day in
the future, or if the date is greater
than 2038-01-19T03:14:07.

@return Crypt_GPG_KeyGenerator the current object, for fluent interface.
Sets the expiration date of generated keys