Skip to content

Commit 37568fa

Browse files
committed
Replace symfony/finder with PHP-native implementation
1 parent 2a584aa commit 37568fa

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@
4242
"ext-pcre": "*",
4343
"ext-spl": "*",
4444

45-
"simplesamlphp/assert": "~1.8.1",
46-
"simplesamlphp/composer-xmlprovider-installer": "~1.0.2",
47-
"symfony/finder": "~6.4.0"
45+
"simplesamlphp/assert": "~1.8.2",
46+
"simplesamlphp/composer-xmlprovider-installer": "~1.0.2"
4847
},
4948
"require-dev": {
50-
"simplesamlphp/simplesamlphp-test-framework": "~1.9.2"
49+
"simplesamlphp/simplesamlphp-test-framework": "~1.9.3"
5150
},
5251
"support": {
5352
"issues": "https://github.com/simplesamlphp/xml-common/issues",

src/XML/Registry/ElementRegistry.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
namespace SimpleSAML\XML\Registry;
66

7+
use DirectoryIterator;
78
use SimpleSAML\XML\AbstractElement;
89
use SimpleSAML\XML\Assert\Assert;
910
use SimpleSAML\XML\Exception\IOException;
1011
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
11-
use Symfony\Component\Finder\Finder;
1212

1313
use function array_merge_recursive;
1414
use function dirname;
1515
use function file_exists;
16+
use function preg_match;
1617

1718
final class ElementRegistry
1819
{
@@ -29,10 +30,12 @@ private function __construct()
2930
$classesDir = dirname(__FILE__, 6) . '/vendor/simplesamlphp/composer-xmlprovider-installer/classes';
3031

3132
if (file_exists($classesDir) === true) {
32-
$finder = Finder::create()->files()->name('element.registry.*.php')->in($classesDir);
33-
if ($finder->hasResults()) {
34-
foreach ($finder as $file) {
35-
$this->importFromFile($file->getPathName());
33+
$directory = new DirectoryIterator($classesDir);
34+
foreach ($directory as $fileInfo) {
35+
if ($fileInfo->isFile()) {
36+
if (preg_match('/^element\.registry\.(.*)\.php$/', $fileInfo->getFilename())) {
37+
$this->importFromFile($fileInfo->getPathname());
38+
}
3639
}
3740
}
3841
}

0 commit comments

Comments
 (0)