3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
6
7
7
8
/**
8
9
* Review reports admin controller
11
12
*/
12
13
namespace Magento \Reports \Controller \Adminhtml \Report ;
13
14
15
+ use Magento \Backend \App \Action ;
16
+ use Magento \Backend \App \Action \Context ;
17
+ use Magento \Framework \App \Response \Http \FileFactory ;
18
+
14
19
/**
20
+ * phpcs:disable Magento2.Classes.AbstractApi
15
21
* @api
16
22
* @since 100.0.2
17
23
*/
18
- abstract class Review extends \ Magento \ Backend \ App \ Action
24
+ abstract class Review extends Action
19
25
{
20
26
/**
21
- * @var \Magento\Framework\App\Response\Http\ FileFactory
27
+ * @var FileFactory
22
28
*/
23
29
protected $ _fileFactory ;
24
30
25
31
/**
26
- * @param \Magento\Backend\App\Action\ Context $context
27
- * @param \Magento\Framework\App\Response\Http\ FileFactory $fileFactory
32
+ * @param Context $context
33
+ * @param FileFactory $fileFactory
28
34
*/
29
35
public function __construct (
30
- \ Magento \ Backend \ App \ Action \ Context $ context ,
31
- \ Magento \ Framework \ App \ Response \ Http \ FileFactory $ fileFactory
36
+ Context $ context ,
37
+ FileFactory $ fileFactory
32
38
) {
33
39
$ this ->_fileFactory = $ fileFactory ;
34
40
parent ::__construct ($ context );
@@ -54,16 +60,20 @@ public function _initAction()
54
60
*/
55
61
protected function _isAllowed ()
56
62
{
57
- switch ($ this ->getRequest ()->getActionName ()) {
58
- case 'customer ' :
59
- return $ this ->_authorization ->isAllowed ('Magento_Reports::review_customer ' );
60
- break ;
61
- case 'product ' :
62
- return $ this ->_authorization ->isAllowed ('Magento_Reports::review_product ' );
63
- break ;
64
- default :
65
- return $ this ->_authorization ->isAllowed ('Magento_Reports::review ' );
66
- break ;
67
- }
63
+ return match ($ this ->getRequest ()->getActionName ()) {
64
+ 'exportCustomerCsv ' ,
65
+ 'exportCustomerExcel ' ,
66
+ 'customer ' =>
67
+ $ this ->_authorization ->isAllowed ('Magento_Reports::review_customer ' ),
68
+ 'exportProductCsv ' ,
69
+ 'exportProductExcel ' ,
70
+ 'exportProductDetailCsv ' ,
71
+ 'exportProductDetailExcel ' ,
72
+ 'productDetail ' ,
73
+ 'product ' =>
74
+ $ this ->_authorization ->isAllowed ('Magento_Reports::review_product ' ),
75
+ default =>
76
+ $ this ->_authorization ->isAllowed ('Magento_Reports::review ' ),
77
+ };
68
78
}
69
79
}
0 commit comments