<commit_before><?php
/**
 * Created by PhpStorm.
 * User: fenikkusu
 * Date: 9/4/18
 * Time: 10:19 PM
 *//**
 * Copyright (C) 2018 Twister's Fury.
 * Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
 */

namespace TwistersFury\Phalcon\Shared\Di\ServiceProvider;

use Phalcon\Db\Adapter\Factory;
use Phalcon\Db\AdapterInterface;

class Database extends AbstractServiceProvider
{

    /**
     * Register Database(s) From Config
     *
     * @return \TwistersFury\Phalcon\Shared\Di\ServiceProvider\Database
     */
    protected function registerDatabases(): self
    {
        /** @var \Phalcon\Config $config */
        $config = $this->get('config');

        //Register Primary Config
        if ($config->has('database')) {
            $this->registerDatabase(
                'db',
                $config->database
            );
        };

        foreach ($config->databases ?? [] as $serviceName => $serviceConfig) {
            $this->registerDatabase(
                $serviceName,
                $serviceConfig
            );
        }

        return $this;
    }

    /**
     * Registers Specific Database.
     *
     * Note: Private So Normal Register Loop Does Not Hit<commit_msg>Debugging<commit_after><?php
/**
 * Created by PhpStorm.
 * User: fenikkusu
 * Date: 9/4/18
 * Time: 10:19 PM
 *//**
 * Copyright (C) 2018 Twister's Fury.
 * Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
 */

namespace TwistersFury\Phalcon\Shared\Di\ServiceProvider;

use Phalcon\Db\Adapter\Factory;
use Phalcon\Db\AdapterInterface;

class Database extends AbstractServiceProvider
{

    /**
     * Register Database(s) From Config
     *
     * @return \TwistersFury\Phalcon\Shared\Di\ServiceProvider\Database
     */
    protected function registerDatabases(): self
    {
        /** @var \Phalcon\Config $config */
        $config = $this->get('config');

        //Register Primary Config
        if ($config->get('database')) {
            $this->registerDatabase(
                'db',
                $config->database
            );
        };

        foreach ($config->databases ?? [] as $serviceName => $serviceConfig) {
            $this->registerDatabase(
                $serviceName,
                $serviceConfig
            );
        }

        return $this;
    }

    /**
     * Registers Specific Database.
     *
     * Note: Private So Normal Register Loop Does Not Hit
{'fraction_non_alphanumeric': 0.1247987117552335, 'fraction_numerical': 0.00966183574879227, 'mean_word_length': 2.0641183723797782, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5090449', 'n_tokens_mistral': 734, 'n_tokens_neox': 689, 'n_words': 161}