<commit_before><?php
/**
 * ZnZend
 *
 * @author <NAME> <<EMAIL>>
 * @link   [Source] http://github.com/zionsg/ZnZend
 */
namespace ZnZend;

class Module
{
    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig($env = null)
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getServiceConfig()
    {
        return array(
            'initializers' => array(
                function ($instance, $sm) {
                    // Sets default db adapter
                    if ($instance instanceof \Zend\Db\Adapter\AdapterAwareInterface) {
                        $instance->setDbAdapter($sm->get('Zend\Db\Adapter\Adapter'));
                    }
                }
            ),
        );
    }
}<commit_msg>Add comments on use of 'initializer' key.<commit_after><?php
/**
 * ZnZend
 *
 * @author <NAME> <<EMAIL>>
 * @link   [Source] http://github.com/zionsg/ZnZend
 */
namespace ZnZend;

class Module
{
    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig($env = null)
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getServiceConfig()
    {
        return array(
            // Any object pulled from a service manager is ran through the registered initializers
            'initializers' => array(
                function ($instance, $sm) {
                    // Sets default db adapter
                    // Instance needs to implement the interface and be pulled from a service manager for this to work
                    // Example in controller action:
                    //     $userTable = $this->getServiceLocator()->get('Application\Model\UserTable');
                    if ($instance instanceof \Zend\Db\Adapter\AdapterAwareInterface) {
                        $instance->setDbAdapter($sm->get('Zend\Db\Adapter\Adapter'));
                    }
                }
            ),
        );
    }
}
{'fraction_non_alphanumeric': 0.1159062885326757, 'fraction_numerical': 0.0, 'mean_word_length': 1.522279792746114, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, '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': '3156203', 'n_tokens_mistral': 661, 'n_tokens_neox': 635, 'n_words': 146}