当前位置: 首页>>代码示例>>PHP>>正文


PHP FilesystemInterface::update方法代码示例

本文整理汇总了PHP中League\Flysystem\FilesystemInterface::update方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemInterface::update方法的具体用法?PHP FilesystemInterface::update怎么用?PHP FilesystemInterface::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\FilesystemInterface的用法示例。


在下文中一共展示了FilesystemInterface::update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUpdate

 /**
  * @dataProvider adapterProvider
  */
 public function testUpdate(FilesystemInterface $filesystem, $adapter, $mock)
 {
     $mock->shouldReceive('put')->andReturn(true, false);
     $mock->shouldReceive('stat')->andReturn(['type' => NET_SFTP_TYPE_DIRECTORY, 'mtime' => time(), 'size' => 20, 'permissions' => 0777]);
     $this->assertTrue($filesystem->update('something', 'something'));
     $this->assertFalse($filesystem->update('something_else.txt', 'else'));
 }
开发者ID:raddeus,项目名称:flysystem-sftp,代码行数:10,代码来源:SftpAdapterTests.php

示例2: write

 /**
  * Write settings content of a namespace
  *
  * @param  string $namespace
  * @param  array  $data
  * @return void
  */
 protected function write($namespace, array $data)
 {
     $file = $this->adapter->getFileName($namespace);
     $contents = $this->adapter->prepareForWriting($data);
     if (!$this->fileSystem->has($file)) {
         $this->fileSystem->write($file, $contents);
     }
     $this->fileSystem->update($file, $contents);
 }
开发者ID:Ellipizle,项目名称:HtSettingsModule,代码行数:16,代码来源:FileSystemMapper.php

示例3: erase

 /**
  * Erase a file.
  *
  * @param string $path
  * @throws IoWriteException
  */
 public function erase($path)
 {
     try {
         $this->fs->update($path, '');
     } catch (Error $ex) {
         throw new IoWriteException("File {$path} could not be erased.", $ex);
     } catch (Exception $ex) {
         throw new IoWriteException("File {$path} could not be erased.", $ex);
     }
 }
开发者ID:khelle,项目名称:surume,代码行数:16,代码来源:Filesystem.php

示例4: renameConflicts

 /** @inheritdoc */
 public function renameConflicts(array $conflicts)
 {
     $replacements = [];
     $this->traverser->addVisitor($this->reNamer);
     foreach ($conflicts as $package => $types) {
         foreach ($types as $type => $versions) {
             foreach ($versions as $version => $files) {
                 $composer = $this->reader->setPackage($package)->setVersion($version)->getComposerObject();
                 if ($this->hasNs($type)) {
                     $split = $this->splitNsandClass($type);
                     $fromNs = $split['ns'];
                     $psrNs = $this->getPsrNs($composer, $fromNs);
                     $toNs = $psrNs . $this->sanitizeVersionNo($version);
                     $diff = str_replace($psrNs, '', $fromNs);
                     if ($psrNs != $diff . '\\') {
                         $toNs = $toNs . '\\' . $diff;
                     }
                     $newFullyQualifiedType = $toNs . '\\' . $split['class'];
                 } else {
                     $fromNs = $type;
                     $toNs = $type . '_' . $this->sanitizeVersionNo($version);
                     $newFullyQualifiedType = $toNs;
                 }
                 $this->reNamer->rename($fromNs, $toNs);
                 $replacements[] = ['package' => $package, 'version' => $version, 'originalFullyQualifiedType' => $type, 'originalNamespace' => $fromNs, 'newFullyQualifiedType' => $newFullyQualifiedType, 'newNamespace' => $toNs, 'replacedIn' => $files];
                 foreach ($files as $file) {
                     $fullPath = $this->vendorDir . '/' . $package . '/' . $version . '/' . $file;
                     $src = $this->filesystem->read($fullPath);
                     $ast = $this->parser->parse($src);
                     $newAst = $this->traverser->traverse($ast);
                     $code = $this->prettyPrinter->prettyPrintFile($newAst);
                     $this->filesystem->update($fullPath, $code);
                 }
             }
         }
     }
     $this->traverser->removeVisitor($this->reNamer);
     return $replacements;
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:40,代码来源:PackageReNamer.php

示例5: backupAndUpdate

 private function backupAndUpdate($path, $content)
 {
     if ($this->enableBackup) {
         $oldContent = $this->master->read($path);
         if ($oldContent !== false) {
             if ($this->backup->has($path)) {
                 $this->backup->update($path, $oldContent);
             } else {
                 $this->backup->write($path, $oldContent);
             }
         }
     }
     $this->master->update($path, $content);
 }
开发者ID:acmephp,项目名称:acmephp,代码行数:14,代码来源:Repository.php

示例6: update

 /**
  * Update an existing file.
  *
  * @param string $path     The path of the existing file.
  * @param string $contents The file contents.
  * @param array  $config   An optional configuration array.
  *
  * @throws FileNotFoundException
  *
  * @return bool True on success, false on failure.
  */
 public function update($path, $contents, array $config = [])
 {
     return $this->fileSystem->update($path, $contents, $config);
 }
开发者ID:graze,项目名称:data-file,代码行数:15,代码来源:FilesystemWrapper.php

示例7: mirrorFile

 /**
  * @param string              $path
  * @param FilesystemInterface $remote
  * @param AdapterInterface    $remoteAdapter
  */
 private function mirrorFile($path, FilesystemInterface $remote, AdapterInterface $remoteAdapter)
 {
     $masterContent = $this->master->read($path);
     if (!is_string($masterContent)) {
         throw new \RuntimeException(sprintf('File %s could not be read on master storage', $path));
     }
     $isOnRemote = $remote->has($path);
     if ($isOnRemote && !$remote->update($path, $masterContent)) {
         throw $this->createRuntimeException('File', $path, 'updated', $remoteAdapter);
     } elseif (!$isOnRemote && !$remote->write($path, $masterContent)) {
         throw $this->createRuntimeException('File', $path, 'created', $remoteAdapter);
     }
 }
开发者ID:acmephp,项目名称:acmephp,代码行数:18,代码来源:AbstractFlysystemAction.php


注:本文中的League\Flysystem\FilesystemInterface::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。