original_string: public function createUserService()
      {
          $config = $this->container->get('cca.legacy_dic.contao_config');
          // Work around the fact that \Contao\Database::getInstance() always creates an instance,
          // even when no driver is configured (Database and Config are being imported into the user class and there-
          // fore causing an fatal error).
          if (!$config->get('dbDatabase')) {
              throw new \RuntimeException('Contao Database is not properly configured.');
          }
  
          $matcher = $this->container->get('contao.routing.scope_matcher');
          $request = $this->container->get('request_stack')->getCurrentRequest();
  
          // NULL request => CLI mode.
          if ((null === $request) || $matcher->isBackendRequest($request)) {
              return $this->container->get('contao.framework')->createInstance(BackendUser::class);
          }
  
          if ($matcher->isFrontendRequest($request)) {
              return $this->container->get('contao.framework')->createInstance(FrontendUser::class);
          }
  
          throw new \RuntimeException('Unknown TL_MODE encountered', 1);
      }
code: public function createUserService()
      {
          $config = $this->container->get('cca.legacy_dic.contao_config');
          // Work around the fact that \Contao\Database::getInstance() always creates an instance,
          // even when no driver is configured (Database and Config are being imported into the user class and there-
          // fore causing an fatal error).
          if (!$config->get('dbDatabase')) {
              throw new \RuntimeException('Contao Database is not properly configured.');
          }
  
          $matcher = $this->container->get('contao.routing.scope_matcher');
          $request = $this->container->get('request_stack')->getCurrentRequest();
  
          // NULL request => CLI mode.
          if ((null === $request) || $matcher->isBackendRequest($request)) {
              return $this->container->get('contao.framework')->createInstance(BackendUser::class);
          }
  
          if ($matcher->isFrontendRequest($request)) {
              return $this->container->get('contao.framework')->createInstance(FrontendUser::class);
          }
  
          throw new \RuntimeException('Unknown TL_MODE encountered', 1);
      }
code_tokens: public function createUserService ( ) { $ config = $ this -> container -> get ( 'cca.legacy_dic.contao_config' ) ; // Work around the fact that \Contao\Database::getInstance() always creates an instance, // even when no driver is configured (Database and Config are being imported into the user class and there- // fore causing an fatal error). if ( ! $ config -> get ( 'dbDatabase' ) ) { throw new \ RuntimeException ( 'Contao Database is not properly configured.' ) ; } $ matcher = $ this -> container -> get ( 'contao.routing.scope_matcher' ) ; $ request = $ this -> container -> get ( 'request_stack' ) -> getCurrentRequest ( ) ; // NULL request => CLI mode. if ( ( null === $ request ) || $ matcher -> isBackendRequest ( $ request ) ) { return $ this -> container -> get ( 'contao.framework' ) -> createInstance ( BackendUser :: class ) ; } if ( $ matcher -> isFrontendRequest ( $ request ) ) { return $ this -> container -> get ( 'contao.framework' ) -> createInstance ( FrontendUser :: class ) ; } throw new \ RuntimeException ( 'Unknown TL_MODE encountered' , 1 ) ; }
docstring: Create the user service for contao user.
  
  @return BackendUser|FrontendUser
  
  @throws \RuntimeException Throw an exception if contao mode not defined.
docstring_tokens: Create the user service for contao user .