Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReportUrlProvider.php
Go to the documentation of this file.
1 <?php
7 
13 
18 {
24  private $analyticsToken;
25 
31  private $otpRequest;
32 
36  private $config;
37 
41  private $flagManager;
42 
48  private $urlReportConfigPath = 'analytics/url/report';
49 
56  public function __construct(
57  AnalyticsToken $analyticsToken,
58  OTPRequest $otpRequest,
59  ScopeConfigInterface $config,
60  FlagManager $flagManager
61  ) {
62  $this->analyticsToken = $analyticsToken;
63  $this->otpRequest = $otpRequest;
64  $this->config = $config;
65  $this->flagManager = $flagManager;
66  }
67 
74  public function getUrl()
75  {
76  if ($this->flagManager->getFlagData(SubscriptionUpdateHandler::PREVIOUS_BASE_URL_FLAG_CODE)) {
78  'Your Base URL has been changed and your reports are being updated. '
79  . 'Advanced Reporting will be available once this change has been processed. Please try again later.'
80  ));
81  }
82 
83  $url = $this->config->getValue($this->urlReportConfigPath);
84  if ($this->analyticsToken->isTokenExist()) {
85  $otp = $this->otpRequest->call();
86  if ($otp) {
87  $query = http_build_query(['otp' => $otp], '', '&');
88  $url .= '?' . $query;
89  }
90  }
91 
92  return $url;
93  }
94 }
__construct(AnalyticsToken $analyticsToken, OTPRequest $otpRequest, ScopeConfigInterface $config, FlagManager $flagManager)
$config
Definition: fraud_order.php:17
__()
Definition: __.php:13