Code Duplication    Length = 15-18 lines in 2 locations

control/Director.php 2 locations

@@ 1122-1136 (lines=15) @@
1119
	 *
1120
	 * @return bool
1121
	 */
1122
	public static function isDev() {
1123
		// Check session
1124
		if ($env = self::session_environment()) return $env === 'dev';
1125
1126
		// Check config
1127
		if (Config::inst()->get('Director', 'environment_type') === 'dev') return true;
1128
1129
		// Check if we are running on one of the test servers
1130
		$devServers = (array)Config::inst()->get('Director', 'dev_servers');
1131
		if (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], $devServers))  {
1132
			return true;
1133
		}
1134
1135
		return false;
1136
	}
1137
1138
	/**
1139
	 * This function will return true if the site is in a test environment. For information about
@@ 1144-1161 (lines=18) @@
1141
	 *
1142
	 * @return bool
1143
	 */
1144
	public static function isTest() {
1145
		// In case of isDev and isTest both being set, dev has higher priority
1146
		if (self::isDev()) return false;
1147
1148
		// Check saved session
1149
		if ($env = self::session_environment()) return $env === 'test';
1150
1151
		// Check config
1152
		if (Config::inst()->get('Director', 'environment_type') === 'test') return true;
1153
1154
		// Check if we are running on one of the test servers
1155
		$testServers = (array)Config::inst()->get('Director', 'test_servers');
1156
		if (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], $testServers))  {
1157
			return true;
1158
		}
1159
1160
		return false;
1161
	}
1162
1163
	/**
1164
	 * Check or update any temporary environment specified in the session.