ComponentsIntegrationService::fixAllInAppScope()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 3
nc 3
nop 0
1
<?php
2
namespace Mouf\Html\Utils\WebLibraryManager\Components;
3
4
use Mouf\Composer\ComposerService;
5
use Mouf\MoufManager;
6
use Mouf\Html\Utils\WebLibraryManager\ComponentInstaller\ComponentInstaller;
7
8
/**
9
 * This service is in charge of integrating the "components" JS/CSS packages notion
10
 * with the WebLibraryManager.
11
 * It offers features for mapping components (as defined in http://github.com/robloach/component-installer)
12
 * into WebLibraries. 
13
 * 
14
 * @author David Négrier
15
 */
16
class ComponentsIntegrationService {
17
	
18
	public static function fixAllInAppScope() {
19
		$composerService = new ComposerService();
20
		$packages = $composerService->getLocalPackagesOrderedByDependencies();
21
		
22
		$moufManager = MoufManager::getMoufManager();
23
		
24
		foreach ($packages as $package) {
25
			/* @var $package PackageInterface */
26
			if ($package->getType() != "component") {
27
				continue;
28
			}
29
				
30
			ComponentInstaller::installComponent($package, $composerService->getComposerConfig(), $moufManager);
31
		}
32
	}
33
}
34