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


PHP FilesystemInterface::put方法代码示例

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


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

示例1: toFile

 /**
  * {@inheritdoc}
  */
 public function toFile(Workout $workout, string $outputFile) : bool
 {
     $return = $this->filesystem->put($outputFile, $this->toString($workout));
     if ($return !== true) {
         throw new Exception(sprintf('Could not write to %s', $outputFile));
     }
     return true;
 }
开发者ID:dragosprotung,项目名称:stc-core,代码行数:11,代码来源:AbstractDumper.php

示例2: generate

 /** @inheritdoc */
 public function generate(array $replacements, $autoloader)
 {
     ReflectionEngine::init(new Locator($autoloader));
     foreach ($replacements as $replacement) {
         $fullPath = $this->vendorDir . '/' . $replacement['package'] . '/proxy/' . str_replace('\\', '/', $replacement['originalFullyQualifiedType']) . ".php";
         $this->filesystem->put($fullPath, $this->buildClass($replacement));
     }
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:9,代码来源:ProxyGenerator.php

示例3: put

 /**
  * Write the contents of a file.
  *
  * @param string          $path
  * @param string|resource $contents
  * @param string          $visibility
  *
  * @return bool
  */
 public function put($path, $contents, $visibility = null)
 {
     $config = ['visibility' => $this->parseVisibility($visibility)];
     if (is_resource($contents)) {
         return $this->driver->putStream($path, $contents, $config);
     }
     return $this->driver->put($path, $contents, $config);
 }
开发者ID:speedwork,项目名称:filesystem,代码行数:17,代码来源:FilesystemAdapter.php

示例4: writeFile

 /**
  * @param $filePath
  * @param $content
  */
 protected function writeFile($filePath, $content)
 {
     if (is_resource($content)) {
         $result = $this->filesystem->putStream($filePath, $content);
     } else {
         $result = $this->filesystem->put($filePath, $content);
     }
     if (!$result) {
         throw new SaveResourceErrorException('File cannot be written to the path ' . $filePath);
     }
 }
开发者ID:kivagant,项目名称:staticus-core,代码行数:15,代码来源:SaveResourceMiddlewareAbstract.php

示例5: put

 /**
  * Write the contents of a file.
  *
  * @param  string  $path
  * @param  string|resource  $contents
  * @param  array  $options
  * @return bool
  */
 public function put($path, $contents, $options = [])
 {
     if (is_string($options)) {
         $options = ['visibility' => $options];
     }
     if ($contents instanceof File || $contents instanceof UploadedFile) {
         return $this->putFile($path, $contents, $options);
     }
     if (is_resource($contents)) {
         return $this->driver->putStream($path, $contents, $options);
     } else {
         return $this->driver->put($path, $contents, $options);
     }
 }
开发者ID:jarnovanleeuwen,项目名称:framework,代码行数:22,代码来源:FilesystemAdapter.php

示例6: write

 /**
  * Write session data
  * @link http://php.net/manual/en/sessionhandlerinterface.write.php
  * @param string $session_id The session id.
  * @param string $session_data <p>
  * The encoded session data. This data is the
  * result of the PHP internally encoding
  * the $_SESSION superglobal to a serialized
  * string and passing it as this parameter.
  * Please note sessions use an alternative serialization method.
  * </p>
  * @return bool <p>
  * The return value (usually TRUE on success, FALSE on failure).
  * Note this value is returned internally to PHP for processing.
  * </p>
  * @since 5.4.0
  */
 public function write($session_id, $session_data)
 {
     if (!$this->driver->has($path = $this->path . $session_id)) {
         $this->driver->create($path);
     }
     return $this->driver->put($path, $session_data);
 }
开发者ID:AnonymPHP,项目名称:Anonym-Session,代码行数:24,代码来源:FileSessionHandler.php

示例7: put

 /**
  * Write the contents of a file.
  *
  * @param  string  $path
  * @param  string|resource  $contents
  * @param  string  $visibility
  * @return bool
  */
 public function put($path, $contents, $visibility = null)
 {
     if ($contents instanceof File || $contents instanceof UploadedFile) {
         return $this->putFile($path, $contents, $visibility);
     }
     if ($visibility = $this->parseVisibility($visibility)) {
         $config = ['visibility' => $visibility];
     } else {
         $config = [];
     }
     if (is_resource($contents)) {
         return $this->driver->putStream($path, $contents, $config);
     } else {
         return $this->driver->put($path, $contents, $config);
     }
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:24,代码来源:FilesystemAdapter.php

示例8: write

 /**
  * @inheritdoc
  */
 public function write($path, $contents, $append = false)
 {
     $path = $this->strategy->encode($path);
     if ($append === false && $this->filesystem->has($path)) {
         $this->filesystem->delete($path);
     }
     $this->filesystem->put($path, $contents);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:11,代码来源:MediaService.php

示例9: createFile

 /**
  * @override
  * @inheritDoc
  */
 public function createFile($path, $contents = '', $visibility = self::VISIBILITY_DEFAULT)
 {
     try {
         $this->fs->put($path, $contents, $this->prepareConfig($visibility));
         return;
     } catch (Error $ex) {
     } catch (Exception $ex) {
     }
     throw new WriteException("File {$path} could not be created.", $ex);
 }
开发者ID:kraken-php,项目名称:framework,代码行数:14,代码来源:Filesystem.php

示例10: onGetClassGenerateFile

 /**
  * Use flysystem to save the file in the desired location.
  *
  * @param \Onema\ClassyFile\Event\GetClassEvent $event
  */
 public function onGetClassGenerateFile(GetClassEvent $event)
 {
     $statement = $event->getStatements();
     $fileLocation = $event->getFileLocation();
     $code = $event->getCode();
     $name = $statement->name;
     if (!$this->filesystem->has($fileLocation)) {
         // dir doesn't exist, make it
         $this->filesystem->createDir($fileLocation);
     }
     $location = sprintf('%s/%s.php', $fileLocation, $name);
     $this->filesystem->put($location, $code);
     $adapter = $this->filesystem->getAdapter();
     if ($adapter instanceof AbstractAdapter) {
         $prefix = $adapter->getPathPrefix();
         $location = Util::normalizePath($location);
         $event->setFileLocation(sprintf('%s%s', $prefix, $location));
     }
 }
开发者ID:onema,项目名称:classyfile,代码行数:24,代码来源:GenerateClassFile.php

示例11: write

 /**
  * Create a file or update if exists.
  *
  * @param string $path
  * @param string $contents
  * @param string $visibility
  * @throws IoWriteException
  */
 public function write($path, $contents = '', $visibility = self::VISIBILITY_DEFAULT)
 {
     try {
         $this->fs->put($path, $contents, $this->prepareConfig($visibility));
     } catch (Error $ex) {
         throw new IoWriteException("File {$path} could not be overwritten.", $ex);
     } catch (Exception $ex) {
         throw new IoWriteException("File {$path} could not be overwritten.", $ex);
     }
 }
开发者ID:khelle,项目名称:surume,代码行数:18,代码来源:Filesystem.php

示例12: create

 /**
  * Create a file or folder.
  *
  * @param string      $path
  * @param string|null $contents
  */
 protected function create($path, $contents = null)
 {
     // If the file already exists, quit
     $path = $this->formatPath($path);
     if ($this->filesystem->has($path)) {
         return;
     }
     // Create the file or folder
     if ($contents) {
         $this->filesystem->put($path, $contents);
     } else {
         $this->filesystem->createDir($path);
     }
     $this->output->writeln('<info>✓</info> Created <comment>' . $path . '</comment>');
 }
开发者ID:bramdevries,项目名称:glue,代码行数:21,代码来源:BootstrapCommand.php

示例13: downloadAndExtractPackageZipBall

 /**
  * Downloads the packages zipball from github and extracts it.
  *
  * @param  array $package The selected version of the package.
  * @return void
  */
 private function downloadAndExtractPackageZipBall($package)
 {
     // NOTE: We actually use this list to determin if there are any stale
     // packages that need to be deleted, so we generate the list here
     // before we decide if we need to actually download the package or not.
     if (!isset($this->downloaded[$package['name']])) {
         $this->downloaded[$package['name']] = [];
     }
     if (!Linq::from($this->downloaded[$package['name']])->contains($package['version_normalized'])) {
         $this->downloaded[$package['name']][] = $package['version_normalized'];
     }
     $packagePath = $this->vendorDir . '/' . $package['name'] . '/' . $package['version_normalized'];
     if ($this->filesystem->has($packagePath)) {
         $this->notify("ALREADY HAVE PACKAGE\n");
         return;
     }
     $url = $package['dist']['url'];
     $zipBall = $this->http->request('GET', $url)->getBody();
     $zipBallPath = $packagePath . '/dist.zip';
     $this->filesystem->put($zipBallPath, $zipBall);
     $this->zip->extract($zipBallPath, $packagePath);
     $this->filesystem->delete($zipBallPath);
     $this->notify("DONE\n");
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:30,代码来源:PackageDownloader.php

示例14: put

 /**
  * {@inheritdoc}
  */
 public function put($path, $contents)
 {
     return $this->filesystem->put($path, $contents);
 }
开发者ID:svycka,项目名称:sv-images,代码行数:7,代码来源:FlySystemAdapter.php

示例15: generate

 /** @inheritdoc */
 public function generate(array $installedPackages, array $renamedPackages)
 {
     $this->installedPackages = $installedPackages;
     $this->renamedPackages = $renamedPackages;
     $this->filesystem->put($this->vendorDir . '/autoload.php', $this->generateFile());
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:7,代码来源:AutoLoaderGenerator.php


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