Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@
"ext-pcre": "*",
"ext-spl": "*",

"simplesamlphp/assert": "~1.8.1",
"simplesamlphp/composer-xmlprovider-installer": "~1.0.2",
"symfony/finder": "~6.4.0"
"simplesamlphp/assert": "~1.8.2",
"simplesamlphp/composer-xmlprovider-installer": "~1.0.2"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "~1.9.2"
"simplesamlphp/simplesamlphp-test-framework": "~1.9.3"
},
"support": {
"issues": "https://github.com/simplesamlphp/xml-common/issues",
Expand Down
13 changes: 8 additions & 5 deletions src/XML/Registry/ElementRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

namespace SimpleSAML\XML\Registry;

use DirectoryIterator;
use SimpleSAML\XML\AbstractElement;
use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Exception\IOException;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use Symfony\Component\Finder\Finder;

use function array_merge_recursive;
use function dirname;
use function file_exists;
use function preg_match;

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

if (file_exists($classesDir) === true) {
$finder = Finder::create()->files()->name('element.registry.*.php')->in($classesDir);
if ($finder->hasResults()) {
foreach ($finder as $file) {
$this->importFromFile($file->getPathName());
$directory = new DirectoryIterator($classesDir);
foreach ($directory as $fileInfo) {
if ($fileInfo->isFile()) {
if (preg_match('/^element\.registry\.(.*)\.php$/', $fileInfo->getFilename())) {
$this->importFromFile($fileInfo->getPathname());
}
}
}
}
Expand Down