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


PHP ReadInterface::isReadable方法代码示例

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


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

示例1: getWidgetConfigAsArray

 /**
  * Load widget XML config and merge with theme widget config
  *
  * @return array|null
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function getWidgetConfigAsArray()
 {
     if ($this->_widgetConfigXml === null) {
         $this->_widgetConfigXml = $this->_widgetModel->getWidgetByClassType($this->getType());
         if ($this->_widgetConfigXml) {
             $configFile = $this->_viewFileSystem->getFilename('widget.xml', ['area' => $this->getArea(), 'theme' => $this->getThemeId(), 'module' => $this->_namespaceResolver->determineOmittedNamespace(preg_replace('/^(.+?)\\/.+$/', '\\1', $this->getType()), true)]);
             $isReadable = $configFile && $this->_directory->isReadable($this->_directory->getRelativePath($configFile));
             if ($isReadable) {
                 $config = $this->_reader->readFile($configFile);
                 $widgetName = isset($this->_widgetConfigXml['name']) ? $this->_widgetConfigXml['name'] : null;
                 $themeWidgetConfig = null;
                 if ($widgetName !== null) {
                     foreach ($config as $widget) {
                         if (isset($widget['name']) && $widgetName === $widget['name']) {
                             $themeWidgetConfig = $widget;
                             break;
                         }
                     }
                 }
                 if ($themeWidgetConfig) {
                     $this->_widgetConfigXml = array_replace_recursive($this->_widgetConfigXml, $themeWidgetConfig);
                 }
             }
         }
     }
     return $this->_widgetConfigXml;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:33,代码来源:Instance.php

示例2: getPaths

 /**
  * Get the list of files and directory paths from magento-base extra/map section.
  *
  * @return string []
  * @throws \Magento\Setup\Exception
  */
 public function getPaths()
 {
     // Locate composer.json for magento2-base module
     $filesPathList = [];
     $vendorDir = (require VENDOR_PATH);
     $basePackageComposerFilePath = $vendorDir . '/' . self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE;
     if (!$this->reader->isExist($basePackageComposerFilePath)) {
         throw new \Magento\Setup\Exception('Could not locate ' . self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE . ' file.');
     }
     if (!$this->reader->isReadable($basePackageComposerFilePath)) {
         throw new \Magento\Setup\Exception('Could not read ' . self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE . ' file.');
     }
     // Fill array with list of files and directories from extra/map section
     $composerJsonFileData = json_decode($this->reader->readFile($basePackageComposerFilePath), true);
     if (!isset($composerJsonFileData[self::COMPOSER_KEY_EXTRA][self::COMPOSER_KEY_MAP])) {
         return $filesPathList;
     }
     $extraMappings = $composerJsonFileData[self::COMPOSER_KEY_EXTRA][self::COMPOSER_KEY_MAP];
     foreach ($extraMappings as $map) {
         $filesPathList[] = $map[1];
     }
     return $filesPathList;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:29,代码来源:BasePackageInfo.php

示例3: isImage

 /**
  * Simple check if file is image
  *
  * @param array|string $fileInfo - either file data from \Zend_File_Transfer or file path
  * @return boolean
  * @see \Magento\Catalog\Model\Product\Option\Type\File::_isImage
  */
 protected function isImage($fileInfo)
 {
     // Maybe array with file info came in
     if (is_array($fileInfo)) {
         return strstr($fileInfo['type'], 'image/');
     }
     // File path came in - check the physical file
     if (!$this->rootDirectory->isReadable($this->rootDirectory->getRelativePath($fileInfo))) {
         return false;
     }
     $imageInfo = getimagesize($fileInfo);
     if (!$imageInfo) {
         return false;
     }
     return true;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:23,代码来源:Validator.php

示例4: copyQuoteToOrder

 /**
  * Quote item to order item copy process
  *
  * @return $this
  */
 public function copyQuoteToOrder()
 {
     $quoteOption = $this->getConfigurationItemOption();
     try {
         $value = unserialize($quoteOption->getValue());
         if (!isset($value['quote_path'])) {
             throw new \Exception();
         }
         $quotePath = $value['quote_path'];
         $orderPath = $value['order_path'];
         if (!$this->_rootDirectory->isFile($quotePath) || !$this->_rootDirectory->isReadable($quotePath)) {
             throw new \Exception();
         }
         $this->_coreFileStorageDatabase->copyFile($this->_rootDirectory->getAbsolutePath($quotePath), $this->_rootDirectory->getAbsolutePath($orderPath));
     } catch (\Exception $e) {
         return $this;
     }
     return $this;
 }
开发者ID:nja78,项目名称:magento2,代码行数:24,代码来源:File.php

示例5: _getAvailableDataFiles

 /**
  * Retrieve available Data install/upgrade files for current module
  *
  * @param string $actionType
  * @param string $fromVersion
  * @param string $toVersion
  * @return array
  */
 protected function _getAvailableDataFiles($actionType, $fromVersion, $toVersion)
 {
     $modName = (string) $this->_moduleConfig['name'];
     $files = [];
     $filesDir = $this->_modulesReader->getModuleDir('data', $modName) . '/' . $this->_resourceName;
     $modulesDirPath = $this->modulesDir->getRelativePath($filesDir);
     if ($this->modulesDir->isDirectory($modulesDirPath) && $this->modulesDir->isReadable($modulesDirPath)) {
         $regExp = sprintf('#%s-(.*)\\.php$#i', $actionType);
         foreach ($this->modulesDir->read($modulesDirPath) as $file) {
             $matches = [];
             if (preg_match($regExp, $file, $matches)) {
                 $files[$matches[1]] = $this->modulesDir->getAbsolutePath($file);
             }
         }
     }
     if (empty($files)) {
         return [];
     }
     return $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $files);
 }
开发者ID:ViniciusAugusto,项目名称:magento2,代码行数:28,代码来源:DataSetup.php


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