本文整理汇总了PHP中Magento\Framework\Filesystem\Directory\Read::isExist方法的典型用法代码示例。如果您正苦于以下问题:PHP Read::isExist方法的具体用法?PHP Read::isExist怎么用?PHP Read::isExist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Filesystem\Directory\Read
的用法示例。
在下文中一共展示了Read::isExist方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _findOriginalMinifiedFile
/**
* Search for minified file provided along with the original file in the code base
*
* @param string $originalFile
* @return bool|string
*/
protected function _findOriginalMinifiedFile($originalFile)
{
$fileInfo = pathinfo($originalFile);
$minifiedFile = $fileInfo['dirname'] . '/' . $fileInfo['filename'] . '.min.' . $fileInfo['extension'];
if ($this->rootDirectory->isExist($minifiedFile)) {
return $minifiedFile;
}
return false;
}
示例2: _getFileData
/**
* Retrieve data from file
*
* @param string $file
* @return array
*/
protected function _getFileData($file)
{
$data = [];
if ($this->directory->isExist($this->directory->getRelativePath($file))) {
$this->_csvParser->setDelimiter(',');
$data = $this->_csvParser->getDataPairs($file);
}
return $data;
}
示例3: getConfigurationFiles
/**
* Go through all modules and find configuration files of active modules
*
* @param string $filename
* @return FileIterator
*/
public function getConfigurationFiles($filename)
{
$result = array();
foreach (array_keys($this->modulesList->getModules()) as $moduleName) {
$file = $this->getModuleDir('etc', $moduleName) . '/' . $filename;
$path = $this->modulesDirectory->getRelativePath($file);
if ($this->modulesDirectory->isExist($path)) {
$result[] = $path;
}
}
return $this->fileIteratorFactory->create($this->modulesDirectory, $result);
}
示例4: getComposerJsonFiles
/**
* Go through all modules and find composer.json files of active modules
*
* @return FileIterator
*/
public function getComposerJsonFiles()
{
$result = [];
foreach ($this->modulesList->getNames() as $moduleName) {
$file = $this->getModuleDir('', $moduleName) . '/composer.json';
$path = $this->modulesDirectory->getRelativePath($file);
if ($this->modulesDirectory->isExist($path)) {
$result[] = $path;
}
}
return $this->fileIteratorFactory->create($this->modulesDirectory, $result);
}
示例5: _preparePathData
/**
* Return default path related data
*
* @param string $configPath
* @return array
*/
protected function _preparePathData($configPath)
{
$themeDirectory = dirname($configPath);
if ($this->_directory->isExist($themeDirectory)) {
$fullPath = $this->_directory->getRelativePath($themeDirectory);
$pathPieces = explode('/', $fullPath);
$area = array_shift($pathPieces);
return ['area' => $area, 'theme_path_pieces' => $pathPieces];
} else {
$fullPath = $this->rootDirectory->getRelativePath($themeDirectory);
return $this->themeDirs->getAreaConfiguration($fullPath);
}
}
示例6: _handleInstall
/**
* Install application
*
* @param \Magento\Install\Model\Installer\Console $installer
* @return void
*/
protected function _handleInstall(\Magento\Install\Model\Installer\Console $installer)
{
if (isset($this->_arguments['config']) && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($this->_arguments['config']))) {
$config = (array) (include $this->_arguments['config']);
$this->_arguments = array_merge((array) $config, $this->_arguments);
}
$result = $installer->install($this->_arguments);
if (!$installer->hasErrors()) {
$msg = 'Installed successfully' . ($result ? ' (encryption key "' . $result . '")' : '');
$this->_output->success($msg . PHP_EOL);
} else {
$this->_output->error(implode(PHP_EOL, $installer->getErrors()) . PHP_EOL);
}
}
示例7: testIsExist
public function testIsExist()
{
$this->driver->expects($this->once())->method('isExists')->will($this->returnValue(true));
$this->assertTrue($this->read->isExist('correct-path'));
}
示例8: testAfterSaveFileExists
/**
* Check robots.txt file changed when robots.txt exists
*
* @magentoDataFixture Magento/Config/Model/_files/robots_txt.php
* @magentoDbIsolation enabled
*/
public function testAfterSaveFileExists()
{
$this->assertTrue($this->rootDirectory->isExist('robots.txt'), 'robots.txt not exists');
$this->_modifyConfig();
}
示例9: _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]);
}