getPath() public method

Get the path.
public getPath ( ) : string
return string
示例#1
0
 public function testGetPath()
 {
     $d = new Dir(__DIR__ . '/../tmp/');
     $this->assertContains('tmp', $d->getPath());
 }
示例#2
0
 /**
  * Method to create an archive file
  *
  * @param  string|array $files
  * @return void
  */
 public function addFiles($files)
 {
     if (!is_array($files)) {
         $files = array($files);
     }
     // Directory separator clean up
     $search = array('\\', '../', './');
     $replace = array('/', '', '');
     foreach ($files as $file) {
         // If file is a directory, loop through and add the files.
         if (file_exists($file) && is_dir($file)) {
             $dir = new Dir($file, true, true);
             $this->archive->addEmptyDir(str_replace($search, $replace, $dir->getPath()));
             $dirFiles = $dir->getFiles();
             foreach ($dirFiles as $fle) {
                 if (file_exists($fle) && is_dir($fle)) {
                     $this->archive->addEmptyDir(str_replace($search, $replace, $fle));
                 } else {
                     if (file_exists($fle)) {
                         $this->archive->addFile($fle, str_replace($search, $replace, $fle));
                     }
                 }
             }
             // Else, just add the file.
         } else {
             if (file_exists($file)) {
                 $this->archive->addFile($file, str_replace('\\', '/', $file));
             }
         }
     }
 }