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


PHP Read::readFile方法代码示例

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


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

示例1: minifyFile

 /**
  * Get path to minified file for specified original file
  *
  * @param string $originalFile path to original file relative to pub/view_cache
  * @param string $targetFile path relative to pub/view_cache
  * @return void
  */
 public function minifyFile($originalFile, $targetFile)
 {
     if ($this->_isUpdateNeeded($targetFile)) {
         $content = $this->rootDirectory->readFile($originalFile);
         $content = $this->adapter->minify($content);
         $this->pubViewCacheDir->writeFile($targetFile, $content);
     }
 }
开发者ID:Mohitsahu123,项目名称:mtf,代码行数:15,代码来源:Lite.php

示例2: testReadFile

 public function testReadFile()
 {
     $path = 'filepath';
     $flag = 'flag';
     $context = 'context';
     $contents = 'contents';
     $this->driver->expects($this->once())->method('getAbsolutePath')->with($this->path, $path)->will($this->returnValue($path));
     $this->driver->expects($this->once())->method('fileGetContents')->with($path, $flag, $context)->will($this->returnValue($contents));
     $this->assertEquals($contents, $this->read->readFile($path, $flag, $context));
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例3: testReadFileCustomProtocol

 public function testReadFileCustomProtocol()
 {
     $path = 'filepath';
     $flag = 'flag';
     $context = 'context';
     $protocol = 'ftp';
     $contents = 'contents';
     $fileMock = $this->getMock('Magento\\Framework\\Filesystem\\File\\Read', [], [], '', false);
     $fileMock->expects($this->once())->method('readAll')->with($flag, $context)->will($this->returnValue($contents));
     $this->driver->expects($this->once())->method('getAbsolutePath')->with($this->path, $path, $protocol)->will($this->returnValue($path));
     $this->driver->expects($this->never())->method('fileGetContents');
     $this->fileFactory->expects($this->once())->method('create')->with($path, $protocol, $this->driver)->will($this->returnValue($fileMock));
     $this->assertEquals($contents, $this->read->readFile($path, $flag, $context, $protocol));
 }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: loadLocalPackage

 /**
  * Load local package data array
  *
  * @param string $packageName without extension
  * @return array|boolean
  */
 public function loadLocalPackage($packageName)
 {
     $xmlFile = sprintf('connect/%.xml', $packageName);
     $serFile = sprintf('connect/%.ser', $packageName);
     if ($this->readDirectory->isFile($xmlFile) && $this->readDirectory->isReadable($xmlFile)) {
         $xml = simplexml_load_string($this->readDirectory->readFile($xmlFile));
         $data = $this->_xmlConverter->xmlToAssoc($xml);
         if (!empty($data)) {
             return $data;
         }
     }
     if ($this->readDirectory->isFile($serFile) && $this->readDirectory->isReadable($xmlFile)) {
         $data = unserialize($this->readDirectory->readFile($serFile));
         if (!empty($data)) {
             return $data;
         }
     }
     return false;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:25,代码来源:Data.php

示例5: getCountryParams

 /**
  * Get Country Params by Country Code
  *
  * @param string $countryCode
  * @return \Magento\Framework\Object
  *
  * @see $countryCode ISO 3166 Codes (Countries) A2
  */
 protected function getCountryParams($countryCode)
 {
     if (empty($this->_countryParams)) {
         $etcPath = $this->_configReader->getModuleDir('etc', 'Magento_Dhl');
         $countriesXmlPath = $this->modulesDirectory->getRelativePath($etcPath . '/countries.xml');
         $countriesXml = $this->modulesDirectory->readFile($countriesXmlPath);
         $this->_countryParams = $this->_xmlElFactory->create(array('data' => $countriesXml));
     }
     if (isset($this->_countryParams->{$countryCode})) {
         $countryParams = new \Magento\Framework\Object($this->_countryParams->{$countryCode}->asArray());
     }
     return isset($countryParams) ? $countryParams : new \Magento\Framework\Object();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:Carrier.php

示例6: _loadMap

 /**
  * Load aliases to classes map from file
  *
  * @param string $pathToMapFile
  * @return string
  */
 protected function _loadMap($pathToMapFile)
 {
     if ($this->_directory->isFile($pathToMapFile)) {
         return $this->_directory->readFile($pathToMapFile);
     }
     return '';
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Migration.php

示例7: _getConfigModel

 /**
  * Return configuration model for themes
  *
  * @param string $configPath
  * @return \Magento\Framework\Config\Theme
  */
 protected function _getConfigModel($configPath)
 {
     $relativeConfigPath = $this->_directory->getRelativePath($configPath);
     $configContent = $this->_directory->isExist($relativeConfigPath) ? $this->_directory->readFile($relativeConfigPath) : null;
     return $this->themeConfigFactory->create(['configContent' => $configContent]);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:12,代码来源:Collection.php

示例8: _getConfigModel

 /**
  * Return configuration model for themes
  *
  * @param string $configPath
  * @return \Magento\Framework\Config\Theme
  */
 protected function _getConfigModel($configPath)
 {
     return new \Magento\Framework\Config\Theme($this->_directory->readFile($this->_directory->getRelativePath($configPath)));
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:10,代码来源:Collection.php


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