Skip to content

Commit dba9c17

Browse files
committed
Drop support for PHP 7
1 parent c0626f6 commit dba9c17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+605
-1133
lines changed

Api/Data/LogInterface.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

Console/Command/CleanCommand.php

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,40 @@
11
<?php
2-
/*
3-
* Copyright © Ghost Unicorns snc. All rights reserved.
4-
* See LICENSE for license details.
2+
/**
3+
* Copyright © OpenGento, All rights reserved.
4+
* See LICENSE bundled with this library for license details.
55
*/
66

77
declare(strict_types=1);
88

9-
namespace GhostUnicorns\WebapiLogs\Console\Command;
9+
namespace Opengento\WebapiLogger\Console\Command;
1010

11-
use GhostUnicorns\WebapiLogs\Model\Clean;
11+
use Magento\Framework\Console\Cli;
12+
use Magento\Framework\Exception\LocalizedException;
13+
use Opengento\WebapiLogger\Model\Clean;
1214
use Symfony\Component\Console\Command\Command;
1315
use Symfony\Component\Console\Input\InputInterface;
1416
use Symfony\Component\Console\Output\OutputInterface;
1517

1618
class CleanCommand extends Command
1719
{
18-
/**
19-
* @var Clean
20-
*/
21-
private $clean;
22-
23-
/**
24-
* @param Clean $clean
25-
* @param string $name
26-
*/
27-
public function __construct(
28-
Clean $clean,
29-
string $name = 'webapilogs:clean'
30-
) {
31-
$this->clean = $clean;
32-
parent::__construct($name);
20+
public function __construct(private Clean $clean)
21+
{
22+
parent::__construct('webapilogs:clean');
3323
}
3424

35-
/**
36-
* @inheritDoc
37-
*/
38-
protected function configure()
25+
protected function configure(): void
3926
{
40-
$this->setDescription('WebapiLogs Cleaner');
27+
$this->setDescription('WebapiLogger Cleaner');
4128
parent::configure();
4229
}
4330

4431
/**
45-
* @param InputInterface $input
46-
* @param OutputInterface $output
47-
* @throws \Exception
32+
* @throws LocalizedException
4833
*/
49-
protected function execute(InputInterface $input, OutputInterface $output)
34+
protected function execute(InputInterface $input, OutputInterface $output): int
5035
{
51-
$this->clean->execute();
36+
$this->clean->clean();
37+
38+
return Cli::RETURN_SUCCESS;
5239
}
5340
}
Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,39 @@
11
<?php
2-
/*
3-
* Copyright © Ghost Unicorns snc. All rights reserved.
4-
* See LICENSE for license details.
2+
/**
3+
* Copyright © OpenGento, All rights reserved.
4+
* See LICENSE bundled with this library for license details.
55
*/
66

77
declare(strict_types=1);
88

9-
namespace GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports;
9+
namespace Opengento\WebapiLogger\Controller\Adminhtml\Reports;
1010

1111
use Exception;
12-
use GhostUnicorns\WebapiLogs\Model\Log\Logger;
13-
use GhostUnicorns\WebapiLogs\Model\Clean;
12+
use Magento\Framework\Controller\Result\Redirect;
13+
use Opengento\WebapiLogger\Model\Clean;
1414
use Magento\Backend\App\Action;
1515
use Magento\Backend\App\Action\Context;
16-
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
17-
use Magento\Framework\View\Result\PageFactory;
16+
use Magento\Framework\App\Action\HttpGetActionInterface;
1817

1918
class Delete extends Action implements HttpGetActionInterface
2019
{
21-
/**
22-
* Authorization level of a basic admin session
23-
*/
24-
const ADMIN_RESOURCE = 'GhostUnicorns_WebapiLogs::reports_webapilogs';
20+
public const ADMIN_RESOURCE = 'Opengento_WebapiLogger::reports_webapilogs';
2521

26-
/**
27-
* @var PageFactory
28-
*/
29-
protected $resultPageFactory;
30-
31-
/**
32-
* @var Clean
33-
*/
34-
private $clean;
35-
36-
/**
37-
* @var Logger
38-
*/
39-
private $logger;
40-
41-
/**
42-
* @param Context $context
43-
* @param PageFactory $resultPageFactory
44-
* @param LogCollectionFactory $logCollectionFactory
45-
* @param Logger $logger
46-
*/
4722
public function __construct(
4823
Context $context,
49-
PageFactory $resultPageFactory,
50-
Clean $clean,
51-
Logger $logger
24+
private Clean $clean
5225
) {
5326
parent::__construct($context);
54-
$this->resultPageFactory = $resultPageFactory;
55-
$this->clean = $clean;
56-
$this->logger = $logger;
5727
}
5828

59-
/**
60-
* @inheritDoc
61-
*/
62-
public function execute()
29+
public function execute(): Redirect
6330
{
6431
try {
6532
$this->clean->cleanAll();
66-
} catch (Exception $exception) {
67-
$this->logger->error(__('Cant delete webapi log because of error: %1', $exception->getMessage()));
33+
} catch (Exception $e) {
34+
$this->messageManager->addExceptionMessage($e);
6835
}
6936

70-
$resultRedirect = $this->resultRedirectFactory->create();
71-
return $resultRedirect->setPath('*/*/index', ['_current' => true]);
37+
return $this->resultRedirectFactory->create()->setPath('*/*/index', ['_current' => true]);
7238
}
7339
}
Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,36 @@
11
<?php
2-
/*
3-
* Copyright © Ghost Unicorns snc. All rights reserved.
4-
* See LICENSE for license details.
2+
/**
3+
* Copyright © OpenGento, All rights reserved.
4+
* See LICENSE bundled with this library for license details.
55
*/
66

77
declare(strict_types=1);
88

9-
namespace GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports;
9+
namespace Opengento\WebapiLogger\Controller\Adminhtml\Reports;
1010

1111
use Magento\Backend\App\Action;
1212
use Magento\Backend\App\Action\Context;
13-
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
14-
use Magento\Framework\Controller\ResultInterface;
13+
use Magento\Framework\App\Action\HttpGetActionInterface;
1514
use Magento\Framework\View\Result\Page;
1615
use Magento\Framework\View\Result\PageFactory;
1716

1817
class Detail extends Action implements HttpGetActionInterface
1918
{
20-
/**
21-
* Authorization level of a basic admin session
22-
*/
23-
const ADMIN_RESOURCE = 'GhostUnicorns_WebapiLogs::reports_webapilogs';
19+
public const ADMIN_RESOURCE = 'Opengento_WebapiLogger::reports_webapilogs';
2420

25-
/**
26-
* @var bool|PageFactory
27-
*/
28-
protected $resultPageFactory = false;
29-
30-
/**
31-
* @param Context $context
32-
* @param PageFactory $resultPageFactory
33-
*/
3421
public function __construct(
3522
Context $context,
36-
PageFactory $resultPageFactory
23+
private PageFactory $resultPageFactory
3724
) {
3825
parent::__construct($context);
39-
$this->resultPageFactory = $resultPageFactory;
4026
}
4127

42-
/**
43-
* @return Page|ResultInterface
44-
*/
45-
public function execute()
28+
public function execute(): Page
4629
{
4730
$resultPage = $this->resultPageFactory->create();
48-
$resultPage->setActiveMenu('GhostUnicorns_WebapiLogs::reports');
31+
$resultPage->setActiveMenu('Opengento_WebapiLogger::reports');
4932
$resultPage->getConfig()->getTitle()->prepend(__('Webapi REST api logs'));
33+
5034
return $resultPage;
5135
}
5236
}
Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,36 @@
11
<?php
2-
/*
3-
* Copyright © Ghost Unicorns snc. All rights reserved.
4-
* See LICENSE for license details.
2+
/**
3+
* Copyright © OpenGento, All rights reserved.
4+
* See LICENSE bundled with this library for license details.
55
*/
66

77
declare(strict_types=1);
88

9-
namespace GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports;
9+
namespace Opengento\WebapiLogger\Controller\Adminhtml\Reports;
1010

1111
use Magento\Backend\App\Action;
1212
use Magento\Backend\App\Action\Context;
13-
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
14-
use Magento\Framework\Controller\ResultInterface;
13+
use Magento\Framework\App\Action\HttpGetActionInterface;
1514
use Magento\Framework\View\Result\Page;
1615
use Magento\Framework\View\Result\PageFactory;
1716

1817
class Index extends Action implements HttpGetActionInterface
1918
{
20-
/**
21-
* Authorization level of a basic admin session
22-
*/
23-
const ADMIN_RESOURCE = 'GhostUnicorns_WebapiLogs::reports_webapilogs';
19+
public const ADMIN_RESOURCE = 'Opengento_WebapiLogger::reports_webapilogs';
2420

25-
/**
26-
* @var bool|PageFactory
27-
*/
28-
protected $resultPageFactory = false;
29-
30-
/**
31-
* @param Context $context
32-
* @param PageFactory $resultPageFactory
33-
*/
3421
public function __construct(
3522
Context $context,
36-
PageFactory $resultPageFactory
23+
private PageFactory $resultPageFactory
3724
) {
3825
parent::__construct($context);
39-
$this->resultPageFactory = $resultPageFactory;
4026
}
4127

42-
/**
43-
* @return Page|ResultInterface
44-
*/
45-
public function execute()
28+
public function execute(): Page
4629
{
4730
$resultPage = $this->resultPageFactory->create();
48-
$resultPage->setActiveMenu('GhostUnicorns_WebapiLogs::reports');
31+
$resultPage->setActiveMenu('Opengento_WebapiLogger::reports');
4932
$resultPage->getConfig()->getTitle()->prepend(__('Webapi REST api logs'));
33+
5034
return $resultPage;
5135
}
5236
}

Cron/CleanCron.php

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,25 @@
11
<?php
2-
/*
3-
* Copyright © Ghost Unicorns snc. All rights reserved.
4-
* See LICENSE for license details.
2+
/**
3+
* Copyright © OpenGento, All rights reserved.
4+
* See LICENSE bundled with this library for license details.
55
*/
66

77
declare(strict_types=1);
88

9-
namespace GhostUnicorns\WebapiLogs\Cron;
9+
namespace Opengento\WebapiLogger\Cron;
1010

11-
use Exception;
12-
use GhostUnicorns\WebapiLogs\Model\Clean;
11+
use Magento\Framework\Exception\LocalizedException;
12+
use Opengento\WebapiLogger\Model\Clean;
1313

1414
class CleanCron
1515
{
16-
/**
17-
* @var Clean
18-
*/
19-
private $clean;
20-
21-
/**
22-
* @param Clean $clean
23-
*/
24-
public function __construct(
25-
Clean $clean
26-
) {
27-
$this->clean = $clean;
28-
}
16+
public function __construct(private Clean $clean) {}
2917

3018
/**
31-
* @throws Exception
19+
* @throws LocalizedException
3220
*/
33-
public function execute()
21+
public function execute(): void
3422
{
35-
$this->clean->execute();
23+
$this->clean->clean();
3624
}
3725
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Ghost Unicorns snc di Ugolini Riccardo e Argentiero Danilo
3+
Copyright (c) OpenGento
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)