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


PHP FilesystemInterface::read方法代码示例

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


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

示例1: find

 /**
  * {@inheritdoc}
  */
 public function find($path)
 {
     if ($this->filesystem->has($path) === false) {
         throw new NotLoadableException(sprintf('Source image "%s" not found.', $path));
     }
     $mimeType = $this->filesystem->getMimetype($path);
     return new Binary($this->filesystem->read($path), $mimeType, $this->extensionGuesser->guess($mimeType));
 }
开发者ID:graundas,项目名称:LiipImagineBundle,代码行数:11,代码来源:FlysystemLoader.php

示例2: getContents

 public function getContents($spiBinaryFileId)
 {
     try {
         return $this->filesystem->read($spiBinaryFileId);
     } catch (FlysystemNotFoundException $e) {
         throw new BinaryFileNotFoundException($spiBinaryFileId, $e);
     }
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:8,代码来源:Flysystem.php

示例3: fromFile

 /**
  * {@inheritdoc}
  */
 public function fromFile($file) : Workout
 {
     $content = $this->filesystem->read($file);
     if ($content === false) {
         throw new UnreadableFileException();
     }
     return $this->fromString($content);
 }
开发者ID:dragosprotung,项目名称:stc-core,代码行数:11,代码来源:AbstractLoader.php

示例4: read

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

示例5: get

 /**
  * Get the contents of a file.
  *
  * @param  string  $path
  * @return string
  *
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function get($path)
 {
     try {
         return $this->driver->read($path);
     } catch (FileNotFoundException $e) {
         throw new ContractFileNotFoundException($path, $e->getCode(), $e);
     }
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:16,代码来源:FilesystemAdapter.php

示例6: get

 /**
  * Get an item from the storage.
  *
  * @param string $key
  *
  * @return string|null
  */
 public function get($key)
 {
     try {
         if ($data = $this->flysystem->read($key)) {
             return $data;
         }
     } catch (FileNotFoundException $e) {
         //
     }
 }
开发者ID:AltThree,项目名称:Storage,代码行数:17,代码来源:FlysystemStore.php

示例7: data

 /**
  * @param ServerRequestInterface $request
  *
  * @return mixed|null
  */
 public function data(ServerRequestInterface $request)
 {
     $url = $request->getUri()->getPath();
     $parameters = array_merge($request->getQueryParams(), $request->getParsedBody());
     $file = $this->file($url, $parameters);
     if (!$this->filesystem->has($file)) {
         $file = $this->defaultFile($url);
     }
     if (!$this->filesystem->has($file)) {
         return null;
     }
     return $this->filesystem->read($file);
 }
开发者ID:satahippy,项目名称:fake-api-server,代码行数:18,代码来源:PathDataProvider.php

示例8: load

 /**
  * {@inheritDoc}
  */
 public function load($path)
 {
     try {
         $contents = $this->filesystem->read($path);
     } catch (FileNotFoundException $e) {
         throw new Exception\ImageNotFoundException(sprintf('Source image not found in "%s"', $path));
     }
     $mimeType = $this->filesystem->getMimeType($path);
     if ($mimeType === false) {
         // Mime Type could not be detected
         return $contents;
     }
     return new Binary($contents, $mimeType);
 }
开发者ID:shitikovkirill,项目名称:zend-shop.com,代码行数:17,代码来源:FlysystemLoader.php

示例9: makeImage

 /**
  * Generate manipulated image.
  * @param  string                $path   Image path.
  * @param  array                 $params Image manipulation params.
  * @return string                Cache path.
  * @throws FileNotFoundException
  * @throws FilesystemException
  */
 public function makeImage($path, array $params)
 {
     $sourcePath = $this->getSourcePath($path);
     $cachedPath = $this->getCachePath($path, $params);
     if ($this->cacheFileExists($path, $params) === true) {
         return $cachedPath;
     }
     if ($this->sourceFileExists($path) === false) {
         throw new FileNotFoundException('Could not find the image `' . $sourcePath . '`.');
     }
     $source = $this->source->read($sourcePath);
     if ($source === false) {
         throw new FilesystemException('Could not read the image `' . $sourcePath . '`.');
     }
     // We need to write the image to the local disk before
     // doing any manipulations. This is because EXIF data
     // can only be read from an actual file.
     $tmp = tempnam(sys_get_temp_dir(), 'Glide');
     if (file_put_contents($tmp, $source) === false) {
         throw new FilesystemException('Unable to write temp file for `' . $sourcePath . '`.');
     }
     try {
         $write = $this->cache->write($cachedPath, $this->api->run($tmp, $this->getAllParams($params)));
         if ($write === false) {
             throw new FilesystemException('Could not write the image `' . $cachedPath . '`.');
         }
     } catch (FileExistsException $exception) {
         // This edge case occurs when the target already exists
         // because it's currently be written to disk in another
         // request. It's best to just fail silently.
     }
     unlink($tmp);
     return $cachedPath;
 }
开发者ID:mambax7,项目名称:glide,代码行数:42,代码来源:Server.php

示例10: read

 /**
  * Read session data
  * @link http://php.net/manual/en/sessionhandlerinterface.read.php
  * @param string $session_id The session id to read data for.
  * @return string <p>
  * Returns an encoded string of the read data.
  * If nothing was read, it must return an empty string.
  * Note this value is returned internally to PHP for processing.
  * </p>
  * @since 5.4.0
  */
 public function read($session_id)
 {
     if ($this->driver->has($path = $this->path . $session_id)) {
         return $this->driver->read($path);
     }
     return '';
 }
开发者ID:AnonymPHP,项目名称:Anonym-Session,代码行数:18,代码来源:FileSessionHandler.php

示例11: read

 /**
  * Read a file.
  *
  * @param string $path
  * @return string
  * @throws IoReadException
  */
 public function read($path)
 {
     if (($ret = $this->fs->read($path)) === false) {
         throw new IoReadException("File {$path} could not be read.");
     }
     return $ret;
 }
开发者ID:khelle,项目名称:surume,代码行数:14,代码来源:Filesystem.php

示例12: read

 /**
  * Reads settings content of a namespace
  *
  * @param  string $namespace
  * @return array
  */
 protected function read($namespace)
 {
     $file = $this->adapter->getFileName($namespace);
     if (!$this->fileSystem->has($file)) {
         return [];
     }
     return $this->adapter->onRead($this->fileSystem->read($file));
 }
开发者ID:Ellipizle,项目名称:HtSettingsModule,代码行数:14,代码来源:FileSystemMapper.php

示例13: read

 /**
  * Read stub file
  *
  * @param string $content
  * @param array $arguments
  * @return mixed
  */
 protected function read($stub_path)
 {
     $content = $this->stubbox->read($stub_path);
     if ($content === false) {
         throw new InvalidArgumentException("File '{$stub_path}' is not found.");
     }
     return $content;
 }
开发者ID:jumilla,项目名称:php-source-generator,代码行数:15,代码来源:FileGenerator.php

示例14: __construct

 /**
  * @param ReflectionClass $reflection
  * @param FilesystemInterface $filesystem
  * @param null $name
  */
 public function __construct(ReflectionClass $reflection, FilesystemInterface $filesystem, $name = null)
 {
     $this->reflection = $reflection;
     $this->template = $filesystem->read("/Console/stubs/method.stub");
     $this->name = $name;
     $this->classParameters = $this->getClassParameters();
     $this->uses = $this->getUsages();
     $this->methodParameterNames = $this->getMethodParameters();
     $this->requestParameters = $this->getRequestParameters();
 }
开发者ID:ValentinGot,项目名称:trakt-api-wrapper,代码行数:15,代码来源:Method.php

示例15: getTypes

 /**
  * Extracts user defined PHP Type's from a source php file.
  *
  * @param  string $package
  * @param  string $version
  * @param  string $file
  * @return array
  */
 private function getTypes($package, $version, $file)
 {
     $fullPath = $this->vendorDir . '/' . $package . '/' . $version . '/' . $file;
     $src = $this->filesystem->read($fullPath);
     $ast = $this->parser->parse($src);
     $this->traverser->addVisitor($this->typeExtracator);
     $this->traverser->traverse($ast);
     $this->traverser->removeVisitor($this->typeExtracator);
     return $this->typeExtracator->getTypes();
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:18,代码来源:ConflictDiscoverer.php


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