Example #1
0
File: Fs.php Project: vgrish/dvelum
 protected static function _scanClassDir($path, &$map, &$mapPackaged, $exceptPath, $packages, $packagesCfg)
 {
     $path = File::fillEndSep($path);
     $items = File::scanFiles($path, array('.php'), false);
     if (empty($items)) {
         return;
     }
     foreach ($items as $item) {
         if (File::getExt($item) === '.php') {
             $parts = explode(DIRECTORY_SEPARATOR, str_replace($exceptPath, '', substr($item, 0, -4)));
             $parts = array_map('ucfirst', $parts);
             $class = implode('_', $parts);
             $package = false;
             if (isset($packages[$item]) && $packagesCfg['packages'][$packages[$item]]['active']) {
                 $package = $packagesCfg->get('path') . $packages[$item] . '.php';
             } else {
                 $package = $item;
             }
             if (!isset($map[$class])) {
                 $map[$class] = $item;
             }
             if (!isset($mapPackaged[$class])) {
                 $mapPackaged[$class] = $package;
             }
         } else {
             self::_scanClassDir($item, $map, $mapPackaged, $exceptPath, $packages, $packagesCfg);
         }
     }
 }
Example #2
0
 public function testFillEndSep()
 {
     $this->assertEquals('/path/to/file/', File::fillEndSep('/path/to/file'));
     $this->assertEquals('/path/to/file/', File::fillEndSep('/path/to/file/'));
 }