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


PHP Filesystem::has方法代码示例

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


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

示例1: remove

 /**
  * Remove file or a directory
  *
  * @param $path
  * @return void
  */
 public function remove($path)
 {
     if (!$this->filesystem->has($path)) {
         return;
     }
     $meta = $this->filesystem->getMetadata($path);
     if ($meta['type'] === 'file') {
         $this->filesystem->delete($path);
     } else {
         $this->filesystem->deleteDir($path);
     }
 }
开发者ID:karion,项目名称:mydrinks,代码行数:18,代码来源:FlySystemAdapter.php

示例2: ArrayCollection

 function it_returns_flat_data_with_media($channelManager, Filesystem $filesystem, ChannelInterface $channel, LocaleInterface $locale, ProductInterface $product, FileInfoInterface $media1, FileInfoInterface $media2, ProductValueInterface $value1, ProductValueInterface $value2, AttributeInterface $attribute, ProductValueInterface $identifierValue, AttributeInterface $identifierAttribute, $serializer, $productBuilder)
 {
     $localeCodes = ['en_US'];
     $channel->getLocales()->willReturn(new ArrayCollection([$locale]));
     $channel->getLocaleCodes()->willReturn($localeCodes);
     $productBuilder->addMissingProductValues($product, [$channel], [$locale])->shouldBeCalled();
     $media1->getKey()->willReturn('key/to/media1.jpg');
     $media2->getKey()->willReturn('key/to/media2.jpg');
     $value1->getAttribute()->willReturn($attribute);
     $value1->getMedia()->willReturn($media1);
     $value2->getAttribute()->willReturn($attribute);
     $value2->getMedia()->willReturn($media2);
     $attribute->getAttributeType()->willReturn('pim_catalog_image');
     $product->getValues()->willReturn([$value1, $value2, $identifierValue]);
     $identifierValue->getAttribute()->willReturn($identifierAttribute);
     $identifierAttribute->getAttributeType()->willReturn('pim_catalog_identifier');
     $product->getIdentifier()->willReturn($identifierValue);
     $identifierValue->getData()->willReturn('data');
     $filesystem->has('key/to/media1.jpg')->willReturn(true);
     $filesystem->has('key/to/media2.jpg')->willReturn(true);
     $serializer->normalize($media1, 'flat', ['field_name' => 'media', 'prepare_copy' => true, 'value' => $value1])->willReturn(['normalized_media1']);
     $serializer->normalize($media2, 'flat', ['field_name' => 'media', 'prepare_copy' => true, 'value' => $value2])->willReturn(['normalized_media2']);
     $serializer->normalize($product, 'flat', ['scopeCode' => 'foobar', 'localeCodes' => $localeCodes, 'decimal_separator' => '.', 'date_format' => 'yyyy-MM-dd'])->willReturn(['normalized_product']);
     $channelManager->getChannelByCode('foobar')->willReturn($channel);
     $this->setChannel('foobar');
     $this->process($product)->shouldReturn(['media' => [['normalized_media1'], ['normalized_media2']], 'product' => ['normalized_product']]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:27,代码来源:ProductToFlatArrayProcessorSpec.php

示例3: 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

示例4: remove

 /**
  * {@inheritdoc}
  */
 public function remove(File $file) : bool
 {
     $key = $file->getKey();
     if ($this->filesystem->has($key)) {
         return $this->filesystem->delete($key);
     }
     return true;
 }
开发者ID:reskume,项目名称:file-bundle,代码行数:11,代码来源:FlysystemAdapter.php

示例5: write

 protected function write($data)
 {
     $destination = $this->composer->getClassPath($this->data['name']);
     if ($this->force && $this->external->has($destination)) {
         $this->external->delete($destination);
     }
     return $this->external->write($destination, $data);
 }
开发者ID:clarkeash,项目名称:machine,代码行数:8,代码来源:BaseGenerator.php

示例6: exists

 /**
  * Check if key exists.
  *
  * @param  string $key
  *
  * @return bool
  */
 public function exists($key)
 {
     if (!is_string($key)) {
         return false;
     }
     $file = $this->get_file_name($key);
     return $this->filesystem->has($file);
 }
开发者ID:isotopsweden,项目名称:wp-cachetop,代码行数:15,代码来源:class-filesystem.php

示例7: delete

 /**
  * @param string $providerPrefix
  * @param string $uri
  * @param string $query
  *
  * @return bool
  */
 public function delete($providerPrefix, $uri, $query)
 {
     $hash = $this->getHash($providerPrefix, $uri, $query);
     if ($this->filesystem->has($hash)) {
         return $this->filesystem->delete($hash);
     }
     return false;
 }
开发者ID:paul-schulleri,项目名称:adform-client,代码行数:15,代码来源:FileCache.php

示例8: parse

 /**
  * {@inheritdoc}
  */
 public function parse(Configuration $configuration = null)
 {
     if (!$this->filesystem->has($this->file)) {
         throw new ParsingFailed(sprintf('File "%s" not found', $this->file));
     }
     $fileContents = $this->filesystem->read($this->file);
     $parser = new Text($fileContents);
     return $parser->parse($configuration);
 }
开发者ID:indigophp,项目名称:supervisor-configuration,代码行数:12,代码来源:Filesystem.php

示例9: testAddsNamespaceToSubClass

 public function testAddsNamespaceToSubClass()
 {
     $generator = $this->getGenerator();
     $generator->generateForEndpoint("Users/Followers");
     static::$content = $generator->getGeneratedTemplate();
     $check = $this->filesystem->has('Users/Followers.php');
     $this->assertTrue($check);
     $this->assertContains("Wubs\\Trakt\\Api\\Users", static::$content);
 }
开发者ID:kduma-archive,项目名称:trakt-api-wrapper,代码行数:9,代码来源:NestedRequestsGeneratorTest.php

示例10: unpublish

 /**
  * @param File $file
  * @param Version $version
  * @param VersionProvider $versionProvider
  * @param Linker $linker
  * @return bool
  */
 public function unpublish(File $file, Version $version, VersionProvider $versionProvider, Linker $linker)
 {
     $path = $linker->getLink($file, $version, $versionProvider->getExtension($file, $version));
     if (!$this->filesystem->has($path)) {
         return false;
     }
     $this->filesystem->delete($path);
     return true;
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:16,代码来源:FlysystemPublisherAdapter.php

示例11: loadFile

 /**
  * @return false|string
  */
 private function loadFile()
 {
     if (!$this->filesystem->has($this->getFile())) {
         $this->filesystem->write($this->getFile(), '');
     }
     if (!$this->sites) {
         $this->sites = $this->filesystem->read($this->file);
     }
     return $this->sites;
 }
开发者ID:bramdevries,项目名称:forge-cli,代码行数:13,代码来源:FileLoader.php

示例12: publishesAndUnpublishes

 /**
  * @test
  */
 public function publishesAndUnpublishes()
 {
     $this->assertFalse($this->filesystem->has($this->path));
     $this->assertTrue($this->adapter->publish($this->file, Version::get('xooxer'), $this->vp, $this->linker));
     $this->assertTrue($this->filesystem->has($this->path));
     $this->assertFalse($this->adapter->publish($this->file, Version::get('xooxer'), $this->vp, $this->linker));
     $this->assertTrue($this->adapter->unpublish($this->file, Version::get('xooxer'), $this->vp, $this->linker));
     $this->assertFalse($this->filesystem->has($this->path));
     $this->assertFalse($this->adapter->unpublish($this->file, Version::get('xooxer'), $this->vp, $this->linker));
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:13,代码来源:FlysystemPublisherAdapterTest.php

示例13: fetch

 /**
  * @inheritdoc
  */
 public function fetch($key)
 {
     if ($this->filesystem->has($key)) {
         // The file exist, read it!
         $data = @unserialize($this->filesystem->read($key));
         if ($data instanceof CacheEntry) {
             return $data;
         }
     }
     return;
 }
开发者ID:thedeedawg,项目名称:guzzle-cache-middleware,代码行数:14,代码来源:FlysystemStorage.php

示例14: getFileOrFail

 /**
  * Checks if the underlying flysystem contains a file of the given name.
  *
  * @param string $name
  *
  * @return \League\Flysystem\File|\League\Flysystem\Handler
  * @throws Twig_Error_Loader
  */
 protected function getFileOrFail($name)
 {
     if (!$this->filesystem->has($this->resolveTemplateName($name))) {
         throw new Twig_Error_Loader('Template could not be found on the given filesystem');
     }
     $fileObject = $this->filesystem->get($this->resolveTemplateName($name));
     if ($fileObject->isDir()) {
         throw new Twig_Error_Loader('Cannot use directory as template');
     }
     return $fileObject;
 }
开发者ID:cedricziel,项目名称:twig-loader-flysystem,代码行数:19,代码来源:FlysystemLoader.php

示例15: 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


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