private function loadComponent()
	{
		/** @var Component $component */
    	$component = false;
    	$currentPath = Request::getRequestPath(__BASE);
    	$defaultPath = false;
    	
    	if (file_exists(__APP_CONFIG_COMPONENTS)) {
	    	$componentsData = json_decode(file_get_contents(__APP_CONFIG_COMPONENTS), true);
	    	
	    	if (!is_array($componentsData)) throw new PlinthException('Cannot parse components.json config');
	    	
	    	foreach ($componentsData as $label => $data) {
	    		$loadedComponent = Component::loadFromArray(__APP_CONFIG_PATH, $label, $data);
	    		if ($loadedComponent->getPath() === false) {
	    			if ($defaultPath === false) $defaultPath = true;
	    			else throw new PlinthException('Their can only be one default path in components.json config');
	    		}
	    		if ($loadedComponent->matchesCurrentPath($currentPath)) {
	    			if ($component === false || $loadedComponent->getDepth() > $component->getDepth()) $component = $loadedComponent;
	    		}
	    	}
    	}
    	    	
    	$this->component = $component;
    }
private function loadComponent()
	{
		/** @var Component $component */
    	$component = false;
    	$currentPath = Request::getRequestPath(__BASE);
    	$defaultPath = false;
    	
    	if (file_exists(__APP_CONFIG_COMPONENTS)) {
	    	$componentsData = json_decode(file_get_contents(__APP_CONFIG_COMPONENTS), true);
	    	
	    	if (!is_array($componentsData)) throw new PlinthException('Cannot parse components.json config');
	    	
	    	foreach ($componentsData as $label => $data) {
	    		$loadedComponent = Component::loadFromArray(__APP_CONFIG_PATH, $label, $data);
	    		if ($loadedComponent->getPath() === false) {
	    			if ($defaultPath === false) $defaultPath = true;
	    			else throw new PlinthException('Their can only be one default path in components.json config');
	    		}
	    		if ($loadedComponent->matchesCurrentPath($currentPath)) {
	    			if ($component === false || $loadedComponent->getDepth() > $component->getDepth()) $component = $loadedComponent;
	    		}
	    	}
    	}
    	    	
    	$this->component = $component;
    }
private function loadComponent ( ) { /** @var Component $component */ $ component = false ; $ currentPath = Request :: getRequestPath ( __BASE ) ; $ defaultPath = false ; if ( file_exists ( __APP_CONFIG_COMPONENTS ) ) { $ componentsData = json_decode ( file_get_contents ( __APP_CONFIG_COMPONENTS ) , true ) ; if ( ! is_array ( $ componentsData ) ) throw new PlinthException ( 'Cannot parse components.json config' ) ; foreach ( $ componentsData as $ label => $ data ) { $ loadedComponent = Component :: loadFromArray ( __APP_CONFIG_PATH , $ label , $ data ) ; if ( $ loadedComponent -> getPath ( ) === false ) { if ( $ defaultPath === false ) $ defaultPath = true ; else throw new PlinthException ( 'Their can only be one default path in components.json config' ) ; } if ( $ loadedComponent -> matchesCurrentPath ( $ currentPath ) ) { if ( $ component === false || $ loadedComponent -> getDepth ( ) > $ component -> getDepth ( ) ) $ component = $ loadedComponent ; } } } $ this -> component = $ component ; }
Load all components and activate the correct one

@throws PlinthException
Load all components and activate the correct one