/** * @param SwiftObject $object * @param Container $destination * @param string $name * * @throws SwiftException * * @return SwiftObject * * @see DriverInterface::copyObject() */ public function copyObject(SwiftObject $object, Container $destination, $name = null) { if (is_null($name)) { $name = $object->getName(); } // detect circular reference if ($object->getContainer() === $destination && $object->getName() === $name) { throw new SwiftException('Destination is same as source'); } return $this->driver->copyObject($object, $destination, $name); }
/** * @inheritdoc */ public function updateObject(SwiftObject $object) { // persist container $this->updateContainer($object->getContainer()); // see if local file is specified if (is_null($object->getLocalFile())) { // just update the headers return $this->updateObjectMetadata($object); } // timestamp the object $object->setLastModifiedDate(new \DateTime()); $this->logger->info(sprintf('Updating object "%s"', $object->getPath())); $response = $this->put($object->getPath(), null, $object->getUpdateHeaders(), $object->getBody()); return $this->assertResponse($response, [201 => true]); }