public static function getProviders()
{
// Basic static cache
static $providers;
if ($providers !== null) {
return $providers;
}
$ds = DIRECTORY_SEPARATOR;
$providers = [];
$filesIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . $ds . 'Provider', FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
foreach ($filesIterator as $file) {
if ($file->isDir() || in_array($file->getBasename('.php'), self::$ignoredProvider) || $file->getExtension() !== 'php') {
continue;
}
$quotedDs = preg_quote($ds);
$provider = preg_replace("#^.+{$quotedDs}Provider{$quotedDs}(.+)\\.php\$#", '$1', $file->getPathName());
$class = new ReflectionClass(sprintf('Yasumi\\Provider\\%s', str_replace('/', '\\', $provider)));
$key = 'ID';
if ($class->hasConstant($key)) {
$providers[strtoupper($class->getConstant($key))] = $provider;
}
}
return (array) $providers;
}