Yield namespace/directories pairs from the psr4 autoload file.

@return \Generator
765544
private function map(): \Generator
    {
        $path = realpath($this->path) . '/composer/autoload_psr4.php';

        if (file_exists($path) && is_array($map = require $path)) {
            yield from $map;
        }
    }
192372
public function yieldify()
    {
        foreach ($this->storage as $key => $value) {
            yield (object) [
                'value' => $value,
                'key' => $key,
                'done' => false
            ];
        }

        yield (object) [
            'value' => null,
            'key' => null,
            'done' => true
        ];
    }
1021425
public static function extractNamespaces(ClassLoader $classLoader) {
    $namespaces = [];
    foreach ($classLoader->getPrefixes() as $namespace => $directories) {
      $namespaces[$namespace] = $directories[0];
    }
    foreach ($classLoader->getPrefixesPsr4() as $namespace => $directories) {
      $namespaces[$namespace] = $directories[0];
    }
    return new \ArrayIterator($namespaces);
  }
571900
public function getClassFiles()
    {
        foreach ($this->getFlattenedAutoloadConfiguration() as $configuration) {
            $normalizedAutoloadPath = $this->normalizeAutoloadPath($configuration['mappingType'], $configuration['namespace'], $configuration['classPath']);
            if (!is_dir($normalizedAutoloadPath)) {
                continue;
            }
            foreach ($this->getClassesInNormalizedAutoloadPath($normalizedAutoloadPath, $configuration['namespace']) as $className => $classPath) {
                yield $className => $classPath;
            }
        }
    }
155482
public static function getAutoloadNamespaces2() {
		// FIXME: adapt this to PSR-4!
		$composer = json_decode(file_get_contents(__DIR__."/../../../../../composer.json"), true);
		
		$psr = isset($composer["autoload"]["psr-0"]) ? "0" : (isset($composer["autoload"]["psr-4"]) ? "4" : null);
		if ($psr !== null) {
			$autoload = $composer["autoload"]["psr-$psr"];
		}
		else {
			return null;
		}
		
		if (self::isAssoc($autoload)) {
			$ret = self::unfactorizeAutoload(array($autoload));
		} else {
			$ret = self::unfactorizeAutoload($autoload);
		}
		
		$ret['psr'] = $psr;
		
		return $ret;
	}
285366
public function getIndexes(): \Generator
    {
        $definitions = $this->reflection->getProperty('indexes') ?? [];

        foreach ($definitions as $definition) {
            yield $this->castIndex($definition);
        }
    }
785841
public function createLoader(array $autoloads)
    {
        $loader = new ClassLoader();

        if (isset($autoloads['psr-0'])) {
            foreach ($autoloads['psr-0'] as $namespace => $path) {
                $loader->add($namespace, $path);
            }
        }

        if (isset($autoloads['psr-4'])) {
            foreach ($autoloads['psr-4'] as $namespace => $path) {
                $loader->addPsr4($namespace, $path);
            }
        }

        return $loader;
    }
511361
public function getChildNodesAndTokens() : \Generator {
        foreach ($this::CHILD_NAMES as $name) {
            $val = $this->$name;

            if (\is_array($val)) {
                foreach ($val as $child) {
                    if ($child !== null) {
                        yield $name => $child;
                    }
                }
                continue;
            }
            if ($val !== null) {
                yield $name => $val;
            }
        }
    }
1222001
private function scanRoot(NamespaceInterface $root): Generator
    {
        foreach ($root->iterateNamespaces() as $namespace) {

            // If you find a project readme, this is a project. Scan it for packages and sub-packages.
            $readMes = new \Symfony\Component\Finder\Finder();
            $readMes->files()
                    ->in($namespace->getPaths())
                    ->depth(0)
                    ->name('project.md');

            if ($readMes->count()) {
                yield from $this->scanNamespaceForPackages($namespace);
                return;
            }

            // Otherwise, this must be a library. Scan it as a package itself.
            yield from $this->loadPackage($namespace);
        }
    }
467295
public function generateMainConfig()
    {
        $requirejs = $this->collectConfigs();
        $config = $requirejs['config'];
        if (!empty($config['paths']) && is_array($config['paths'])) {
            foreach ($config['paths'] as &$path) {
                if (is_array($path)) {
                    $path = $this->generator->generate(
                        $path['route'],
                        array_key_exists('params', $path) ? $path['params'] : [],
                        UrlGeneratorInterface::ABSOLUTE_URL
                    );
                }
                if (substr($path, -3) === '.js') {
                    $path = substr($path, 0, -3);
                }
            }
        }
        $config['baseUrl'] = '/';
        return $config;
    }
454094
private function yieldAllConfig()
    {
        $this->allConfig = $this->allConfig ?: $this->getAllConfigNames();
        foreach ($this->allConfig as $name) {
            yield $name;
        }
    }
1337759
public function generate()
    {
        $generator = $this->generator;
        $data = $this->data;

        $fgm = new FileGeneratorManager();
        $fm = new FileManager();
        $tm = new TemplateManager();
        $dbm = new DataBuilderManager();

        $result = $dbm->build($generator->data_builder, $data);

        if (!$result->ok()) {
            return $result;
        }

        // Overwrite filename if driver is local
        $diskName = Config::get('medialibrary.disk_name');

        if (Config::get("filesystems.disks.$diskName.driver", 'local') === 'local') {
            $generator->filename = bin2hex(random_bytes(32)).'-'.$generator->filename;
        }

        $data = $result->getResource();
        $result = $fgm->render($generator->data_builder, $generator->filetype, [
            'body'     => $generator->body,
            'filename' => sys_get_temp_dir().'/'.$generator->filename,
        ], $data);

        $bag = new Bag($result->getResource());

        file_put_contents($bag->get('filename'), $bag->get('body'));

        $result = $fm->create([]);
        $resource = $result->getResource();

        $resource
            ->addMedia($bag->get('filename'))
            ->addCustomHeaders([
                'ContentDisposition' => 'attachment; filename='.basename($bag->get('filename')).'',
            ])
            ->toMediaCollection('file');

        return $result;
    }
736443
public function getAutoloaderConfig()
    {
        $dir = $this->getDir();
        $namespace = $this->getModuleNamespace();
    
        if (file_exists($dir . '/../../src')) {
            $dir = $dir . '/../../src';
        } elseif (file_exists($dir . '/../src')) {
            $dir = $dir . '/../src';
        } elseif (file_exists($dir . '/src')) {
            $dir = $dir . '/src';
        } else {
            throw new \Exception('No src directory found');
        }
    
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    $namespace => $dir . '/' . $namespace,
                ),
            ),
        );
    }
440958
public function generateResources()
    {
        $this->console->call('component:make-seed', [
            'name'      => $this->getName(),
            'component' => $this->getName(),
            '--master'  => true,
        ]);

        $this->console->call('component:make-provider', [
            'name'      => $this->getName() . 'ServiceProvider',
            'component' => $this->getName(),
            '--master'  => true,
        ]);

        $this->console->call('component:make-controller', [
            'controller' => $this->getName() . 'Controller',
            'component'  => $this->getName(),
        ]);
    }
139198
public function generateFilename()
    {
        // Check if this file is nested within a folder
        $parent = $this->Parent();
        if ($parent && $parent->exists()) {
            return $this->join_paths($parent->getFilename(), $this->Name);
        }
        return $this->Name;
    }
935003
public function load()
    {
        list($paths, $excludedPaths) = $this->loadBundleNamespaceMap($this->kernelBundles, $this->bundles);
        $paths = array_merge($paths, $this->loadResourceNamespaceMap($this->rootDir, $this->resources));

        return $this->parseNamespaceMap($this->finder, $this->reader, $paths, $excludedPaths);
    }
326579
public function getIterator()
    {
        //Run the query
        $resp = $this->query->execute();

        //Return the documents as an ArrayIterator to satisfy the requirements
        //of the getIterator function.
        foreach ($resp->data as $document)
        {
            yield $document;
        }

        while ($resp->cursors->next) {
            //send a new request, resetting $resp
            $resp = $this->query->execute($resp->cursors->next);

            foreach ($resp->data as $document)
            {
                yield $document;
            }
        }
    }