Code Duplication    Length = 11-13 lines in 2 locations

includes/specials/SpecialBlock.php 1 location

@@ 868-878 (lines=11) @@
865
	 * @return string Timestamp or 'infinity'
866
	 */
867
	public static function parseExpiryInput( $expiry ) {
868
		if ( wfIsInfinity( $expiry ) ) {
869
			$expiry = 'infinity';
870
		} else {
871
			$expiry = strtotime( $expiry );
872
873
			if ( $expiry < 0 || $expiry === false ) {
874
				return false;
875
			}
876
877
			$expiry = wfTimestamp( TS_MW, $expiry );
878
		}
879
880
		return $expiry;
881
	}

includes/ProtectionForm.php 1 location

@@ 161-173 (lines=13) @@
158
		} else {
159
			$value = $this->mExpirySelection[$action];
160
		}
161
		if ( wfIsInfinity( $value ) ) {
162
			$time = 'infinity';
163
		} else {
164
			$unix = strtotime( $value );
165
166
			if ( !$unix || $unix === -1 ) {
167
				return false;
168
			}
169
170
			// @todo FIXME: Non-qualified absolute times are not in users specified timezone
171
			// and there isn't notice about it in the ui
172
			$time = wfTimestamp( TS_MW, $unix );
173
		}
174
		return $time;
175
	}
176