statPrepare() public static method

Prepare value of stat()
public static statPrepare ( mixed $stat ) : array
$stat mixed Data
return array hash
Beispiel #1
0
 /**
  * lstat()
  * @param  string   $path Path
  * @param  callable $cb   Callback
  * @param  integer  $pri  Priority
  * @return resource|true
  */
 public static function lstat($path, $cb, $pri = EIO_PRI_DEFAULT)
 {
     $cb = CallbackWrapper::forceWrap($cb);
     if (!self::$supported) {
         call_user_func($cb, $path, FileSystem::statPrepare(lstat($path)));
         return true;
     }
     return eio_lstat($path, $pri, function ($path, $stat) use($cb) {
         call_user_func($cb, $path, FileSystem::statPrepare($stat));
     }, $path);
 }
Beispiel #2
0
 /**
  * Stat() non-cached
  * @param  callable $cb Callback
  * @param  integer $pri Priority
  * @return resource|boolean
  */
 public function statRefresh($cb, $pri = EIO_PRI_DEFAULT)
 {
     $cb = CallbackWrapper::forceWrap($cb);
     if (!$this->fd || $this->fd === -1) {
         if ($cb) {
             $cb($this, false);
         }
         return false;
     }
     if (!FileSystem::$supported) {
         $cb($this, FileSystem::statPrepare(fstat($this->fd)));
         return true;
     }
     return eio_fstat($this->fd, $pri, function ($file, $stat) use($cb) {
         $stat = FileSystem::statPrepare($stat);
         $file->stat = $stat;
         $cb($file, $stat);
     }, $this);
 }