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


PHP Filesystem::put方法代码示例

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


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

示例1: writePage

 /**
  * Start the site Scraping process.
  *
  * @param string                  $url
  * @param \GuzzleHttp\Psr7\Stream $body
  *
  * @return void
  */
 protected function writePage($url, $body)
 {
     $page = $this->getPage($url);
     $body = str_replace($this->localSite, $this->remo, "{$body}");
     $write = $this->fs->put($page, $body);
     return $write;
 }
开发者ID:jjpmann,项目名称:static-sites,代码行数:15,代码来源:Scraper.php

示例2: slash

 /**
  * {@inheritdoc}
  */
 public function slash()
 {
     $app_path = str_replace(config('path.root'), '', config()->path->app);
     $arg_name = studly_case(str_slug($this->input->getArgument('name'), '_'));
     $stub = file_get_contents(__DIR__ . '/stubs/makeRoute.stub');
     $stub = stubify($stub, ['routeName' => $arg_name, 'prefixRouteName' => strtolower($arg_name)]);
     $file_name = $arg_name . 'Routes.php';
     $module = $this->input->getArgument('module');
     $has_dir = is_dir(config()->path->app . $module);
     if ($has_dir === false) {
         $this->error('Module not found `' . $module . '`');
         return;
     }
     $module = $this->input->getArgument('module');
     if ($this->app->has($module) === false) {
         $this->error('Module not found `' . $module . '`');
         return;
     }
     $routes = $module . '/routes/';
     if ($this->app->has($routes) === false) {
         $this->error('Routes folder not found from your module: `' . $module . '`');
         return;
     }
     $stub = stubify($stub, ['namespace' => path_to_namespace($app_path . $routes), 'controllerNamespace' => path_to_namespace($app_path . $module . '/controllers/')]);
     $this->info('Crafting Route...');
     if ($this->app->has($file_name)) {
         $this->error('   Route already exists!');
         return;
     }
     $this->app->put($routes . $file_name, $stub);
     $this->info('   ' . $file_name . ' created!');
     $this->callDumpAutoload();
 }
开发者ID:ps-clarity,项目名称:console,代码行数:36,代码来源:RouteCommand.php

示例3: testDeleteMockResourceExistsSizes

 public function testDeleteMockResourceExistsSizes()
 {
     $resourceDO = $this->getResourceDOMock();
     $this->filesystem->put($resourceDO->getFilePath(), '');
     $resourceDOSize10x11 = $this->getResourceDOMock();
     $resourceDOSize10x11->setWidth(10);
     $resourceDOSize10x11->setHeight(11);
     $this->filesystem->put($resourceDOSize10x11->getFilePath(), '');
     $resourceDOSize20x21 = $this->getResourceDOMock();
     $resourceDOSize20x21->setWidth(20);
     $resourceDOSize20x21->setHeight(21);
     $this->filesystem->put($resourceDOSize20x21->getFilePath(), '');
     $yetAnotherWrongDO = clone $resourceDO;
     $yetAnotherWrongDO->setWidth(998);
     $yetAnotherWrongDO->setHeight(999);
     $this->wrongFiles->create($resourceDO, 'Wrong1');
     $this->wrongFiles->create($resourceDOSize10x11, 'Wrong2');
     $this->wrongFiles->create($resourceDOSize20x21, 'Wrong3');
     $this->wrongFiles->create($yetAnotherWrongDO, 'Wrong4');
     $modelFiles = $this->filesystem->listContents('/', true);
     // Make the expected model looks like filesystem after the command execution
     // With this model we will be sure that other files have not been deleted
     unset($modelFiles[56], $modelFiles[57]);
     $modelFiles[55] = ['type' => 'dir', 'path' => 'testBase/png/def/def/0/c9f/20x21', 'dirname' => 'testBase/png/def/def/0/c9f', 'basename' => '20x21', 'filename' => '20x21'];
     $command = $this->getCommand($resourceDO);
     $result = $command();
     $this->assertTrue($result);
     $this->assertFalse($this->filesystem->has($resourceDOSize10x11->getFilePath()));
     $this->assertFalse($this->filesystem->has($resourceDOSize20x21->getFilePath()));
     $result = $this->filesystem->listContents('/', true);
     $this->assertEquals($modelFiles, $result);
 }
开发者ID:kivagant,项目名称:staticus-core,代码行数:32,代码来源:DeleteImageSizesResourceCommandTest.php

示例4: write

 /**
  * {@inheritdoc}
  */
 public function write(Configuration $configuration)
 {
     $ini = $this->getRenderer()->render($configuration->toArray());
     if (false === ($result = $this->filesystem->put($this->file, $ini))) {
         throw new WriterException(sprintf('Cannot write configuration into file %s', $this->file));
     }
     return $result;
 }
开发者ID:supervisorphp,项目名称:configuration,代码行数:11,代码来源:IniFileWriter.php

示例5: storeVersion

 public function storeVersion(Versionable $versionable, Version $version, $tempFile)
 {
     $pathName = $this->getVersionPathName($versionable, $version);
     $ret = $this->filesystem->put($pathName, file_get_contents($tempFile), ['visibility' => AdapterInterface::VISIBILITY_PRIVATE]);
     if (!$ret) {
         throw new FileIOException(sprintf("Failed to store version '%s' of versionable %s;%s", $version->toString(), get_class($versionable), $versionable->getId()));
     }
     return new Retrieved($tempFile);
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:9,代码来源:FlysystemStorageAdapter.php

示例6: write

 public function write($id, $config, array $options = [])
 {
     $this->id = $id;
     $this->config = $config;
     $this->timestamp = time();
     if (!$this->filesystem->put($this->getPathFromId($id), $this->dump(['lunch_guy' => $config]))) {
         throw new \RuntimeException("Failed to write configuration {$id}");
     }
 }
开发者ID:tomaskadlec,项目名称:lunch_guy,代码行数:9,代码来源:FilesystemProvider.php

示例7: download

 /**
  * Downloads a request
  *
  * @param RequestInterface $request
  *
  * @return boolean
  */
 public function download(RequestInterface $request, $path)
 {
     $response = $this->httpAdapter->sendRequest($request);
     if (!($body = $response->getBody())) {
         return false;
     }
     $stream = $body->detach();
     if (is_resource($stream)) {
         return $this->filesystem->putStream($path, $stream);
     }
     return $this->filesystem->put($path, $stream);
 }
开发者ID:indigophp,项目名称:flysystem-http-downloader,代码行数:19,代码来源:Downloader.php

示例8: getData

 /**
  * Returns the historical price data as a csv string for $ticker
  * @param string $ticker
  * @param bool $fromCache
  * @param bool $saveToCache
  * @param bool $return
  * @return TickerCollection
  */
 public function getData($ticker, $fromCache = true, $saveToCache = true, $return = true)
 {
     if ($fromCache && $this->fileSystem->has($ticker)) {
         return $this->present($ticker, $this->fileSystem->read($ticker));
     }
     $data = (string) $this->guzzle->request('GET', '', ['query' => ['s' => $ticker, 'ignore' => '.csv']])->getBody();
     if ($saveToCache) {
         $this->fileSystem->put($ticker, $data);
     }
     if ($return) {
         return $this->present($ticker, $data);
     }
 }
开发者ID:parthpatel1001,项目名称:analyzer,代码行数:21,代码来源:YahooFinance.php

示例9: testFindVersion8

 public function testFindVersion8()
 {
     $resourceDO_v0 = $this->getResourceDOMock();
     $this->filesystem->put($resourceDO_v0->getFilePath(), '');
     // Put one more version on disk
     $expectedVersion = $resourceDO_v0->getVersion() + 7;
     $resourceDO_v1 = clone $resourceDO_v0;
     $resourceDO_v1->setVersion($expectedVersion);
     $this->filesystem->put($resourceDO_v1->getFilePath(), '');
     $command = $this->getCommand($resourceDO_v0);
     $result = $command();
     $this->assertEquals($expectedVersion, $result);
 }
开发者ID:kivagant,项目名称:staticus-core,代码行数:13,代码来源:FindResourceLastVersionCommandTest.php

示例10:

 function it_throws_an_exception_when_configuration_cannot_be_written(Flysystem $filesystem, Renderer $renderer, Configuration $configuration)
 {
     $renderer->render($configuration)->willReturn('contents');
     $filesystem->put('file', 'contents')->willReturn(false);
     $this->beConstructedWith($filesystem, 'file', $renderer);
     $this->shouldThrow('Indigo\\Supervisor\\Exception\\WrittingFailed')->duringWrite($configuration);
 }
开发者ID:indigophp,项目名称:supervisor-configuration,代码行数:7,代码来源:FilesystemSpec.php

示例11: testDestroyResourceAllVariantsAndVersions

 public function testDestroyResourceAllVariantsAndVersions()
 {
     $resourceDO = $this->getResourceDOMock();
     $this->filesystem->put($resourceDO->getFilePath(), '');
     $resourceDO_v2 = clone $resourceDO;
     $resourceDO_v2->setVersion(2);
     $this->filesystem->put($resourceDO_v2->getFilePath(), '');
     $resourceDO_var1 = clone $resourceDO;
     $resourceDO_var1->setVariant('1');
     $this->filesystem->put($resourceDO_var1->getFilePath(), '');
     // variant version must be deleted too
     $resourceDO_var1_v1 = clone $resourceDO_var1;
     $resourceDO_var1_v1->setVersion(1);
     $this->filesystem->put($resourceDO_var1_v1->getFilePath(), '');
     $resourceDO_var2 = clone $resourceDO;
     $resourceDO_var2->setVariant('2');
     $this->filesystem->put($resourceDO_var2->getFilePath(), '');
     $resourceDO_var2_v1 = clone $resourceDO_var2;
     $resourceDO_var2_v1->setVersion(2);
     $this->filesystem->put($resourceDO_var2_v1->getFilePath(), '');
     $command = $this->getCommand($resourceDO);
     $result = $command();
     $this->assertEquals($resourceDO, $result);
     $this->assertFalse($this->filesystem->has($resourceDO_var1->getFilePath()));
     $this->assertFalse($this->filesystem->has($resourceDO_var1_v1->getFilePath()));
     $this->assertFalse($this->filesystem->has($resourceDO_v2->getFilePath()));
     $this->assertFalse($this->filesystem->has($resourceDO_var2->getFilePath()));
     $this->assertFalse($this->filesystem->has($resourceDO_var2_v1->getFilePath()));
     $this->assertFalse($this->filesystem->has($resourceDO->getFilePath()));
 }
开发者ID:kivagant,项目名称:staticus-core,代码行数:30,代码来源:DestroyResourceCommandTest.php

示例12: testPutUpdate

 public function testPutUpdate()
 {
     $path = 'path.txt';
     $contents = 'contents';
     $this->prophecy->has($path)->willReturn(true);
     $this->prophecy->update($path, $contents, $this->config)->willReturn(compact('path', 'contents'));
     $this->assertTrue($this->filesystem->put($path, $contents));
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:8,代码来源:FilesystemTests.php

示例13: put

 /**
  * @inheritdoc
  */
 public function put($path, $contents, array $config = [])
 {
     if (parent::put($path, $contents, $config)) {
         return $this->getAdapter()->getModel();
     } else {
         return false;
     }
 }
开发者ID:garrinar,项目名称:laravel,代码行数:11,代码来源:Filesystem.php

示例14: testBackupResourceWhenAnotherCopyAlreadyExist

 public function testBackupResourceWhenAnotherCopyAlreadyExist()
 {
     $resourceDO_v0 = $this->getResourceDOMock();
     $this->filesystem->put($resourceDO_v0->getFilePath(), '');
     // Put one more version on disk
     $resourceDO_v1 = clone $resourceDO_v0;
     $resourceDO_v1->setVersion($resourceDO_v0->getVersion() + 1);
     $this->filesystem->put($resourceDO_v1->getFilePath(), '');
     $expectedVersion = (string) ($resourceDO_v0->getVersion() + 2);
     $command = $this->getCommand($resourceDO_v0);
     $result = $command();
     $this->assertInstanceOf(ResourceDOInterface::class, $result);
     $this->assertEquals($expectedVersion, $result->getVersion());
     $resourceDO_v2 = clone $resourceDO_v0;
     $resourceDO_v2->setVersion($expectedVersion);
     $this->assertTrue($this->filesystem->has($resourceDO_v2->getFilePath(), ''));
 }
开发者ID:kivagant,项目名称:staticus-core,代码行数:17,代码来源:BackupResourceCommandTest.php

示例15: createFile

 /**
  * Creates/uploads/updates a file on oc remote
  *
  * @param string $localPath  File on local server
  * @param string $remotePath File on oc Server
  * @throws FileNotFoundException
  * @return bool
  *
  */
 public function createFile($localPath, $remotePath = '')
 {
     //if local file not exists throw exception
     if (!file_exists($localPath)) {
         throw new FileNotFoundException("OwncloudApi: Local file not found");
     }
     //otherwise upload to server
     return $this->fs->put($remotePath, file_get_contents($localPath));
 }
开发者ID:Syren7,项目名称:owncloudApiBundle,代码行数:18,代码来源:OwncloudFilesystem.php


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