本文整理汇总了PHP中Magento\Framework\App\Utility\Files::readLists方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::readLists方法的具体用法?PHP Files::readLists怎么用?PHP Files::readLists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Utility\Files
的用法示例。
在下文中一共展示了Files::readLists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupFileLists
/**
* Helper method to setup the black and white lists
*
* @param string $type
* @return void
*/
public static function setupFileLists($type = '')
{
if ($type != '' && !preg_match('/\\/$/', $type)) {
$type = $type . '/';
}
self::$whiteList = Files::readLists(__DIR__ . '/_files/' . $type . 'whitelist/*.txt');
self::$blackList = Files::readLists(__DIR__ . '/_files/' . $type . 'blacklist/*.txt');
}
示例2: testReadLists
/**
* @magentoComponentsDir Magento/Framework/App/Utility/_files/fixtures
*/
public function testReadLists()
{
$fixtureDir = str_replace('\\', '/', __DIR__) . '/_files/fixtures/';
$expected = [$fixtureDir . 'language/One.php', $fixtureDir . 'language/registration.php', $fixtureDir . 'library/One.php', $fixtureDir . 'module/One.php', $fixtureDir . 'module/registration.php', $fixtureDir . 'theme/One.php'];
$actual = $this->model->readLists(__DIR__ . '/_files/patterns/paths*.txt');
sort($actual);
foreach ($actual as &$file) {
$file = str_replace('\\', '/', $file);
}
$this->assertSame($expected, $actual);
}
示例3: getPhpFiles
/**
* Returns array of PHP-files, that use or declare Magento application classes and Magento libs
*
* @param string $changedFilesList
* @return array
*/
public static function getPhpFiles($changedFilesList)
{
$fileHelper = \Magento\Framework\App\Utility\Files::init();
if (isset($_ENV['INCREMENTAL_BUILD'])) {
$phpFiles = Files::readLists($changedFilesList);
if (!empty($phpFiles)) {
$phpFiles = \Magento\Framework\App\Utility\Files::composeDataSets($phpFiles);
$phpFiles = array_intersect_key($phpFiles, $fileHelper->getPhpFiles());
}
} else {
$phpFiles = $fileHelper->getPhpFiles();
}
return $phpFiles;
}
示例4: setUpBeforeClass
/**
* @static Setup report file, black list and white list
*
*/
public static function setUpBeforeClass()
{
$reportDir = Files::init()->getPathToSource() . '/dev/tests/static/report';
if (!is_dir($reportDir)) {
mkdir($reportDir, 0777);
}
self::$_reportFile = $reportDir . '/js_report.txt';
@unlink(self::$_reportFile);
$whiteList = Files::readLists(__DIR__ . '/_files/whitelist/*.txt');
$blackList = Files::readLists(__DIR__ . '/_files/blacklist/*.txt');
foreach ($blackList as $listFiles) {
self::$_blackListJsFiles = array_merge(self::$_blackListJsFiles, self::_scanJsFile($listFiles));
}
foreach ($whiteList as $listFiles) {
self::$_whiteListJsFiles = array_merge(self::$_whiteListJsFiles, self::_scanJsFile($listFiles));
}
$blackListJsFiles = self::$_blackListJsFiles;
$filter = function ($value) use($blackListJsFiles) {
return !in_array($value, $blackListJsFiles);
};
self::$_whiteListJsFiles = array_filter(self::$_whiteListJsFiles, $filter);
}
示例5: blacklistFilter
/**
* Filter blacklisted files out of an array
*
* @param array $preFilter
* @return array
*/
protected function blacklistFilter($preFilter)
{
$postFilter = [];
$blacklist = Files::readLists(__DIR__ . '/_files/ExtensibleInterfacesTest/blacklist*');
foreach ($preFilter as $file) {
if (!in_array($file, $blacklist)) {
$postFilter[] = $file;
}
}
return $postFilter;
}