<commit_before><?php
/**
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @since         CakePHP(tm) v 0.10.x.1402
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Database;

use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\StaticConfigTrait;
use Cake\Database\Connection;
use Cake\Database\ConnectionRegistry;
use Cake\Error;

/**
 * Manages and loads instances of Connection
 *
 * Provides an interface to loading and creating connection objects. Acts as
 * a registry for the connections defined in an application.
 *
 * Provides an interface for loading and enumerating connections defined in
 * app/Config/datasources.php
 */
class ConnectionManager {

	use StaticConfigTrait {
		config as protected _config;
	}

/**
 * Holds a list of connection configurations
 *
 * @var array
 */
	protected static $_config = [];

/**
 * The ConnectionRegistry used by the manager.
 *
 * @var Cake\Database\ConnectionRegistry
 */
	protected static $_registry = null;

/**
 * Configure a new connection object.
 *
 * The connection will not be constructed until it is first used.
 *
 * @see Cake\Core\StaticConfigTrait::config()
 *
 * @param string|array $key The name of the connection config, or an array of multiple configs.
 * @param array $config An array of name => config data for adapter.
 * @return mixed null when adding configuration and an array of configuration data when reading.
 * @throws Cake\Error\Exception When trying to modify an existing config.
 */
	public static function config($key, $config = null) {
		if (is_array($config)) {
			$config['name'] = $key;
		}
		return static::_config($key, $config);
	}

/**
 * Get a connection.
 *
 * If the connection has not been constructed an instance will be added
 * to the registry.
 *
 * @param string $name The connection name.
 * @return Connection A connection object.
 * @throws Cake\Error\MissingDataSourceConfigException When config data is missing.
 */
	public static function get($name) {
		if (empty(static::$_config[$name])) {
			throw new Error\MissingDataSourceConfigException(['name' => $name]);
		}
		if (empty(static::$_registry)) {
			static::$_registry = new ConnectionRegistry();
		}
		if (isset(static::$_registry->{$name})) {
			return static::$_registry->{$name};
		}<commit_msg>Fix typo in Database/ConnectionManager<commit_after><?php
/**
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @since         CakePHP(tm) v 0.10.x.1402
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Database;

use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\StaticConfigTrait;
use Cake\Database\Connection;
use Cake\Database\ConnectionRegistry;
use Cake\Error;

/**
 * Manages and loads instances of Connection
 *
 * Provides an interface to loading and creating connection objects. Acts as
 * a registry for the connections defined in an application.
 *
 * Provides an interface for loading and enumerating connections defined in
 * app/Config/datasources.php
 */
class ConnectionManager {

	use StaticConfigTrait {
		config as protected _config;
	}

/**
 * Holds a list of connection configurations
 *
 * @var array
 */
	protected static $_config = [];

/**
 * The ConnectionRegistry used by the manager.
 *
 * @var Cake\Database\ConnectionRegistry
 */
	protected static $_registry = null;

/**
 * Configure a new connection object.
 *
 * The connection will not be constructed until it is first used.
 *
 * @see Cake\Core\StaticConfigTrait::config()
 *
 * @param string|array $key The name of the connection config, or an array of multiple configs.
 * @param array $config An array of name => config data for adapter.
 * @return mixed null when adding configuration and an array of configuration data when reading.
 * @throws Cake\Error\Exception When trying to modify an existing config.
 */
	public static function config($key, $config = null) {
		if (is_array($config)) {
			$config['name'] = $key;
		}
		return static::_config($key, $config);
	}

/**
 * Get a connection.
 *
 * If the connection has not been constructed an instance will be added
 * to the registry.
 *
 * @param string $name The connection name.
 * @return Connection A connection object.
 * @throws Cake\Error\MissingDatasourceConfigException When config data is missing.
 */
	public static function get($name) {
		if (empty(static::$_config[$name])) {
			throw new Error\MissingDatasourceConfigException(['name' => $name]);
		}
		if (empty(static::$_registry)) {
			static::$_registry = new ConnectionRegistry();
		}
		if (isset(static::$_registry->{$name})) {
			return static::$_registry->{$name};
		}
{'fraction_non_alphanumeric': 0.11179338992234061, 'fraction_numerical': 0.0028896514357955572, 'mean_word_length': 3.9579230080572962, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3855473', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1512, 'n_words': 555}