Skip to content

Commit 8a59bb9

Browse files
author
Igor Melnikov
committed
MAGETWO-67871: Requesting autogenerated classes that are not in constructor cause fatal errors in production mode
- add RegexIteratorFactory
1 parent ab7f811 commit 8a59bb9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\App\Utility;
7+
8+
/**
9+
* Factory for \RegexIterator
10+
*/
11+
class RegexIteratorFactory
12+
{
13+
/**
14+
* Create instance of \RegexIterator
15+
*
16+
* @param string $directoryPath
17+
* @param string $regexp
18+
* @return \RegexIterator
19+
*/
20+
public function create($directoryPath, $regexp)
21+
{
22+
$directory = new \RecursiveDirectoryIterator($directoryPath);
23+
$recursiveIterator = new \RecursiveIteratorIterator($directory);
24+
return new \RegexIterator($recursiveIterator, $regexp, \RegexIterator::GET_MATCH);
25+
}
26+
}

0 commit comments

Comments
 (0)