ls() public static method

Returns all paths inside a directory.
public static ls ( string $dir ) : array
$dir string
return array
Beispiel #1
0
 /**
  * Register commands
  *
  * @param $commandsDir
  * @return bool
  */
 protected function _registerCommands($commandsDir)
 {
     $files = FS::ls($commandsDir);
     if (empty($files)) {
         return false;
     }
     foreach ($files as $file) {
         require_once $file;
         $reflection = new \ReflectionClass(__NAMESPACE__ . '\\Command\\' . FS::filename($file));
         if ($reflection->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$reflection->isAbstract()) {
             $this->add($reflection->newInstance());
         }
     }
     return true;
 }
Beispiel #2
0
 public function testLS()
 {
     $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'dir1';
     @mkdir($dir);
     $file1 = $dir . DIRECTORY_SEPARATOR . 'file1';
     touch($file1);
     is(array($file1), FS::ls($dir));
     FS::rmdir($dir);
 }