Code Duplication    Length = 49-50 lines in 2 locations

src/RunOpenCode/Bundle/DoctrineNamingStrategy/DependencyInjection/Configuration.php 2 locations

@@ 38-86 (lines=49) @@
35
    /**
36
     * Configure underscored bundle prefix naming strategy
37
     */
38
    private function getUnderscoredBundlePrefixDefinition(): ArrayNodeDefinition
39
    {
40
        $node = new ArrayNodeDefinition('underscored_bundle_prefix');
41
42
        /**
43
         * @psalm-suppress all
44
         */
45
        $node
46
            ->addDefaultsIfNotSet()
47
            ->children()
48
                ->enumNode('case')
49
                    ->info('Which case to use, lowercase or uppercase. Default is lowercase.')
50
                    ->values(array('lowercase', 'uppercase'))
51
                    ->defaultValue('lowercase')
52
                ->end()
53
                ->booleanNode('join_table_field_suffix')
54
                    ->defaultTrue()
55
                    ->info('Join table will get field name suffix enabling you to have multiple many-to-many relations without stating explicitly table names.')
56
                ->end()
57
                ->arrayNode('map')
58
                    ->info('Map of short bundle names and prefixes, if you do not want to use full bundle name in prefix. Useful when bundle name is too long, considering that, per example, MySQL has 60 chars table name limit.')
59
                    ->useAttributeAsKey('bundle')
60
                    ->prototype('scalar')->end()
61
                ->end()
62
                ->arrayNode('whitelist')
63
                    ->beforeNormalization()
64
                        ->ifString()
65
                        ->then(static function ($value) {
66
                            return [$value];
67
                        })
68
                        ->end()
69
                    ->info('Define for which bundles to apply prefixes.')
70
                    ->prototype('scalar')->end()
71
                ->end()
72
                ->arrayNode('blacklist')
73
                    ->beforeNormalization()
74
                        ->ifString()
75
                        ->then(static function ($value) {
76
                            return [$value];
77
                        })
78
                    ->end()
79
                    ->info('Define for which bundles not to apply prefixes.')
80
                    ->prototype('scalar')->end()
81
                ->end()
82
            ->end()
83
        ->end();
84
85
        return $node;
86
    }
87
88
    /**
89
     * Configure underscored class namespace prefix naming strategy
@@ 91-140 (lines=50) @@
88
    /**
89
     * Configure underscored class namespace prefix naming strategy
90
     */
91
    private function getUnderscoredClassNamespacePrefixDefinition(): ArrayNodeDefinition
92
    {
93
        $node = new ArrayNodeDefinition('underscored_class_namespace_prefix');
94
95
        /**
96
         * @psalm-suppress all
97
         */
98
        $node
99
            ->addDefaultsIfNotSet()
100
            ->children()
101
                ->enumNode('case')
102
                    ->info('Which case to use, lowercase or uppercase. Default is lowercase.')
103
                    ->values(array('lowercase', 'uppercase'))
104
                    ->defaultValue('lowercase')
105
                ->end()
106
                ->booleanNode('join_table_field_suffix')
107
                    ->defaultTrue()
108
                    ->info('Join table will get field name suffix enabling you to have multiple many-to-many relations without stating explicitly table names.')
109
                ->end()
110
                ->arrayNode('map')
111
                    ->requiresAtLeastOneElement()
112
                    ->info('Map of FQCNs prefixes and table prefixes to use for naming.')
113
                    ->useAttributeAsKey('namespace')
114
                    ->prototype('scalar')->end()
115
                ->end()
116
                ->arrayNode('whitelist')
117
                    ->beforeNormalization()
118
                        ->ifString()
119
                        ->then(static function ($value) {
120
                            return [$value];
121
                        })
122
                    ->end()
123
                    ->info('Define for which FQCNs prefixes table prefixes should be applied.')
124
                    ->prototype('scalar')->end()
125
                ->end()
126
                ->arrayNode('blacklist')
127
                    ->beforeNormalization()
128
                        ->ifString()
129
                        ->then(static function ($value) {
130
                            return [$value];
131
                        })
132
                    ->end()
133
                    ->info('Define for which FQCNs prefixes not to apply table prefixes.')
134
                    ->prototype('scalar')->end()
135
                ->end()
136
            ->end()
137
        ->end();
138
139
        return $node;
140
    }
141
142
    /**
143
     * Configure namer collection