Code Duplication    Length = 11-13 lines in 2 locations

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

includes/specials/SpecialBlock.php 1 location

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