Code Duplication    Length = 25-30 lines in 2 locations

core/services/editor/BlockRegistrationManager.php 1 location

@@ 123-147 (lines=25) @@
120
     * @throws CollectionLoaderException
121
     * @throws CollectionDetailsException
122
     */
123
    protected function populateBlockCollection()
124
    {
125
        $loader = new CollectionLoader(
126
            new CollectionDetails(
127
                // collection name
128
                'editor_blocks',
129
                // collection interface
130
                'EventEspresso\core\domain\entities\editor\BlockInterface',
131
                // FQCNs for classes to add (all classes within each namespace will be loaded)
132
                apply_filters(
133
                    'FHEE__EventEspresso_core_services_editor_BlockManager__populateBlockCollection__collection_FQCNs',
134
                    array('EventEspresso\core\domain\entities\editor\blocks')
135
                ),
136
                // filepaths to classes to add
137
                array(),
138
                // file mask to use if parsing folder for files to add
139
                '',
140
                // what to use as identifier for collection entities
141
                // using CLASS NAME prevents duplicates (works like a singleton)
142
                CollectionDetails::ID_CLASS_NAME
143
            ),
144
            $this->blocks
145
        );
146
        return $loader->getCollection();
147
    }
148
149
150
    /**

core/services/routing/RouteMatchSpecificationManager.php 1 location

@@ 74-103 (lines=30) @@
71
     * @throws CollectionDetailsException
72
     * @since 4.9.71.p
73
     */
74
    private function populateSpecificationCollection()
75
    {
76
        $loader = new CollectionLoader(
77
            new CollectionDetails(
78
                // collection name
79
                RouteMatchSpecificationCollection::COLLECTION_NAME,
80
                // collection interface
81
                'EventEspresso\core\domain\entities\routing\specifications\RouteMatchSpecificationInterface',
82
                // FQCNs for classes to add (all classes within each namespace will be loaded)
83
                apply_filters(
84
                    'FHEE__EventEspresso_core_services_route_match_RouteMatchSpecificationManager__populateSpecificationCollection__collection_FQCNs',
85
                    array(
86
                        'EventEspresso\core\domain\entities\routing\specifications\admin',
87
                        'EventEspresso\core\domain\entities\routing\specifications\frontend',
88
                    )
89
                ),
90
                // filepaths to classes to add
91
                array(),
92
                // file mask to use if parsing folder for files to add
93
                '',
94
                // what to use as identifier for collection entities
95
                // using CLASS NAME prevents duplicates (works like a singleton)
96
                CollectionDetails::ID_CLASS_NAME
97
            ),
98
            $this->specifications,
99
            null,
100
            $this->specifications_factory
101
        );
102
        return $loader->getCollection();
103
    }
104
105
106
    /**