Create service worker

@return \ValuSo\Broker\Worker
761487
protected function createWorker($service)
    {
        return $this->getServiceBroker()
            ->service($service)
            ->context($this->command->getContext());
    }
511233
protected function registerWorker()
    {
        $this->app->singleton('queue.worker', function () {
            return new Worker(
                $this->app['queue'], $this->app['events'], $this->app[ExceptionHandler::class]
            );
        });
    }
525982
protected function registerWorker()
	{
		$this->registerWorkCommand();

		$this->registerRestartCommand();

		$this->app->singleton('queue.worker', function($app)
		{
			return new Worker($app['queue'], $app['queue.failer'], $app['events']);
		});
	}
5887
protected function registerQueueWorker()
    {
        $this->app->singleton('queue.worker', function () {
            if ($this->eye->laravelVersionIs('>=', '5.3.0')) {
                return new Worker($this->app['queue'], $this->app['events'], $this->app[ExceptionHandler::class]);
            } else {
                return new WorkerLegacy($this->app['queue'], $this->app['queue.failer'], $this->app['events']);
            }
        });
    }
569064
public static function create()
    {
        $builder = NotifireBuilder::create();

        if (\class_exists('Swift_Mailer')) {
            $transport = new \Swift_SmtpTransport('localhost', 25);
            $mailer = new \Swift_Mailer($transport);

            $handler = new SwiftMailerHandler($mailer, 'default');
            if (\class_exists('Twig_Environment')) {
                $env = new \Twig_Environment(new \Twig_Loader_Filesystem());
                $handler->setTwig($env);
            }

            $builder->addHandler($handler);
            $builder->addNotification('email', Email::class);
        }

        $builder->initialize();
    }
1299556
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $workflowServiceManager = $serviceLocator->get(Manager::class);

        /** @var Module $module */
        $module = $serviceLocator->get(Module::class);
        $metadataReaderManager = $module->getMetadataReaderManager();

        /** @var ModuleOptions $moduleOptions */
        $moduleOptions = $serviceLocator->get(ModuleOptions::class);

        $metadataReaderName = $moduleOptions->getMetadataReader();
        $metadataReaderOptions = $moduleOptions->getMetadataReaderOptions();
        $metadataReader = $metadataReaderManager->get($metadataReaderName, $metadataReaderOptions, false);

        $options = [
            'serviceManager' => $workflowServiceManager,
            'metadataReader' => $metadataReader
        ];

        return new ServiceTypeResolver($options);
    }
769897
protected function createClient()
    {
        return new Client([
            'base_uri' => $this->baseUrl,
            'handler'  => $this->handlerStack,
            RequestOptions::HTTP_ERRORS => false,
            RequestOptions::AUTH => [$this->app->getClientId(), $this->app->getClientSecret()],
            RequestOptions::TIMEOUT => $this->requestTimeout,
        ]);
    }
998583
public static function create()
    {
        $dispatcher = new Dispatcher();
        foreach (static::$_stack as $middleware) {
            $dispatcher->addFilter($middleware);
        }

        return $dispatcher;
    }
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);
            })
        ;
    }
740445
private function createJob(array $worker)
    {
        /**
         * If service is defined, we must retrieve this class with dependency injection
         *
         * Otherwise we just create it with a simple new()
         */
        if ($worker['service']) {

            $objInstance = $this->container->get($worker['service']);

        } else {

            $objInstance = new $worker['className'];

            /**
             * If instance of given object is instanceof
             * ContainerAwareInterface, we inject full container by calling
             * container setter.
             *
             * @see https://github.com/mmoreram/gearman-bundle/pull/12
             */
            if ($objInstance instanceof ContainerAwareInterface) {

                $objInstance->setContainer($this->container);
            }
        }

        return $objInstance;
    }
375830
private function createManager()
    {
        $config = $this->generateConfig();

        $algoliaManager = $this->algoliaFactory->make($config);
        $algoliaManager->setEnv($this->env);

        return $algoliaManager;
    }
6073
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new Environment();

        /** @var Client $pmProxyClient */
        $pmProxyClient = $serviceLocator->get('KmbPmProxy\Client');
        $service->setPmProxyClient($pmProxyClient);

        /** @var HydratorInterface $environmentHydrator */
        $environmentHydrator = $serviceLocator->get('KmbPmProxy\Hydrator\EnvironmentHydrator');
        $service->setEnvironmentHydrator($environmentHydrator);

        return $service;
    }
233653
public function build()
    {
        $soapClientFactory = new SoapClientFactory();
        $soapClient = $soapClientFactory->create($this->wsdl);

        return new Client($soapClient);
    }
731286
public function createHandler()
    {
        $this->pushHeaderMiddleware(
            function (RequestInterface $request) {
                return $request->withHeader('User-Agent', Pay::CLIENT . ' v' . Pay::VERSION);
            }
        );

        $this->pushBasicAuthMiddleware(
            function (RequestInterface $request) {
                return $request->withHeader(
                    'Authorization', 'Basic ' . base64_encode(
                        $this->config->getClientId() . ':' . $this->config->getClientSecret()
                    )
                );
            }
        );

        $this->pushRetryMiddleware(self::decider(), self::delay());

        return $this->stack;
    }
1253913
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var $env Environment */
        $env = $serviceLocator->get(Definition::SERVICE_ENVIRONMENT);

        return new WorkflowProcessor(
            $env->getNodeName(),
            $env->getEventStore(),
            $env->getProcessRepository(),
            $env->getWorkflowEngine(),
            $env->getProcessFactory()
        );
    }
734469
protected function createSesDriver()
    {
        $config = [
            'version' => 'latest', 'service' => 'email',
            'key' => $this->getSecureConfig('key'),
            'secret' => $this->getSecureConfig('secret'),
            'region' => $this->getConfig('region'),
            'options' => [],
        ];

        return new SesTransport(
            new SesClient($this->addSesCredentials($config)), []
        );
    }
436006
protected function buildWorkerCommand()
    {
        if (! app()->isRunningOnGae()) {
            return parent::buildWorkerCommand();
        }

        $binary = (new PhpExecutableFinder)->find(false);

        if (defined('HHVM_VERSION')) {
            $binary .= ' --php';
        }

        if (defined('ARTISAN_BINARY')) {
            $artisan = ARTISAN_BINARY;
        } else {
            $artisan = 'artisan';
        }

        $command = 'queue:work %s --queue=%s --delay=%s --memory=%s --sleep=%s --tries=%s';

        return "{$binary} {$artisan} {$command}";
    }