ActionScheduler_OptionLock::get_expiration_from()privateWC 1.0

Given the lock string, derives the lock expiration timestamp (or false if it cannot be determined).

Method of the class: ActionScheduler_OptionLock{}

No Hooks.

Return

false|Int.

Usage

// private - for code of main (parent) class only
$result = $this->get_expiration_from( $lock_value );
$lock_value(string) (required)
String containing a timestamp, or pipe-separated combination of unique value and timestamp.

ActionScheduler_OptionLock::get_expiration_from() code WC 9.3.3

private function get_expiration_from( $lock_value ) {
	$lock_string = explode( '|', $lock_value );

	// Old style lock?
	if ( count( $lock_string ) === 1 && is_numeric( $lock_string[0] ) ) {
		return (int) $lock_string[0];
	}

	// New style lock?
	if ( count( $lock_string ) === 2 && is_numeric( $lock_string[1] ) ) {
		return (int) $lock_string[1];
	}

	return false;
}