/**
  * @param	string	$key	main route key
  * @param	array	$data	
  * @return	null
  */
 protected function loadConfiguration($masterKey, array $masterConfig = null, array $aliases = null)
 {
     $namespace = MvcRouteManager::getNamespace($masterKey);
     if (false === $namespace) {
         $err = "namespace not found -({$masterKey}) make sure route map ";
         $err .= "is loaded into the MvcRouteManager";
         throw new LogicException($err);
     }
     $this->setMasterKey($masterKey);
     if (null === $masterConfig) {
         $masterConfig = array();
     }
     $masterConfig['namespace'] = $namespace;
     /*
      * merge the default config array so that we can use a completed 
      * master array without forcing the developer to all items. This 
      * way we can aliases into master and pick up default values
      */
     $masterConfig = $this->merge($this->getDefaultConfig(), $masterConfig);
     $this->setMasterDetail($this->createRouteDetail($masterConfig));
     if (empty($aliases)) {
         return $this;
     }
     if ($aliases === array_values($aliases)) {
         $err = "second param must be an associative array -(key=>config)";
         throw new InvalidArgumentException($err);
     }
     $map = array();
     foreach ($aliases as $key => $data) {
         if (!is_string($key)) {
             $err = 'alias config invalid: route key must be a string';
             throw new InvalidArgumentException($err);
         }
         if ($masterKey === $key) {
             continue;
         }
         if (is_array($data)) {
             if (empty($data)) {
                 $data['namespace'] = $namespace;
                 $detail = $this->createRouteDetail($data);
             } else {
                 if (isset($data['is-inherit']) && false === $data['is-inherit']) {
                     $data['namespace'] = $namespace;
                     $detail = $this->createRouteDetail($data);
                 } else {
                     $config = $this->merge($masterConfig, $data);
                     if (null === $config) {
                         $err = "invalid alias config for -({$key}) could not ";
                         $err .= "inherit from master config";
                         throw new InvalidArgumentException($err);
                     }
                     $detail = $this->createRouteDetail($config);
                 }
             }
             $map[$key] = $detail;
         } else {
             if (is_string($data)) {
                 if ($masterKey === $data || array_key_exists($data, $aliases)) {
                     $map[$key] = $data;
                 } else {
                     $err = "alias pointer to other detail failed: ";
                     $err .= "-({$data}) is not an alias or master route key";
                     throw new InvalidArgumentException($err);
                 }
             } else {
                 if ($data instanceof MvcRouteDetailInterface) {
                     $map[$key] = $data;
                 } else {
                     if (empty($data)) {
                         $map[$key] = $masterKey;
                     }
                 }
             }
         }
     }
     $this->aliasMap = $map;
     return $this;
 }
 /**
  * @param	string	$key
  * @return	string | false
  */
 public function getNamespace($key)
 {
     return MvcRouteManager::getNamespace($key);
 }
 /**
  * Empty namespace are allowed but discouraged
  * @return	null
  */
 public function testAddRouteWithEmptyStringNamespace()
 {
     $this->assertNull(MvcRouteManager::addRoute('', ''));
     $this->assertEquals('', MvcRouteManager::getNamespace(''));
 }