コード例 #1
0
ファイル: fileTest.php プロジェクト: weareathlon/silla.io
 /**
  * @covers Core\Helpers\File::getFullPath
  */
 public function testGettingFullPathFromFull()
 {
     $this->assertEquals($this->fullPath, File::getFullPath($this->fullPath));
 }
コード例 #2
0
ファイル: directory.php プロジェクト: weareathlon/silla.io
 /**
  * Copies a directory to another destination, recursively.
  *
  * @param string $from Full or relative path to directory.
  * @param string $to   Full or relative path to destination directory.
  *
  * @uses   File::getFullPath To format path to file.
  * @uses   self::create To create a directory.
  * @uses   self::copy To recursively copy subdirectories.
  * @uses   File::copy To copy files to the destination.
  *
  * @return boolean If the directory and its contents were copied successfully.
  */
 public static function copy($from, $to)
 {
     $from = File::getFullPath($from);
     /* Create destination directory. */
     $copied = self::create($to);
     /* Open a directory handle. */
     $handle = opendir($from);
     /* Read entries from the directory handle. */
     while (($entry = readdir($handle)) !== false) {
         /* Skip directory handles for current and previous directories. */
         if ($entry == '.' || $entry == '..') {
             continue;
         }
         /* Check whether the current entry is a directory and is not a symbolic link */
         if (is_dir($from . DIRECTORY_SEPARATOR . $entry) && !is_link($from)) {
             $copied = self::copy($from . DIRECTORY_SEPARATOR . $entry, $to . DIRECTORY_SEPARATOR . $entry);
         } else {
             $copied = File::copy($from . DIRECTORY_SEPARATOR . $entry, $to . DIRECTORY_SEPARATOR . $entry);
         }
     }
     /* Close directory handle */
     closedir($handle);
     return $copied;
 }
コード例 #3
0
ファイル: filesystem.php プロジェクト: weareathlon/silla.io
 /**
  * Checks if a key-value pair exists.
  *
  * @param string $key Cache key.
  *
  * @return boolean
  */
 public function exists($key)
 {
     $file = self::storagePath() . self::generateName($key);
     $file = File::getFullPath($file);
     return is_file($file);
 }