Code Duplication    Length = 15-15 lines in 2 locations

lib/private/Memcache/Factory.php 2 locations

@@ 89-103 (lines=15) @@
86
87
		$missingCacheMessage = 'Memcache {class} not available for {use} cache';
88
		$missingCacheHint = 'Is the matching PHP module installed and enabled?';
89
		if (!class_exists($localCacheClass) || !$localCacheClass::isAvailable()) {
90
			if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
91
				// CLI should not hard-fail on broken memcache
92
				$this->logger->info($missingCacheMessage, [
93
					'class' => $localCacheClass,
94
					'use' => 'local',
95
					'app' => 'cli'
96
				]);
97
				$localCacheClass = self::NULL_CACHE;
98
			} else {
99
				throw new \OC\HintException(strtr($missingCacheMessage, [
100
					'{class}' => $localCacheClass, '{use}' => 'local'
101
				]), $missingCacheHint);
102
			}
103
		}
104
		if (!class_exists($distributedCacheClass) || !$distributedCacheClass::isAvailable()) {
105
			if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
106
				// CLI should not hard-fail on broken memcache
@@ 104-118 (lines=15) @@
101
				]), $missingCacheHint);
102
			}
103
		}
104
		if (!class_exists($distributedCacheClass) || !$distributedCacheClass::isAvailable()) {
105
			if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
106
				// CLI should not hard-fail on broken memcache
107
				$this->logger->info($missingCacheMessage, [
108
					'class' => $distributedCacheClass,
109
					'use' => 'distributed',
110
					'app' => 'cli'
111
				]);
112
				$distributedCacheClass = self::NULL_CACHE;
113
			} else {
114
				throw new \OC\HintException(strtr($missingCacheMessage, [
115
					'{class}' => $distributedCacheClass, '{use}' => 'distributed'
116
				]), $missingCacheHint);
117
			}
118
		}
119
		if (!($lockingCacheClass && class_exists($distributedCacheClass) && $lockingCacheClass::isAvailable())) {
120
			// don't fallback since the fallback might not be suitable for storing lock
121
			$lockingCacheClass = self::NULL_CACHE;