Create a registry and attempt to fill it by resolving element types by introspecting class hierarchy

@return static
546432
public static function generate()
    {
        $registry = static::create();

        // Look in a cache (if provided) for type details
        if (static::$cache && ($types = static::$cache->get(self::CACHE_KEY))) {
            $registry->elementTypes = $types;
            return $registry;
        }

        // Find all element types
        $classNames = ClassInfo::getValidSubClasses(BaseElement::class);
        foreach ($classNames as $class) {
            // Skip the "abstract" element
            if ($class === BaseElement::class) {
                continue;
            }
            $registry->registerElement($class);
        }

        return $registry;
    }
1121765
public static function currentAppsState($registry)
    {
        $modelStates = [];

        foreach ($registry->getModels() as $modelName => $modelObj) {
            $modelStates[$modelName] = ModelState::fromModel($modelObj);
        }

        return static::createObject($modelStates);
    }
586426
public static function createInstance(): self
    {
        return new static(
            [
                new Factory\Argument(new PrettyPrinter()),
                new Factory\Class_(),
                new Factory\Constant(new PrettyPrinter()),
                new Factory\DocBlock(DocBlockFactory::createInstance()),
                new Factory\File(NodesFactory::createInstance()),
                new Factory\Function_(),
                new Factory\Interface_(),
                new Factory\Method(),
                new Factory\Property(new PrettyPrinter()),
                new Factory\Trait_(),
            ]
        );
    }
949916
protected function registerRegistry()
    {
        $this->app['registry'] = $this->app->share(function($app)
        {
            $config = $app->config->get('registry', array());

            return new Registry($app['db'], $app['registry.cache'], $config);
        });
    }
1329954
public function loadRegistries()
    {
        $registries = $this->registryFactory->getDefaultRegistries();

        foreach ($registries as $registry) {
            $this->addRegistry($registry);
        }
    }
769547
protected function regsiterConfigDrivers()
    {
        // register xml config dirvers
        $me          = $this;
        $base        = $this->app['config']->get('xmlconf::basedir', array());
        $cacheDriver = $this->app['config']->get('cache.driver', 'file');

        foreach ($this->app['config']->get('xmlconf::namespaces', array()) as $reader => $namespace) {

            $this->checkBaseDir($reader, $base);

            $this->app['xmlconf.' . $reader] = $this->app->share(function ($app) use ($me, $base, $reader, $namespace, $cacheDriver)
            {
                $class     = $me->getReaderClass($reader, $namespace);
                $cache     = new Cache\Cache($app['cache']->driver($cacheDriver), $reader);
                $xmlreader = new $class(

                    $cache,
                    $me->getSimpleXmlClass($reader, $namespace),
                    $me->getConfPath($reader),
                    $me->getSchemaPath($reader, $base[$reader])

                );

                return $xmlreader;
            });
        }
    }
922833
public function getConfigurationRegistry()
    {
        if (null === $this->configurationRegistry) {
            $this->configurationRegistry = new Configuration\ConfigurationRegistry();
        }

        return $this->configurationRegistry;
    }
190508
protected function createGenerator()
    {
        $filesystem = $this->getContainer()->get('filesystem');
        $registry = $this->getContainer()->get('doctrine');

        return new DefaultSiteGenerator($filesystem, $registry, '/defaultsite', $this->assistant, $this->getContainer());
    }
769853
protected static function _loadConfig()
    {
        foreach (static::$_config as $name => $properties) {
            if (isset($properties['engine'])) {
                $properties['className'] = $properties['engine'];
            }
            if (!static::$_registry->has($name)) {
                static::$_registry->load($name, $properties);
            }
        }
    }
1097153
private function createLazyDefinition($registry, Definition $definition)
    {
        $lazy = new Definition(LazyRegistry::class, [
            new Reference('service_container'),
            new Reference($registry),
        ]);

        foreach ($definition->getMethodCalls() as $methodCall) {
            if ($methodCall[0] === 'offsetSet') {
                $methodCall[1][1] = (string) $methodCall[1][1];
                $lazy->addMethodCall('setLazy', $methodCall[1]);
            }
        }

        return $lazy;
    }
802766
protected function addRegistry(string $registryName)
    {
        $this->registries[] = $this->registryFactory->getRegistry($registryName, $this->getEntityName(), $this->entityManager);

        return $this;
    }
1194083
public static function create()
    {
        return parent::create()
            ->setSerializationContextFactory(array(self::class, 'createDefaultSerializationContext'))
            ->addDefaultHandlers()
            ->configureListeners(function (EventDispatcher $dispatcher) {
                $proxySubscriber = new DoctrineProxySubscriber(false);
                $dispatcher->addSubscriber($proxySubscriber);
            })
            ->configureHandlers(function (HandlerRegistryInterface $handlerRegistry) {
                $proxyHandler = new DoctrineProxyHandler();
                $handlerRegistry->registerSubscribingHandler($proxyHandler);
            })
        ;
    }
1204342
public function create()
    {
        /**
         * @var ConfigurationInterface $configuration
         */
        $classNamespace = $this->getEntityNamespace();
        $configuration = new $classNamespace();

        $configuration
            ->setNamespace('')
            ->setType(ElcodiConfigurationTypes::TYPE_STRING)
            ->setCreatedAt($this->now());

        return $configuration;
    }
931995
public static function createContainer()
    {
        $resolver = new ReferenceResolver();
        
        $builder = new ContainerBuilder($resolver, [self::$appDir]);

        foreach (self::$loaders as $loader) {
            $builder->addLoader($loader);
        }
        $builder->setApplicationRootDirectory(self::$appDir);

        $builder->addConfigFiles(self::$configFiles);

        return $builder->createContainer();
    }
212463
private function buildStdClass()
    {
        foreach ($this->registries as $registry) {
            $this->entity->{$registry->getKey()} = $registry->getValue();
        }
    }
315185
protected function createIndex()
    {
        $tree = [];

        foreach ($this->classDefinitions as $className => $classInfo) {
            $current = & $tree;

            foreach (explode('\\', $className) as $part) {
                if (!isset($current[$part])) {
                    $current[$part] = [];
                }

                $current = & $current[$part];
            }
        }

        /**
         * This will be a reference to the $treeOutput closure, so that it can be invoked
         * recursively. A string is used to trick static analysers into thinking this might be
         * callable.
         */
        $treeOutput = '';

        $treeOutput = function($item, $fullString = '', $depth = 0) use (&$treeOutput) {
            $output = '';

            foreach ($item as $name => $subItems) {
                $fullName = $name;

                if ($fullString) {
                    $fullName = $fullString . '\\' . $name;
                }

                $output .= str_repeat(' ', $depth * 4) . '* ' . Generator::classLink($fullName, $name) . "\n";
                $output .= $treeOutput($subItems, $fullName, $depth + 1);
            }

            return $output;
        };

        return $treeOutput($tree);
    }
421025
protected static function create()
    {
        $config = new static();

        $config->config = (new ConfigFactory())->create($config->getProjectPath(), $config->CONFIG_FILE);

        return $config;
    }