Code Duplication    Length = 5-7 lines in 3 locations

engine/classes/ElggPluginPackage.php 3 locations

@@ 244-248 (lines=5) @@
241
242
		foreach ($provides as $provide) {
243
			// only valid provide types
244
			if (!in_array($provide['type'], $this->providesSupportedTypes)) {
245
				$this->errorMsg =
246
					_elgg_services()->translator->translate('ElggPluginPackage:InvalidPlugin:InvalidProvides', array($provide['type']));
247
				return false;
248
			}
249
250
			// doesn't conflict or require any of its provides
251
			$name = $provide['name'];
@@ 254-258 (lines=5) @@
251
			$name = $provide['name'];
252
			foreach (array('conflicts', 'requires') as $dep_type) {
253
				foreach (${$dep_type} as $dep) {
254
					if (!in_array($dep['type'], $this->depsSupportedTypes)) {
255
						$this->errorMsg =
256
							_elgg_services()->translator->translate('ElggPluginPackage:InvalidPlugin:InvalidDependency', array($dep['type']));
257
						return false;
258
					}
259
260
					// make sure nothing is providing something it conflicts or requires.
261
					if (isset($dep['name']) && $dep['name'] == $name) {
@@ 264-270 (lines=7) @@
261
					if (isset($dep['name']) && $dep['name'] == $name) {
262
						$version_compare = version_compare($provide['version'], $dep['version'], $dep['comparison']);
263
264
						if ($version_compare) {
265
							$this->errorMsg =
266
								_elgg_services()->translator->translate('ElggPluginPackage:InvalidPlugin:CircularDep',
267
									array($dep['type'], $dep['name'], $this->id));
268
269
							return false;
270
						}
271
					}
272
				}
273
			}