forked from phpbb/phpbb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ticket/16955] Use common code for path iterator generation
PHPBB3-16955
- Loading branch information
Showing
10 changed files
with
64 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
* | ||
*/ | ||
|
||
namespace phpbb; | ||
namespace phpbb\iterator; | ||
|
||
/** | ||
* Class recursive_dot_prefix_filter_iterator | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* | ||
* This file is part of the phpBB Forum Software package. | ||
* | ||
* @copyright (c) phpBB Limited <https://www.phpbb.com> | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
* For full copyright and license information, please see | ||
* the docs/CREDITS.txt file. | ||
* | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpbb\iterator; | ||
|
||
class recursive_path_iterator extends \RecursiveIteratorIterator | ||
{ | ||
/** | ||
* Constructor | ||
* | ||
* @param string $path Path to iterate over | ||
* @param int $mode Iterator mode | ||
* @param int $flags Flags | ||
*/ | ||
public function __construct(string $path, int $mode = self::LEAVES_ONLY, int $flags = \FilesystemIterator::SKIP_DOTS) | ||
{ | ||
parent::__construct( | ||
new recursive_dot_prefix_filter_iterator(new \RecursiveDirectoryIterator($path, $flags)), | ||
\RecursiveIteratorIterator::SELF_FIRST | ||
); | ||
} | ||
|
||
/** | ||
* Get inner iterator | ||
* | ||
* @return recursive_dot_prefix_filter_iterator | ||
*/ | ||
public function getInnerIterator(): \RecursiveIterator | ||
{ | ||
$inner_iterator = parent::getInnerIterator(); | ||
|
||
assert($inner_iterator instanceof recursive_dot_prefix_filter_iterator); | ||
return $inner_iterator; | ||
} | ||
} |