コード例 #1
0
 /**
  * @param ClassFinderAdapter $adapter
  */
 function writeToAdapter($adapter)
 {
     if (!empty($data['include-path'])) {
         $this->addIncludePaths((array) $data['include-path']);
     }
     if (!empty($data['autoload']['psr-0'])) {
         $map = $this->transformMultiple($data['autoload']['psr-0']);
         $adapter->addMultiplePsr0($map);
     }
     if (!empty($data['autoload']['psr-4'])) {
         $map = $this->transformMultiple($data['autoload']['psr-4']);
         $adapter->addMultiplePsr4($map);
     }
     if (!empty($data['autoload']['classmap'])) {
         $this->addClassmapSources($adapter, (array) $data['autoload']['classmap']);
     }
     if (!empty($data['autoload']['files'])) {
         foreach ($data['autoload']['files'] as $file) {
             require $this->pathPrefix . $file;
         }
     }
 }
コード例 #2
0
 /**
  * @param ClassFinderAdapter $adapter
  */
 function writeToAdapter($adapter)
 {
     // PSR-0 namespaces / prefixes
     if (is_file($this->dir . '/autoload_namespaces.php')) {
         $prefixes = (require $this->dir . '/autoload_namespaces.php');
         if (!empty($prefixes)) {
             $adapter->addMultiplePsr0($prefixes);
         }
     }
     // PSR-4 namespaces
     if (is_file($this->dir . '/autoload_psr4.php')) {
         $map = (require $this->dir . '/autoload_psr4.php');
         if (!empty($map)) {
             $adapter->addMultiplePsr4($map);
         }
     }
     // Class map
     if (is_file($this->dir . '/autoload_classmap.php')) {
         $class_map = (require $this->dir . '/autoload_classmap.php');
         if (!empty($class_map)) {
             $adapter->addClassMap($class_map);
         }
     }
     // Include path
     if (is_file($this->dir . '/include_paths.php')) {
         $include_paths = (require $this->dir . '/include_paths.php');
         if (!empty($include_paths)) {
             array_push($include_paths, get_include_path());
             set_include_path(join(PATH_SEPARATOR, $include_paths));
         }
     }
     // Include files
     if (is_file($this->dir . '/autoload_files.php')) {
         $include_files = (require $this->dir . '/autoload_files.php');
         foreach ($include_files as $file) {
             require $file;
         }
     }
 }
 /**
  * Adds multiple PSR-4 namespaces.
  *
  * @param array $map
  *   Each array key is a namespace, e.g. "Acme\\FooPackage\\".
  *   Each array value is either a PSR-4 base directory or an array of PSR-4
  *   base directories.
  * @param bool $relative
  *   If TRUE, the paths will be relative to $this->localDirectory.
  */
 function addMultiplePsr4(array $map, $relative = TRUE) {
   $relative && $this->prependMultiple($map);
   $this->master->addMultiplePsr4($map);
 }