Skip to content

Commit 1b21cb8

Browse files
committed
Add ObjectManager for class modeConfigured
1 parent ef81f5a commit 1b21cb8

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

app/code/Magento/Csp/Model/Mode/ConfigManager.php

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
<?php
2-
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
5-
*/
62
declare(strict_types=1);
73

84
namespace Magento\Csp\Model\Mode;
@@ -11,16 +7,12 @@
117
use Magento\Framework\App\ObjectManager;
128
use Magento\Csp\Api\Data\ModeConfiguredInterface;
139
use Magento\Csp\Api\ModeConfigManagerInterface;
14-
use Magento\Csp\Model\Mode\Data\ModeConfigured;
1510
use Magento\Framework\App\Area;
1611
use Magento\Framework\App\Config\ScopeConfigInterface;
1712
use Magento\Framework\App\State;
1813
use Magento\Store\Model\ScopeInterface;
1914
use Magento\Store\Model\Store;
2015

21-
/**
22-
* @inheritDoc
23-
*/
2416
class ConfigManager implements ModeConfigManagerInterface
2517
{
2618
/**
@@ -43,29 +35,32 @@ class ConfigManager implements ModeConfigManagerInterface
4335
*/
4436
private Http $request;
4537

38+
/**
39+
* @var ModeConfiguredInterface
40+
*/
41+
private $modeConfigured;
42+
4643
/**
4744
* @param ScopeConfigInterface $config
4845
* @param Store $store
4946
* @param State $state
5047
* @param Http|null $request
48+
* @param ModeConfiguredInterface|null $modeConfigured
5149
*/
5250
public function __construct(
5351
ScopeConfigInterface $config,
5452
Store $store,
5553
State $state,
56-
?Http $request = null
54+
?Http $request = null,
55+
ModeConfiguredInterface $modeConfigured = null
5756
) {
5857
$this->config = $config;
5958
$this->storeModel = $store;
6059
$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);
6462
}
6563

66-
/**
67-
* @inheritDoc
68-
*/
6964
public function getConfigured(): ModeConfiguredInterface
7065
{
7166
$area = $this->state->getAreaCode();
@@ -118,7 +113,7 @@ public function getConfigured(): ModeConfiguredInterface
118113
);
119114
}
120115

121-
return new ModeConfigured(
116+
return $this->modeConfigured->setData(
122117
(bool) $reportOnly,
123118
!empty($reportUri) ? $reportUri : null
124119
);

0 commit comments

Comments
 (0)