@@ -42,17 +42,15 @@ public static function detectURLsIter( bool $quiet = false ) : \Iterator {
4242
4343 $ filtering = new FileFiltering ();
4444
45- $ arrays_to_merge = [];
46-
47- $ arrays_to_merge [] = [
48- '/ ' ,
49- '/robots.txt ' ,
50- '/favicon.ico ' ,
51- '/sitemap.xml ' ,
52- ];
53-
5445 $ iterators_to_merge = [];
5546
47+ $ iterators_to_merge [] = new \ArrayIterator ( [
48+ [ 'url ' => '/ ' ],
49+ [ 'url ' => '/robots.txt ' ],
50+ [ 'url ' => '/favicon.ico ' ],
51+ [ 'url ' => '/sitemap.xml ' ],
52+ ] );
53+
5654 $ detect_parent_theme = apply_filters ( 'wp2static_detect_parent_theme ' , 1 );
5755
5856 if ( $ detect_parent_theme ) {
@@ -97,11 +95,11 @@ public static function detectURLsIter( bool $quiet = false ) : \Iterator {
9795 }
9896
9997 if ( CoreOptions::getValue ( 'detectPosts ' ) ) {
100- $ arrays_to_merge [] = DetectPostURLs::detect ( log: $ log_steps );
98+ $ iterators_to_merge [] = DetectPostURLs::detect ( log: $ log_steps );
10199 }
102100
103101 if ( CoreOptions::getValue ( 'detectPages ' ) ) {
104- $ arrays_to_merge [] = DetectPageURLs::detect ( log: $ log_steps );
102+ $ iterators_to_merge [] = DetectPageURLs::detect ( log: $ log_steps );
105103 }
106104
107105 if ( CoreOptions::getValue ( 'detectCustomPostTypes ' ) ) {
@@ -111,46 +109,42 @@ public static function detectURLsIter( bool $quiet = false ) : \Iterator {
111109 $ detect_posts_pagination = apply_filters ( 'wp2static_detect_posts_pagination ' , 1 );
112110
113111 if ( $ detect_posts_pagination ) {
114- $ arrays_to_merge [] = DetectPostsPaginationURLs::detect ( SiteInfo::getURL ( 'site ' ), log: $ log_steps );
112+ $ iterators_to_merge [] = DetectPostsPaginationURLs::detect ( SiteInfo::getURL ( 'site ' ), log: $ log_steps );
115113 }
116114
117115 $ detect_archives = apply_filters ( 'wp2static_detect_archives ' , 1 );
118116
119117 if ( $ detect_archives ) {
120- $ arrays_to_merge [] = DetectArchiveURLs::detect ( log: $ log_steps );
118+ $ iterators_to_merge [] = DetectArchiveURLs::detect ( log: $ log_steps );
121119 }
122120
123121 $ detect_categories = apply_filters ( 'wp2static_detect_categories ' , 1 );
124122
125123 if ( $ detect_categories ) {
126- $ arrays_to_merge [] = DetectCategoryURLs::detect ( log: $ log_steps );
124+ $ iterators_to_merge [] = DetectCategoryURLs::detect ( log: $ log_steps );
127125 }
128126
129127 $ detect_category_pagination = apply_filters ( 'wp2static_detect_category_pagination ' , 1 );
130128
131129 if ( $ detect_category_pagination ) {
132- $ arrays_to_merge [] = DetectCategoryPaginationURLs::detect ( log: $ log_steps );
130+ $ iterators_to_merge [] = DetectCategoryPaginationURLs::detect ( log: $ log_steps );
133131 }
134132
135133 $ detect_authors = apply_filters ( 'wp2static_detect_authors ' , 1 );
136134
137135 if ( $ detect_authors ) {
138- $ arrays_to_merge [] = DetectAuthorsURLs::detect ( log: $ log_steps );
136+ $ iterators_to_merge [] = DetectAuthorsURLs::detect ( log: $ log_steps );
139137 }
140138
141139 $ detect_authors_pagination = apply_filters ( 'wp2static_detect_authors_pagination ' , 1 );
142140
143141 if ( $ detect_authors_pagination ) {
144- $ arrays_to_merge [] = DetectAuthorPaginationURLs::detect ( SiteInfo::getUrl ( 'site ' ), log: $ log_steps );
142+ $ iterators_to_merge [] = DetectAuthorPaginationURLs::detect ( SiteInfo::getUrl ( 'site ' ), log: $ log_steps );
145143 }
146144
147145 $ home_url = SiteInfo::getUrl ( 'home ' );
148146 $ unique_urls = [];
149147
150- foreach ( $ arrays_to_merge as $ array ) {
151- $ iterators_to_merge [] = new \ArrayIterator ( $ array );
152- }
153-
154148 $ last_log_time = microtime ( true );
155149
156150 foreach ( $ iterators_to_merge as $ iter ) {
0 commit comments