3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
7
+
6
8
namespace Magento \Sitemap \Model ;
7
9
8
- use Exception ;
9
- use Magento \Sitemap \Model \EmailNotification as SitemapEmail ;
10
+ use Magento \Framework \App \Area ;
10
11
use Magento \Framework \App \Config \ScopeConfigInterface ;
11
- use Magento \Sitemap \Model \ResourceModel \ Sitemap \ Collection ;
12
+ use Magento \Sitemap \Model \EmailNotification as SitemapEmail ;
12
13
use Magento \Sitemap \Model \ResourceModel \Sitemap \CollectionFactory ;
13
14
use Magento \Store \Model \App \Emulation ;
14
15
use Magento \Store \Model \ScopeInterface ;
15
- use Magento \Framework \App \Area ;
16
16
17
17
/**
18
18
* Sitemap module observer
@@ -51,12 +51,12 @@ class Observer
51
51
/**
52
52
* Core store config
53
53
*
54
- * @var ScopeConfigInterface
54
+ * @var \Magento\Framework\App\Config\ ScopeConfigInterface
55
55
*/
56
56
private $ scopeConfig ;
57
57
58
58
/**
59
- * @var CollectionFactory
59
+ * @var \Magento\Sitemap\Model\ResourceModel\Sitemap\ CollectionFactory
60
60
*/
61
61
private $ collectionFactory ;
62
62
@@ -82,20 +82,18 @@ public function __construct(
82
82
CollectionFactory $ collectionFactory ,
83
83
SitemapEmail $ emailNotification ,
84
84
Emulation $ appEmulation
85
-
86
85
) {
87
86
$ this ->scopeConfig = $ scopeConfig ;
88
87
$ this ->collectionFactory = $ collectionFactory ;
89
88
$ this ->emailNotification = $ emailNotification ;
90
89
$ this ->appEmulation = $ appEmulation ;
91
-
92
90
}
93
91
94
92
/**
95
93
* Generate sitemaps
96
94
*
97
95
* @return void
98
- * @throws Exception
96
+ * @throws \ Exception
99
97
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
100
98
*/
101
99
public function scheduledGenerateSitemaps ()
@@ -115,9 +113,9 @@ public function scheduledGenerateSitemaps()
115
113
}
116
114
117
115
$ collection = $ this ->collectionFactory ->create ();
118
- /* @var $collection Collection */
116
+ /* @var $collection \Magento\Sitemap\Model\ResourceModel\Sitemap\ Collection */
119
117
foreach ($ collection as $ sitemap ) {
120
- /* @var $sitemap Sitemap */
118
+ /* @var $sitemap \Magento\Sitemap\Model\ Sitemap */
121
119
try {
122
120
$ this ->appEmulation ->startEnvironmentEmulation (
123
121
$ sitemap ->getStoreId (),
@@ -126,7 +124,7 @@ public function scheduledGenerateSitemaps()
126
124
);
127
125
$ sitemap ->generateXml ();
128
126
$ this ->appEmulation ->stopEnvironmentEmulation ();
129
- } catch (Exception $ e ) {
127
+ } catch (\ Exception $ e ) {
130
128
$ errors [] = $ e ->getMessage ();
131
129
}
132
130
}
0 commit comments