@@ -70,6 +70,9 @@ protected function configure(): void
70
70
$ configurableCrawlerInterface = Crawler \ConfigurableCrawlerInterface::class;
71
71
$ textFormatter = Formatter \TextFormatter::getType ();
72
72
$ jsonFormatter = Formatter \JsonFormatter::getType ();
73
+ $ sortByChangeFrequencyStrategy = Crawler \Strategy \SortByChangeFrequencyStrategy::getName ();
74
+ $ sortByLastModificationDateStrategy = Crawler \Strategy \SortByLastModificationDateStrategy::getName ();
75
+ $ sortByPriorityStrategy = Crawler \Strategy \SortByPriorityStrategy::getName ();
73
76
74
77
$ this ->setDescription ('Warms up caches of URLs provided by a given set of XML sitemaps. ' );
75
78
$ this ->setHelp (<<<HELP
@@ -143,13 +146,13 @@ protected function configure(): void
143
146
URLs can be crawled using a specific crawling strategy, e.g. by sorting them by a specific property.
144
147
For this, use the <comment>--strategy</comment> option together with a predefined value:
145
148
146
- <comment>%command.full_name% --strategy sort-by-priority </comment>
149
+ <comment>%command.full_name% --strategy { $ sortByPriorityStrategy } </comment>
147
150
148
151
The following strategies are currently available:
149
152
150
- * <comment>sort-by-changefreq </comment>
151
- * <comment>sort-by-lastmod </comment>
152
- * <comment>sort-by-priority </comment>
153
+ * <comment> { $ sortByChangeFrequencyStrategy } </comment>
154
+ * <comment> { $ sortByLastModificationDateStrategy } </comment>
155
+ * <comment> { $ sortByPriorityStrategy } </comment>
153
156
154
157
<info>Allow failures</info>
155
158
<info>==============</info>
@@ -372,9 +375,9 @@ private function initializeCacheWarmer(
372
375
373
376
// Initialize crawling strategy
374
377
$ strategy = match ($ input ->getOption ('strategy ' )) {
375
- ' sort-by-changefreq ' => new Crawler \Strategy \SortByChangeFrequencyStrategy (),
376
- ' sort-by-lastmod ' => new Crawler \Strategy \SortByLastModificationDateStrategy (),
377
- ' sort-by-priority ' => new Crawler \Strategy \SortByPriorityStrategy (),
378
+ Crawler \ Strategy \SortByChangeFrequencyStrategy:: getName () => new Crawler \Strategy \SortByChangeFrequencyStrategy (),
379
+ Crawler \ Strategy \SortByLastModificationDateStrategy:: getName () => new Crawler \Strategy \SortByLastModificationDateStrategy (),
380
+ Crawler \ Strategy \SortByPriorityStrategy:: getName () => new Crawler \Strategy \SortByPriorityStrategy (),
378
381
null => null ,
379
382
default => throw new Console \Exception \RuntimeException ('The given crawling strategy is invalid. ' , 1677618007 ),
380
383
};
0 commit comments