Launches a generator

@return \Generator
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
        ];
    }
675135
public function run()
    {
        $argument      = Eurekon\Argument::getInstance();
        $passwordPlain = (string) $argument->get('p', 'password');
        $length        = (int) $argument->get('l', 'length', 16);

        $password = new Password($passwordPlain);

        if (empty($passwordPlain)) {
            $password->generate($length);
        }

        $password->hash();

        $green = (new Style())->highlight('fg')->color('fg', Style::COLOR_GREEN);
        $white = (new Style())->highlight('fg')->color('fg', Style::COLOR_WHITE);

        Out::std((string) $green->setText('Password: ') . (string) $white->setText($password->getPlain()));
        Out::std((string) $green->setText('Hash:     ') . (string) $white->setText($password->getHash()));
    }
624362
final public function generate() {
        $options = array_merge($this->options, (array) 'generate');
        Generator::call($this->called, $this->args, $options);
    }
95817
protected function doBuild()
    {
        $this->validateYaml();

        $generator = new AdminGenerator($this->cache_dir, $this->getGeneratorYml());
        $generator->setContainer($this->container);
        $generator->setBaseAdminTemplate(
            $generator->getFromYaml(
                'base_admin_template',
                $this->container->getParameter('admingenerator.base_admin_template')
            )
        );
        $generator->setFieldGuesser($this->getFieldGuesser());
        $generator->setMustOverwriteIfExists($this->needToOverwrite($generator));
        $generator->setTemplateDirs(
            array_merge(
                $this->container->getParameter('admingenerator.doctrine_templates_dirs'),
                array(__DIR__.'/../Resources/templates/Doctrine')
            )
        );
        $generator->setBaseController(
            'Admingenerator\GeneratorBundle\Controller\Doctrine\BaseController'
        );
        $generator->setBaseGeneratorName($this->getBaseGeneratorName());

        $embed_types = $generator->getFromYaml('params.embed_types', array());

        foreach ($embed_types as $yaml_path) {
            $this->prebuildEmbedType($yaml_path, $generator);
        }

        $builders = $generator->getFromYaml('builders', array());

        if (array_key_exists('list', $builders)) {
            $generator->addBuilder(new ListBuilderAction());
            $generator->addBuilder(new ListBuilderTemplate());
            $generator->addBuilder(new FiltersBuilderType());
        }

        if (array_key_exists('nested_list', $builders)) {
            $generator->addBuilder(new NestedListBuilderAction());
            $generator->addBuilder(new NestedListBuilderTemplate());
            $generator->addBuilder(new FiltersBuilderType());
        }

        if (array_key_exists('edit', $builders)) {
            $generator->addBuilder(new EditBuilderAction());
            $generator->addBuilder(new EditBuilderTemplate());
            $generator->addBuilder(new EditBuilderType());
        }

        if (array_key_exists('new', $builders)) {
            $generator->addBuilder(new NewBuilderAction());
            $generator->addBuilder(new NewBuilderTemplate());
            $generator->addBuilder(new NewBuilderType());
        }

        if (array_key_exists('show', $builders)) {
            $generator->addBuilder(new ShowBuilderAction());
            $generator->addBuilder(new ShowBuilderTemplate());
        }

        if (array_key_exists('excel', $builders)) {
            $generator->addBuilder(new ExcelBuilderAction());
        }

        if (array_key_exists('actions', $builders)) {
            $generator->addBuilder(new ActionsBuilderAction());
            $generator->addBuilder(new ActionsBuilderTemplate());
        }

        $generator->writeOnDisk(
            $this->getCachePath(
                $generator->getFromYaml('params.namespace_prefix'),
                $generator->getFromYaml('params.bundle_name')
            )
        );
    }
1110759
public function run(): self
    {
        $this->displayComment();
        $this->launched = true;
        if ($this->onStart) {
            ($this->onStart)();
        }
        $this->execute();
        if ($this->onFinish) {
            ($this->onFinish)();
        }
        $this->doneIterationsCombined += $this->doneIterations;
        return $this;
    }
413977
public function run()
    {
        $force = $this->controller->force;
        $this->stdout(":\n", Console::FG_GREEN);
        foreach ($this->ipv4->getQueries() as $name => $query) {
            $providers = $query->getProviders();
            if (empty($providers)) {
                $this->download($query, $name, $force);
            } else {
                $this->division();
                $this->generate($query, $name, $force);
            }
        }
    }
1368176
public function getIterator(): \Generator
    {
        foreach ( $this->storage as $object ) {
            yield $object => $this->storage[$object]['fallback'];
        }
    }
275353
public function start()
    {
        $__scope = $this->_runHooks($this->_startHooks);
        extract($__scope);
        
        $this->_write($this->_socket, self::READY);
        
        /* Note the naming of the local variables due to shared scope with the user here */
        for (;;) {
            declare (ticks = 1);
            // don't exit on ctrl-c
            pcntl_signal(SIGINT, SIG_IGN, true);
            
            $this->_cancelled = false;
            
            $__input = $this->_transform($this->_read($this->_socket));
            
            if ($__input === null) {
                continue;
            }
            
            $__response = self::DONE;
            
            $this->_ppid = posix_getpid();
            $this->_pid  = pcntl_fork();
            
            if ($this->_pid < 0) {
                throw new \RuntimeException('Failed to fork child labourer');
            } elseif ($this->_pid > 0) {
                // kill the child on ctrl-c
                pcntl_signal(SIGINT, array(
                    $this,
                    'cancelOperation'
                ), true);
                pcntl_waitpid($this->_pid, $__status);
                
                if (!$this->_cancelled && $__status != (self::ABNORMAL_EXIT << 8)) {
                    $__response = self::EXITED;
                } else {
                    $this->_runHooks($this->_failureHooks);
                    $__response = self::FAILED;
                }
            } else {
                // if the user has installed a custom exception handler, install a new
                // one which calls it and then (if the custom handler didn't already exit)
                // exits with the correct status.
                // If not, leave the exception handler unset; we'll display
                // an uncaught exception error and carry on.
                $__oldexh = set_exception_handler(array(
                    $this,
                    'delegateExceptionHandler'
                ));
                if ($__oldexh && !$this->_userExceptionHandler) {
                    $this->_userExceptionHandler = $__oldexh; // save the old handler (once)
                } else {
                    restore_exception_handler();
                }
                
                // undo ctrl-c signal handling ready for user code execution
                pcntl_signal(SIGINT, SIG_DFL, true);
                $__pid = posix_getpid();
                
                $__result = eval($__input);
                
                if (posix_getpid() != $__pid) {
                    // whatever the user entered caused a forked child
                    // (totally valid, but we don't want that child to loop and wait for input)
                    exit(0);
                }
                
                if (preg_match('/\s*return\b/i', $__input)) {
                    fwrite(STDOUT, sprintf("%s\n", $this->_inspector->inspect($__result)));
                }
                $this->_expungeOldWorker();
            }
            
            $this->_write($this->_socket, $__response);
            
            if ($__response == self::EXITED) {
                exit(0);
            }
        }
    }
818238
public function run()
    {

        try {
            // register the default autoloader
            require SERVER_AUTOLOADER;

            // register shutdown handler
            set_error_handler(array(&$this, 'errorHandler'));
            register_shutdown_function(array(&$this, 'shutdown'));

            // try to load the application
            $application = $this->application;

            // register the applications class loaders
            $application->registerClassLoaders();

            // register the applications annotation registries
            $application->registerAnnotationRegistries();

            // load input/output instances
            $input = $this->input;
            $output = $this->output;

            // add the application instance to the environment
            Environment::singleton()->setAttribute(EnvironmentKeys::APPLICATION, $application);

            // create a simulated request/session ID whereas session equals request ID (as long as session has NOT been started)
            Environment::singleton()->setAttribute(EnvironmentKeys::REQUEST_ID, $requestId = SessionUtils::generateRandomString());
            Environment::singleton()->setAttribute(EnvironmentKeys::SESSION_ID, $requestId);

            // load and initialize the Symfony console application
            /** @var \Symfony\Component\Console\Application $cli */
            $cli = $application->search('Console');
            $cli->setAutoExit(false);
            $cli->setCatchExceptions(true);

            // run the Symfony console application
            $cli->run($input, $output);

            // update the output instance
            $this->output = $output;

        } catch (\Exception $e) {
            // log the exception
            \error($e->__toString());
        }
    }
1294699
public function launching()
    {
        /**
         * registering default commands
         */
        $this->with([self::PROVIDES_SERVICE], function (IBladedManager $manager) {
            $manager->registerCommandNamespace('scope', Scope::class);
            \phpQuery::newDocument();
            $manager->registerCommandNamespace('form', Form::class);
            $manager->registerCommandNamespace('template', Template::class);
        });
    }
1045787
public function getGenerator()
    {
        try {
            if (empty($this->generator)) {
                $this->setGenerator(
                    new Generator(
                        $this->config(static::TOOL_NAME),
                        $this->config(static::TOOL_ID),
                        $this->config(static::TOOL_LAUNCH_URL),
                        (empty($this->config(static::TOOL_DESCRIPTION)) ?
                            false : $this->config(static::TOOL_DESCRIPTION)),
                        (empty($this->config(static::TOOL_ICON_URL)) ?
                            false : $this->config(static::TOOL_ICON_URL)),
                        (empty($this->config(static::TOOL_LAUNCH_PRIVACY)) ?
                            LaunchPrivacy::USER_PROFILE() : $this->config(static::TOOL_LAUNCH_PRIVACY)),
                        (empty($this->config(static::TOOL_DOMAIN)) ? false : $this->config(static::TOOL_DOMAIN))
                    )
                );
            }
        } catch (LTIConfigGeneratorException $e) {
            throw new ConfigurationException(
                $e->getMessage(),
                ConfigurationException::TOOL_PROVIDER
            );
        }
        return $this->generator;
    }
562102
public function run()
    {
        // php artisan db:seed --class="PermissionsTableSeeder"
        $permissions = [
            [
                'name' => 'manage_users',
            ],
            [
                'name' => 'manage_pages',
            ],
            [
                'name' => 'access_admin',
            ],
        ];

        // Only add new
        $allPermissions = Permission::all()->pluck('name')->toArray();

        foreach ($permissions as $permission) {
            if (! in_array($permission['name'], $allPermissions)) {
                Permission::create($permission);
            }
        }
    }
716561
protected function createWidgetGenerator()
    {
        $generator = new WidgetGenerator($this->getContainer()->get('filesystem'));
        $generator->setTemplating($this->getContainer()->get('twig'));

        return $generator;
    }
793082
public function start()
    {
        if (!$this->hasStarted()) {
            $this->setStarted();
            $this->dispatch(RunEvent::STARTED, new RunEvent($this));
            try {
                try {
                    $output = call_user_func($this->callback);
                    $this->handleOutput($output);
                    $this->setFinished();
                    $this->successful = true;
                    $this->dispatch(RunEvent::SUCCESSFUL, new RunEvent($this));
                } catch (Exception $e) {
                    $this->setFinished();
                    $this->successful = false;
                    $this->exception = $e;
                    $this->dispatch(RunEvent::FAILED, new RunEvent($this));
                } catch (Throwable $e) {
                    $this->setFinished();
                    $this->successful = false;
                    $this->exception = $e;
                    $this->dispatch(RunEvent::FAILED, new RunEvent($this));
                }
            } finally {
                $this->dispatch(RunEvent::COMPLETED, new RunEvent($this));
            }
        }

        return $this;
    }
201766
protected function registerSeeder()
    {
        $this->app['generate.seeder'] = $this->app->share(function($app)
        {
            $generator = $this->app->make('Way\Generators\Generator');

            return new SeederGeneratorCommand($generator);
        });

        $this->commands('generate.seeder');
    }
240465
protected function start()
    {
        $this->processes[] = $this->createProcess()->handleOutputUsing(function ($type, $line) {
            call_user_func($this->output, $type, $line);
        });

        return $this;
    }
355997
public function start() {
        if (!$this->isStarted) {
            $this->generateIpcServer();
            $this->isStarted = true;
            for ($i=0;$i<$this->poolSizeMin;$i++) {
                $this->spawnWorker();
            }
            $this->registerTaskTimeoutWatcher();
        }

        return $this;
    }