forked from fastly/fastly-magento2
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathData.php
108 lines (100 loc) · 2.59 KB
/
Data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* Fastly CDN for Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Fastly CDN for Magento End User License Agreement
* that is bundled with this package in the file LICENSE_FASTLY_CDN.txt.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Fastly CDN to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to http://www.magento.com for more information.
*
* @category Fastly
* @package Fastly_Cdn
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
* @license BSD, see LICENSE_FASTLY_CDN.txt
*/
namespace Fastly\Cdn\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Framework\Module\ModuleListInterface;
use Magento\Store\Model\StoreManagerInterface;
/**
* Class Data
*
* @package Fastly\Cdn\Helper
*/
class Data extends AbstractHelper
{
const FASTLY_MODULE_NAME = 'Fastly_Cdn';
/**
* @var ModuleListInterface
*/
private $moduleList;
/**
* @var StoreManagerInterface
*/
private $storeManager;
/**
* Data constructor.
* @param Context $context
* @param ModuleListInterface $moduleList
* @param StoreManagerInterface $storeManager
*/
public function __construct(
Context $context,
ModuleListInterface $moduleList,
StoreManagerInterface $storeManager
) {
$this->moduleList = $moduleList;
$this->storeManager = $storeManager;
parent::__construct($context);
}
/**
* Return Fastly module version
*
* @return string
*/
public function getModuleVersion()
{
return $this->moduleList->getOne(self::FASTLY_MODULE_NAME)['setup_version'];
}
/**
* Return Store name
*
* @return string
*/
public function getStoreName()
{
return $this->storeManager->getStore()->getName();
}
/**
* Return Store URL
*
* @return mixed
*/
public function getStoreUrl()
{
return $this->storeManager->getStore()->getBaseUrl();
}
/**
* @return array
*/
public function getAvailableLogEndpointProviders()
{
return [
's3' => 'Amazon S3',
// 'elasticsearch' => 'Elasticsearch',
'bigquery' => 'Google BigQuery',
'gcs' => 'Google Cloud Storage',
'honeycomb' => 'Honeycomb',
'newrelic' => 'New Relic Logs',
'sumologic' => 'Sumologic',
'azureblob' => 'Azure Blob Storage'
];
}
}