@param Configuration $configuration

@return UsageParser
175978
private function getUsageParser(Configuration $configuration)
    {
        return new UsageParser(
            $this->getStaticAnalysisVisitors($configuration),
            $this->getViolationVisitors(),
            $this->getBaseTraverser(),
            new NodeTraverser(),
            new NodeTraverser()
        );
    }
1222181
public function initConfiguration(Configuration $configuration = null)
    {
        if (isset($configuration)) {
            $this->configuration = $configuration;
        }

        if (isset($this->configuration)) {
            $this->setLogger($this->configuration->getLogger());
            $this->componentFactory = null;
            $this->prepareFactory();
        }
    }
253526
protected function prepareObject(Configuration $configuration, Parameter $parameter)
  {
    $this->dispatcher->dispatch(
      TransformerEvents::PREPARE_OBJECT,
      new TransformerEvent($configuration, $parameter)
    );

    $value = $this->build(
      $configuration->getOptions()->getReturnClass(),
      $configuration->getChildren(),
      $this->converter->convertTo($parameter->getValue(), 'array')
    );
    $parameter->setValue($value);

    return $this;
  }
1270844
private function parseConfiguration(array $configuration = array())
    {
        $configToPropertyMap = array(
            'identifier' => 'applicationKey',
            'expiration' => 'applicationExpiration',
            'name' => 'applicationName',
            'scope' => 'applicationScope',
        );

        foreach ($configToPropertyMap as $config => $property) {
            if (isset($configuration[$config])) {
                $this->$property = $configuration[$config];
            }
        }
    }
929126
final public static function setConfig(ConfigInterface $configuration) {
        $previous = self::$defaultConfig;
        self::$defaultConfig = $configuration;
        if (self::$defaultDi)
            self::$defaultDi->set('config', $configuration);
        return $previous;
    }
1181132
public function build(Configuration $configuration, array $data): Definition
    {
        $name = $data['name'];
        unset($data['name']);
        $data['type'] = 'contao';

        return new DictionaryDefinition($name, $data);
    }
1248580
private function getAllClassNames(Configuration $configuration)
    {
        if (!$this->classNames) {
            $this->classNames = $configuration->getMetadataDriverImpl()->getAllClassNames();
        }

        return $this->classNames;
    }
9474
public function setConfiguration($configuration)
    {
        $this->configuration = (string) $configuration;

        $message = sprintf("Set configuration to [%s].", $this->configuration);
        $this->log($message, Project::MSG_DEBUG);
    }
1274106
public function requireIfAvailableAnd(Configuration $configuration, array $params)
  {
    $requiredIfAvailable = $configuration->getOptions()->getRequiredIfAvailable();
    if (is_array($requiredIfAvailable->getAnd()) && count($requiredIfAvailable->getAnd()) > 0)
    {
      foreach ($requiredIfAvailable->getAnd() as $key)
      {
        if (!array_key_exists(strtolower($key), $params))
        {
          return false;
          break;
        }
      }

      return true;
    }

    return false;
  }
581146
static public function getInstance( $configuration = array() )
    {
        if (empty( self::$instance )) {
            self::$instance = new App( $configuration );
        }
        return self::$instance;
    }
1192685
protected function prepareServiceManager(Configuration $configuration)
    {
        $container      = $this->config->get('services', []);
        $serviceManager = new LeagueAdapter();

        foreach ($container as $className) {

            /** @var ServiceProvider $provider */
            $provider = new $className();

            if ( $provider instanceof ServiceProvider ) {
                throw new \InvalidArgumentException(
                    sprintf('Provider %s must be ServiceProvider', $className)
                );
            }

            $aliases = $provider->alias();
            if ( !is_array($aliases) ) {
                $aliases = [$aliases];
            }

            foreach ($aliases as $alias) {
                if ( $provider->share() ) {
                    $serviceManager->share($alias);
                }

                if ( $provider instanceof ServiceManager\SetterInjectorProvider ) {
                    $serviceManager
                        ->inflector($provider->inflector())
                        ->invokeMethod($provider->method(), [$alias]);
                }

                $provides = $provider->provide();

                if ( !is_callable($provides) ) {
                    $serviceManager->alias($alias, $provides);
                    continue;
                }

                $serviceManager->add(
                    $alias,
                    function () use ($provides, $serviceManager) {
                        return $serviceManager->call($provides);
                    }
                );
            }

        }

        // Add the ServiceManager and the Configuration
        $serviceManager->add(LeagueAdapter::class, $serviceManager);
        $serviceManager->add(ConfigurationContainer::class, $this->config);

        return $serviceManager;
    }
1278087
public function initConfiguration(Configuration $configuration = null)
    {
        parent::initConfiguration($configuration);
        if (isset($this->configuration)) {
            $this->twig = $this->configuration->getTwig();
            $this->resolver = $this->configuration->getResolver();
        }
    }
888942
protected function parse($configuration)
    {
        $result = [];

        // Extract commands of Doozr from configuration
        foreach ($configuration as $root => $children) {
            foreach ($children as $key => $values) {
                foreach ($values as $node => $value) {
                    $dom   = [];
                    $doozr = [];

                    switch ($node) {
                        case 'tag':
                            $tag = $value;
                            break;
                        case 'properties':
                            $properties = $value;

                            // Get commands of form
                            foreach ($properties as $property => $value) {
                                if ($this->containsCommand($property) === true) {
                                    $doozr[] = [
                                        'method' => $this->getMethodByKey($property),
                                        'value'  => $value,
                                    ];
                                } else {
                                    $dom[$property] = $value;
                                }
                            }
                            break;
                    }
                }

                if (isset($result[$root]) === false) {
                    $result[$root] = [];
                }

                $result[$root][] = [
                    'dom'   => $dom,
                    'doozr' => $doozr,
                ];
            }
        }

        // After iterating all parts with the same logic shift child form to root -> only one possible!
        $result['form'] = $result['form'][0];

        $this->setConfiguration(array_to_object($result));
    }
846195
public function install(Configuration $configuration)
    {
        // Register the Installation application
        \JLoader::registerPrefix('Installation', JPATH_INSTALLATION);

        $app = new InstallationApplicationWeb();
        Factory::pushApplication($app);

        $this->joomla->initialize();

        // Get the database model.
        $db = new DatabaseModel();

        $dboptions = [
            'db_type'   => $this->config->get('dbtype'),
            'db_host'   => $this->config->get('host'),
            'db_user'   => $this->config->get('user'),
            'db_pass'   => $this->config->get('password'),
            'db_name'   => $this->config->get('db'),
            'db_prefix' => $this->config->get('dbprefix'),
            'db_select' => true
        ];

        $driver = $db->initialise($dboptions);

        if ($driver instanceof AbstractDoctrineDriver) {
            $dboptions['db_name'] = $driver->getDatabaseName();
        }

        $pwd = getcwd();
        chdir(JPATH_INSTALLATION);

        $db->createTables(array_merge($dboptions, [
            'language'   => 'en-GB',
            'db_created' => true,
            'db_type'    => $driver->name
        ]));

        $configration = new ConfigurationModel();

        $configration->setup(array_merge($dboptions, [
            'site_offline'   => 0,
            'site_name'      => '',
            'site_metadesc'  => '',
            'helpurl'        => '',
            'admin_user'     => $configuration->getUsername(),
            'admin_email'    => $configuration->getEmail(),
            'admin_password' => $configuration->getPassword()
        ]));

        chdir($pwd);

        Factory::popApplication();
    }
35610
protected function runSuccess( &$configuration ) {
		$userInfoRes = $this->apiQuery(
			array(
				'action' => 'query',
				'meta'   => 'userinfo',
				'uiprop' => 'blockinfo|rights|groups'
			)
		);

		if( in_array( 'apihighlimits', $userInfoRes['query']['userinfo']['rights'] ) ) {
			$this->apiQueryLimit = 4999;
		} else {
			$this->apiQueryLimit = 499;
		}

		$this->userRights = $userInfoRes['query']['userinfo']['rights'];

		if( in_array( 'bot', $userInfoRes['query']['userinfo']['groups'] ) ) {
			$this->isFlagged = true;
		}

		$this->get_tokens();

		$this->configuration = $configuration;
		unset( $this->configuration['password'] );
	}
47724
public static function initialize($configuration = NULL)
	{
		if($configuration) {
			self::setConfiguration($configuration);
		}

		if(!self::$configuration instanceof Configuration) {
			throw new InvalidConfigurationException("Consumerr is not properly configured.");
		}
		if(self::$enabled) {
			self::log("Multiple calls to initialize - ignore");
			return FALSE;
		}

		if (self::$configuration->isClientDisabled()) {
			self::log('Client IP is disabled by current configuration.');

			return FALSE; //nothing to do here
		}
		if (self::$configuration->isCliDisabled()) {
			self::log('CLI is disabled by current configuration.');

			return FALSE; //nothing to do here
		}
		self::$enabled = TRUE;
		self::getTime();

		$errorPage = self::$configuration->getErrorPage();
		if ($errorPage !== false) {
			ErrorHandler::register($errorPage);
		}

		if (!self::isConsole()) {
			if (self::$configuration->isAsyncEnabled()) {
				ob_start();
			}

			self::getAccess()->setUrl(
				(isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'off') ? 'https://' : 'http://')
				. (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : ''))
				. $_SERVER['REQUEST_URI']
			);

			if (isset($_SERVER['SERVER_NAME'])) {
				self::getAccess()->setServerName($_SERVER['SERVER_NAME']);
			}

			if (isset($_SERVER['REMOTE_ADDR'])) {
				self::getAccess()->setRemoteAddr($_SERVER['REMOTE_ADDR']);
			}

			if (isset($_SERVER['SCRIPT_NAME'])) {
				self::getAccess()->setName($_SERVER['SCRIPT_NAME']);
			}

			if (isset($_SERVER['REQUEST_METHOD'])) {
				self::getAccess()->setMethod($_SERVER['REQUEST_METHOD']);
			}
			
			if (function_exists('getallheaders')) {
				self::getAccess()->setHeaders(getallheaders());
			}


			if (isset($_SERVER['HTTP_USER_AGENT'])) {
				self::getAccess()->setUserAgent($_SERVER['HTTP_USER_AGENT']);
			}
		} else {
			self::getAccess()->setName(self::getCliArguments());
			self::getAccess()->setBackgroundJob(TRUE);
		}

		self::registerSenderShutdownHandler();

		return TRUE;
	}
610988
private function getViolationFilter(Configuration $configuration)
    {
        $violationFilters = array();
        if ('' !== $configuration->filteredMethodCalls()) {
            $violationFilters[] = MethodViolationFilter::fromString($configuration->filteredMethodCalls());
        }

        return new ComposedViolationFilter($violationFilters);
    }