示例#1
0
 /**
  * @param string|Object $source source name
  * @param string        $target dest name
  *
  * @throws \RuntimeException
  * @throws \InvalidArgumentException
  * @return string
  */
 public function rename($source, $target)
 {
     if ($source instanceof Object) {
         if (!$source->isBlob()) {
             throw new \InvalidArgumentException("The given object is not a blob, it couldn't be renamed");
         }
         $sourceName = $source->getFullPath();
     } else {
         $sourceName = $source;
     }
     $this->clearAll();
     $this->addCommandName(self::MV_COMMAND);
     // Skip move or rename actions which would lead to an error condition
     $this->addCommandArgument('-k');
     $this->addCommandSubject($sourceName);
     $this->addCommandSubject2($target);
     return $this->getCommand();
 }