示例#1
0
文件: UvDriver.php 项目: staabm/file
 /**
  * {@inheritdoc}
  */
 public function rename($from, $to)
 {
     $this->reactor->addRef();
     $promisor = new Deferred();
     \uv_fs_rename($this->loop, $from, $to, function ($fh) use($promisor) {
         $this->reactor->delRef();
         $promisor->succeed((bool) $fh);
     });
     return $promisor->promise();
 }
示例#2
0
<?php

uv_fs_rename(uv_default_loop(), "moe", "moe2", function ($result) {
    var_dump($result);
});
uv_run();
示例#3
0
 public function rename($old_path, $new_path, $callback)
 {
     uv_fs_rename($this->getEventLoop(), $old_path, $new_path, $callback);
 }
 /**
  * Rename or move a file. The callback will get $this instance and an boolean determining if
  * the operation was successful or not.
  *
  * @param string $from
  * @param string $to
  * @param callable $callback
  * @return $this
  */
 public function rename($from, $to, callable $callback = null)
 {
     $self = $this;
     \uv_fs_rename($this->getLoop()->getBackend(), $from, $to, function ($success) use($callback, $self) {
         if ($callback === null) {
             return;
         }
         $callback($self, $success);
     });
     return $this;
 }