1
1
<?php
2
- /**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details.
5
- */
6
2
declare (strict_types=1 );
7
3
8
4
namespace Magento \Csp \Model \Mode ;
11
7
use Magento \Framework \App \ObjectManager ;
12
8
use Magento \Csp \Api \Data \ModeConfiguredInterface ;
13
9
use Magento \Csp \Api \ModeConfigManagerInterface ;
14
- use Magento \Csp \Model \Mode \Data \ModeConfigured ;
15
10
use Magento \Framework \App \Area ;
16
11
use Magento \Framework \App \Config \ScopeConfigInterface ;
17
12
use Magento \Framework \App \State ;
18
13
use Magento \Store \Model \ScopeInterface ;
19
14
use Magento \Store \Model \Store ;
20
15
21
- /**
22
- * @inheritDoc
23
- */
24
16
class ConfigManager implements ModeConfigManagerInterface
25
17
{
26
18
/**
@@ -43,29 +35,32 @@ class ConfigManager implements ModeConfigManagerInterface
43
35
*/
44
36
private Http $ request ;
45
37
38
+ /**
39
+ * @var ModeConfiguredInterface
40
+ */
41
+ private $ modeConfigured ;
42
+
46
43
/**
47
44
* @param ScopeConfigInterface $config
48
45
* @param Store $store
49
46
* @param State $state
50
47
* @param Http|null $request
48
+ * @param ModeConfiguredInterface|null $modeConfigured
51
49
*/
52
50
public function __construct (
53
51
ScopeConfigInterface $ config ,
54
52
Store $ store ,
55
53
State $ state ,
56
- ?Http $ request = null
54
+ ?Http $ request = null ,
55
+ ModeConfiguredInterface $ modeConfigured = null
57
56
) {
58
57
$ this ->config = $ config ;
59
58
$ this ->storeModel = $ store ;
60
59
$ this ->state = $ state ;
61
-
62
- $ this ->request = $ request
63
- ?? ObjectManager::getInstance ()->get (Http::class);
60
+ $ this ->request = $ request ?? ObjectManager::getInstance ()->get (Http::class);
61
+ $ this ->modeConfigured = $ modeConfigured ?? ObjectManager::getInstance ()->get (ModeConfigured::class);
64
62
}
65
63
66
- /**
67
- * @inheritDoc
68
- */
69
64
public function getConfigured (): ModeConfiguredInterface
70
65
{
71
66
$ area = $ this ->state ->getAreaCode ();
@@ -118,7 +113,7 @@ public function getConfigured(): ModeConfiguredInterface
118
113
);
119
114
}
120
115
121
- return new ModeConfigured (
116
+ return $ this -> modeConfigured -> setData (
122
117
(bool ) $ reportOnly ,
123
118
!empty ($ reportUri ) ? $ reportUri : null
124
119
);
0 commit comments