本文整理汇总了PHP中Magento\Framework\Filesystem\Directory\ReadInterface::isFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ReadInterface::isFile方法的具体用法?PHP ReadInterface::isFile怎么用?PHP ReadInterface::isFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Filesystem\Directory\ReadInterface
的用法示例。
在下文中一共展示了ReadInterface::isFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContents
/**
* Returns contents of License file.
*
* @return string
*/
public function getContents()
{
if (!$this->dir->isFile(self::LICENSE_FILENAME)) {
return false;
}
return $this->dir->readFile(self::LICENSE_FILENAME);
}
示例2: getContents
/**
* Returns contents of License file.
*
* @return string|boolean
*/
public function getContents()
{
if ($this->dir->isFile(self::LICENSE_FILENAME)) {
return $this->dir->readFile(self::LICENSE_FILENAME);
} elseif ($this->dir->isFile(self::DEFAULT_LICENSE_FILENAME)) {
return $this->dir->readFile(self::DEFAULT_LICENSE_FILENAME);
} else {
return false;
}
}
示例3: checkIsFile
/**
* If DB file storage is on - find there, otherwise - just file_exists
*
* @param string $filename relative file path
* @return bool
*/
protected function checkIsFile($filename)
{
if ($this->fileStorageDatabase->checkDbUsage() && !$this->mediaDirectory->isFile($filename)) {
$this->fileStorageDatabase->saveFileToFilesystem($filename);
}
return $this->mediaDirectory->isFile($filename);
}
示例4: _applyPhpVariables
/**
* Parses .htaccess file and apply php settings to shell script
*
* @return $this
*/
protected function _applyPhpVariables()
{
$htaccess = '.htaccess';
if ($this->rootDirectory->isFile($htaccess)) {
// parse htaccess file
$data = $this->rootDirectory->readFile($htaccess);
$matches = [];
preg_match_all('#^\\s+?php_value\\s+([a-z_]+)\\s+(.+)$#siUm', $data, $matches, PREG_SET_ORDER);
if ($matches) {
foreach ($matches as $match) {
@ini_set($match[1], str_replace("\r", '', $match[2]));
}
}
preg_match_all('#^\\s+?php_flag\\s+([a-z_]+)\\s+(.+)$#siUm', $data, $matches, PREG_SET_ORDER);
if ($matches) {
foreach ($matches as $match) {
@ini_set($match[1], str_replace("\r", '', $match[2]));
}
}
}
return $this;
}
示例5: 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;
}
示例6: _findFirstFileRelativePath
/**
* Find a relative path to a first file located in a directory or its descendants
*
* @param string $dir Directory to search for a file within
* @param string $pattern PCRE pattern a file name has to match
* @return string|null
*/
protected function _findFirstFileRelativePath($dir, $pattern = '/.*/')
{
$childDirs = array();
foreach ($this->_pubDirectory->read($dir) as $itemPath) {
if ($this->_pubDirectory->isFile($itemPath)) {
if (preg_match($pattern, $itemPath)) {
return $itemPath;
}
} else {
$childDirs[$itemPath] = $itemPath;
}
}
foreach ($childDirs as $dirName => $dirPath) {
$filePath = $this->_findFirstFileRelativePath($dirPath, $pattern);
if ($filePath) {
return $filePath;
}
}
return null;
}