<commit_before>/**
 * @author <NAME> <<EMAIL>>
 * @copyright Apestaartje <http://apestaartje.info>
 */

import {Bundle} from 'framework/bundle/Bundle';
import {FormBuilder} from 'bundles/form/builder/FormBuilder';

/**
 * @class FormBundle
 */
export class FormBundle extends Bundle {
    /**
     * @returns {void}
     */
    boot() {
        let formBuilderService = this.container.findDefinition('form_builder_formbuilder'),
            serviceIds = this.container.findTaggedServiceIds('form_field');

        serviceIds.forEach((serviceId) => {
            let fieldType = this.container.findDefinition(serviceId);

            formBuilderService.addMethodCall('addFieldType', [fieldType]);
        });
    }

    /**
     * @returns {void}
     */
    registerServices() {
        this.container.register('formBuilder', function () {
            return new FormBuilder();
        }, false);
    }
}<commit_msg>service definitions added to FormBundle<commit_after>/**
 * @author <NAME> <<EMAIL>>
 * @copyright Apestaartje <http://apestaartje.info>
 */

import {Bundle} from 'framework/bundle/Bundle';
import {FieldTypes} from 'bundles/form/field/FieldTypes';
import {FormBuilder} from 'bundles/form/builder/FormBuilder';
import {TextField} from 'bundles/form/field/TextField';

/**
 * @class FormBundle
 */
export class FormBundle extends Bundle {
    /**
     * @returns {void}
     */
    boot() {
        let formTypes = this.container.findDefinition('fieldTypes'),
            serviceIds = this.container.findTaggedServiceIds('form_field');

        serviceIds.forEach((serviceId) => {
            let fieldType = this.container.findDefinition(serviceId);

            formTypes.addMethodCall('add', [serviceId, fieldType]);
        });
    }

    /**
     * @returns {void}
     */
    registerServices() {
        this.container.register('fieldTypes', function () {
            return new FieldTypes();
        }, true);

        this.container.register('formBuilder', function (fieldTypes) {
            return function (options) {
                return new FormBuilder(options, fieldTypes);
            };
        }, false);

        this.container.register('formTextField', function (templateFactory) {
            return function (options) {
                return new TextField(options, templateFactory);
            };
        }, false, 'form_field');
    }
}
{'fraction_non_alphanumeric': 0.137147665124106, 'fraction_numerical': 0.0, 'mean_word_length': 2.6754250386398764, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2372635', 'n_tokens_mistral': 648, 'n_tokens_neox': 634, 'n_words': 126}