<commit_before><?php
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\View;
use Phalcon\Crypt;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Http\Response\Cookies;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use Phalcon\Mvc\View\Engine\Volt as VoltEngine;
use Phalcon\Mvc\Model\Metadata\Files as MetaDataAdapter;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Flash\Direct as FlashDirect;
use Phalcon\Flash\Session as FlashSession;
use Phalcon\Events\Manager as EventsManager;
use CpdnAPI\Plugins\NotFoundPlugin;
use CpdnAPI\Mail\Mail;

$di = new FactoryDefault ();

$di->set ( 'config', $config );

$di->set ( 'dispatcher', function () use($di) {
	$eventsManager = new EventsManager ();
	$eventsManager->attach ( 'dispatch:beforeException', new NotFoundPlugin () );
	$dispatcher = new Dispatcher ();
	$dispatcher->setDefaultNamespace ( 'CpdnAPI\Controllers' );
	$dispatcher->setEventsManager ( $eventsManager );
	return $dispatcher;
} );

$di->set ( 'url', function () use($config) {
	$url = new UrlResolver ();
	$url->setBaseUri ( $config->application->baseUri );
	return $url;
}, true );

$di->set ( 'view', function () {
	$view = new View ();
	return $view;
}, true );

$di->set ( 'db-network', function () use($config) {
	return new DbAdapter ( array (
			'host' => $config->database->network->host,
			'username' => $config->database->network->username,
			'password' => $config->database->network->password,
			'dbname' => $config->database->network->name,
			'charset' => $config->database->network->charset 
	) );
} );

$di->set ( 'modelsMetadata', function () use($config) {
	return new MetaDataAdapter ( array (
			'metaDataDir' => $config->application->cacheDir . 'metaData/' 
	) );
} );

$di->set ( 'session', function () {
	$session = new SessionAdapter ( array (
			'uniqueId' => 'cpdnapi' 
	) );
	$session->start ();
	return $session;
} );

$di->set ( 'crypt', function () use($config) {
	$crypt = new Crypt ();
	$crypt->setKey ( $config->application->cryptSalt );<commit_msg>changed db config init in services;<commit_after><?php
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\View;
use Phalcon\Crypt;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Http\Response\Cookies;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use Phalcon\Mvc\View\Engine\Volt as VoltEngine;
use Phalcon\Mvc\Model\Metadata\Files as MetaDataAdapter;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Flash\Direct as FlashDirect;
use Phalcon\Flash\Session as FlashSession;
use Phalcon\Events\Manager as EventsManager;
use CpdnAPI\Plugins\NotFoundPlugin;
use CpdnAPI\Mail\Mail;

$di = new FactoryDefault ();

$di->set ( 'config', $config );

$di->set ( 'dispatcher', function () use($di) {
	$eventsManager = new EventsManager ();
	$eventsManager->attach ( 'dispatch:beforeException', new NotFoundPlugin () );
	$dispatcher = new Dispatcher ();
	$dispatcher->setDefaultNamespace ( 'CpdnAPI\Controllers' );
	$dispatcher->setEventsManager ( $eventsManager );
	return $dispatcher;
} );

$di->set ( 'url', function () use($config) {
	$url = new UrlResolver ();
	$url->setBaseUri ( $config->application->baseUri );
	return $url;
}, true );

$di->set ( 'view', function () {
	$view = new View ();
	return $view;
}, true );

$di->set ( 'db-network', function () use($config) {
	return new DbAdapter ( array (
			'host' => $config->database->network->host,
			'username' => $config->database->network->username,
			'password' => $config->database->network->password,
			'dbname' => $config->database->network->name,
			'charset' => $config->database->network->charset 
	) );
} );

$di->set ( 'db-background', function () use($config) {
	return new DbAdapter ( array (
			'host' => $config->database->background->host,
			'username' => $config->database->background->username,
			'password' => $config->database->background->password,
			'dbname' => $config->database->background->name,
			'charset' => $config->database->background->charset 
	) );
} );

$di->set ( 'db-idp', function () use($config) {
	return new DbAdapter ( array (
			'host' => $config->database->idp->host,
			'username' => $config->database->idp->username,
			'password' => $<PASSWORD>->idp->password,
			'dbname' => $config->database->idp->name,
			'charset' => $config->database->idp->charset 
	) );
} );

$di->set ( 'modelsMetadata', function () use($config) {
	return new MetaDataAdapter ( array (
			'metaDataDir' => $config->application->cacheDir . 'metaData/' 
	) );
} );

$di->set ( 'session', function () {
	$session = new SessionAdapter ( array (
			'uniqueId' => 'cpdnapi' 
	) );
	$session->start ();
	return $session;
} );

$di->set ( 'crypt', function () use($config) {
	$crypt = new Crypt ();
	$crypt->setKey ( $config->application->cryptSalt );
{'fraction_non_alphanumeric': 0.18471470220741357, 'fraction_numerical': 0.0, 'mean_word_length': 4.67060212514758, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 129, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5902953', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1603, 'n_words': 329}