From 36b95aced5aaeefde676bb56e850c4472ef0eecf Mon Sep 17 00:00:00 2001 From: Derrick Heesbeen Date: Wed, 15 Nov 2017 17:51:50 +0100 Subject: [PATCH] [TASK] psr-2 code formatting, MEQP2 code adjustments --- Block/Adminhtml/Forward/Edit.php | 6 +- Block/Adminhtml/Forward/Edit/Form.php | 4 +- Controller/Adminhtml/Emailcatcher/Cleanup.php | 13 +- Controller/Adminhtml/Emailcatcher/Forward.php | 9 +- Controller/Adminhtml/Emailcatcher/Index.php | 42 +++--- Controller/Adminhtml/Emailcatcher/Send.php | 13 +- .../Adminhtml/Emailcatcher/massDelete.php | 12 +- Controller/Adminhtml/Preview/Index.php | 61 ++++---- Cron/Clean.php | 8 +- Mail/Transport.php | 11 +- Model/Emailcatcher.php | 30 ++-- Model/Mail.php | 11 +- Model/ResourceModel/Emailcatcher.php | 21 +-- .../ResourceModel/Emailcatcher/Collection.php | 26 ++-- .../Emailcatcher/Grid/Collection.php | 6 +- .../Framework/Mail/TransportInterface.php | 1 - Setup/InstallSchema.php | 131 +++++++++--------- Test/Intergration/EmailCatcherTest.php | 15 +- Test/Mail/Template/TransportBuilder.php | 1 - .../Listing/Column/EmailcatcherActions.php | 91 ++++++------ registration.php | 10 +- 21 files changed, 255 insertions(+), 267 deletions(-) diff --git a/Block/Adminhtml/Forward/Edit.php b/Block/Adminhtml/Forward/Edit.php index a739730..d976f89 100644 --- a/Block/Adminhtml/Forward/Edit.php +++ b/Block/Adminhtml/Forward/Edit.php @@ -4,18 +4,14 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container { - protected function _construct() + private function _construct() { parent::_construct(); $this->_objectId = 'id'; $this->_controller = 'adminhtml_forward'; $this->_blockGroup = 'Experius_EmailCatcher'; - $this->buttonList->remove('reset'); - $this->buttonList->update('save', 'label', __('Send')); - } - } diff --git a/Block/Adminhtml/Forward/Edit/Form.php b/Block/Adminhtml/Forward/Edit/Form.php index cb2bd64..d2e65bb 100644 --- a/Block/Adminhtml/Forward/Edit/Form.php +++ b/Block/Adminhtml/Forward/Edit/Form.php @@ -11,7 +11,7 @@ protected function _prepareLayout() $emailCatcherId = $this->getRequest()->getParam('emailcatcher_id'); - $emailCatcherIds = ($emailCatcherId) ? $emailCatcherId : implode(',',$this->getRequest()->getParam('selected')); + $emailCatcherIds = ($emailCatcherId) ? $emailCatcherId : implode(',', $this->getRequest()->getParam('selected')); $form = $this->_formFactory->create(); @@ -41,7 +41,7 @@ protected function _prepareLayout() $form->setUseContainer(true); $form->setId('edit_form'); - $form->setAction($this->getUrl('*/*/send',['emailcatcher_id'=>$this->getRequest()->getParam('emailcatcher_id')])); + $form->setAction($this->getUrl('*/*/send', ['emailcatcher_id'=>$this->getRequest()->getParam('emailcatcher_id')])); $form->setMethod('post'); $this->setForm($form); } diff --git a/Controller/Adminhtml/Emailcatcher/Cleanup.php b/Controller/Adminhtml/Emailcatcher/Cleanup.php index 6ea9a9d..5d36959 100644 --- a/Controller/Adminhtml/Emailcatcher/Cleanup.php +++ b/Controller/Adminhtml/Emailcatcher/Cleanup.php @@ -11,8 +11,8 @@ namespace Experius\EmailCatcher\Controller\Adminhtml\Emailcatcher; - -class Cleanup extends \Magento\Backend\App\Action { +class Cleanup extends \Magento\Backend\App\Action +{ protected $clean; @@ -20,25 +20,26 @@ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Experius\EmailCatcher\Cron\Clean $clean - ){ + ) { $this->clean = $clean; parent::__construct($context); } - public function execute(){ + public function execute() + { $resultRedirect = $this->resultRedirectFactory->create(); try { $deleteCount = $this->clean->execute(); - } catch (\Exception $e){ + } catch (\Exception $e) { $this->messageManager->addError($e->getMessage()); return $resultRedirect->setPath('*/*/'); } - $this->messageManager->addSuccessMessage(__('Removed %1 records from %2 days ago or older',$deleteCount,'30')); + $this->messageManager->addSuccessMessage(__('Removed %1 records from %2 days ago or older', $deleteCount, '30')); return $resultRedirect->setPath('*/*/'); } diff --git a/Controller/Adminhtml/Emailcatcher/Forward.php b/Controller/Adminhtml/Emailcatcher/Forward.php index 524bc47..e5d0ff2 100644 --- a/Controller/Adminhtml/Emailcatcher/Forward.php +++ b/Controller/Adminhtml/Emailcatcher/Forward.php @@ -11,8 +11,8 @@ namespace Experius\EmailCatcher\Controller\Adminhtml\Emailcatcher; - -class Forward extends \Magento\Backend\App\Action { +class Forward extends \Magento\Backend\App\Action +{ protected $resultPageFactory; @@ -20,13 +20,14 @@ class Forward extends \Magento\Backend\App\Action { public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory - ){ + ) { $this->resultPageFactory = $resultPageFactory; parent::__construct($context); } - public function execute(){ + public function execute() + { $result = $this->resultPageFactory->create(); $result->getConfig()->getTitle()->prepend(__('Email Catcher')); diff --git a/Controller/Adminhtml/Emailcatcher/Index.php b/Controller/Adminhtml/Emailcatcher/Index.php index 13afd06..822b71c 100644 --- a/Controller/Adminhtml/Emailcatcher/Index.php +++ b/Controller/Adminhtml/Emailcatcher/Index.php @@ -1,35 +1,33 @@ -resultPageFactory = $resultPageFactory; - parent::__construct($context); - } + protected $resultPageFactory; - - public function execute(){ - - $result = $this->resultPageFactory->create(); - $result->getConfig()->getTitle()->prepend(__('Email Catcher')); - return $result; - } + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Framework\View\Result\PageFactory $resultPageFactory + ) { + $this->resultPageFactory = $resultPageFactory; + parent::__construct($context); + } + + public function execute() + { + $result = $this->resultPageFactory->create(); + $result->getConfig()->getTitle()->prepend(__('Email Catcher')); + return $result; + } } diff --git a/Controller/Adminhtml/Emailcatcher/Send.php b/Controller/Adminhtml/Emailcatcher/Send.php index 1226cc7..d5c7a20 100644 --- a/Controller/Adminhtml/Emailcatcher/Send.php +++ b/Controller/Adminhtml/Emailcatcher/Send.php @@ -11,8 +11,8 @@ namespace Experius\EmailCatcher\Controller\Adminhtml\Emailcatcher; - -class Send extends \Magento\Backend\App\Action { +class Send extends \Magento\Backend\App\Action +{ protected $mail; @@ -21,14 +21,15 @@ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Experius\EmailCatcher\Model\Mail $mail - ){ + ) { $this->mail = $mail; parent::__construct($context); } - public function execute(){ + public function execute() + { $resultRedirect = $this->resultRedirectFactory->create(); @@ -37,12 +38,12 @@ public function execute(){ $email = (isset($postData['email'])) ? $postData['email'] : false; $emailCatcherId = (isset($postData['emailcatcher_id'])) ? $postData['emailcatcher_id'] : false; - if(!$emailCatcherId){ + if (!$emailCatcherId) { $this->messageManager->addError('Oops, something went wrong'); return $resultRedirect->setPath('*/*/'); } - $this->mail->sendMessage($emailCatcherId,$email); + $this->mail->sendMessage($emailCatcherId, $email); $this->messageManager->addSuccessMessage('Email send to ' . $email); return $resultRedirect->setPath('*/*/'); diff --git a/Controller/Adminhtml/Emailcatcher/massDelete.php b/Controller/Adminhtml/Emailcatcher/massDelete.php index b99d7f4..ce84208 100644 --- a/Controller/Adminhtml/Emailcatcher/massDelete.php +++ b/Controller/Adminhtml/Emailcatcher/massDelete.php @@ -11,8 +11,8 @@ namespace Experius\EmailCatcher\Controller\Adminhtml\Emailcatcher; - -class massDelete extends \Magento\Backend\App\Action { +class massDelete extends \Magento\Backend\App\Action +{ protected $resultPageFactory; @@ -20,16 +20,14 @@ class massDelete extends \Magento\Backend\App\Action { public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory - ){ + ) { $this->resultPageFactory = $resultPageFactory; parent::__construct($context); } - public function execute(){ - - die('Hello Delete'); - + public function execute() + { $result = $this->resultPageFactory->create(); $result->getConfig()->getTitle()->prepend(__('Email Catcher')); return $result; diff --git a/Controller/Adminhtml/Preview/Index.php b/Controller/Adminhtml/Preview/Index.php index c5efccb..95659b9 100644 --- a/Controller/Adminhtml/Preview/Index.php +++ b/Controller/Adminhtml/Preview/Index.php @@ -1,46 +1,43 @@ -resultPageFactory = $resultPageFactory; - - $this->_emailCatcher = $emailCatcher; - - parent::__construct($context); - } - - - public function execute(){ - - $id = $this->getRequest()->getParam('emailcatcher_id'); - if($id){ - - $model = $this->_emailCatcher->create(); + \Magento\Framework\Controller\Result\RawFactory $resultRawFactory, + \Experius\EmailCatcher\Model\EmailcatcherFactory $emailCatcher + ) { + + $this->resultRawFactory = $resultRawFactory; + $this->emailCatcher = $emailCatcher; + + parent::__construct($context); + } + + public function execute() + { + $id = $this->getRequest()->getParam('emailcatcher_id'); + if ($id) { + $model = $this->emailCatcher->create(); $email = $model->load($id); - - echo $email->getBody(); - } - } + $resultRaw = $this->resultRawFactory->create(); + return $resultRaw->setContents($email->getBody()); + } + } } diff --git a/Cron/Clean.php b/Cron/Clean.php index aefd731..01af54c 100644 --- a/Cron/Clean.php +++ b/Cron/Clean.php @@ -18,7 +18,7 @@ class Clean public function __construct( \Psr\Log\LoggerInterface $logger, \Magento\Framework\App\ResourceConnection $resourceConnection - ){ + ) { $this->logger = $logger; $this->resourceConnection = $resourceConnection; $this->connection = $this->resourceConnection->getConnection(); @@ -41,10 +41,8 @@ public function execute() $where ); - $this->logger->addInfo(__('Experius EmailCatcher Cleanup: Removed %1 records',$deleteCount)); + $this->logger->addInfo(__('Experius EmailCatcher Cleanup: Removed %1 records', $deleteCount)); return $deleteCount; } - - -} \ No newline at end of file +} diff --git a/Mail/Transport.php b/Mail/Transport.php index fd0191e..bddd0e6 100644 --- a/Mail/Transport.php +++ b/Mail/Transport.php @@ -18,7 +18,6 @@ use Magento\Framework\Mail\TransportInterface; use Magento\Store\Model\ScopeInterface; - class Transport implements TransportInterface { @@ -50,26 +49,25 @@ public function __construct( $this->emailCatcher = $emailCatcher; } - public function sendMessage(\Magento\Framework\Mail\Message $message = Null) + public function sendMessage(\Magento\Framework\Mail\Message $message = null) { $message = (is_null($message)) ? $this->message : $message; - if($this->scopeConfig->getValue('emailcatcher/general/enabled',\Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { + if ($this->scopeConfig->getValue('emailcatcher/general/enabled', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->emailCatcher->create()->saveMessage($message); } - if($this->scopeConfig->getValue('system/smtp/disable',\Magento\Store\Model\ScopeInterface::SCOPE_STORE)){ + if ($this->scopeConfig->getValue('system/smtp/disable', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { return; } - if($this->scopeConfig->getValue('emailcatcher/general/smtp_disable',\Magento\Store\Model\ScopeInterface::SCOPE_STORE)){ + if ($this->scopeConfig->getValue('emailcatcher/general/smtp_disable', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { return; } try { - $isSetReturnPath = $this->scopeConfig->getValue( self::XML_PATH_SENDING_SET_RETURN_PATH, ScopeInterface::SCOPE_STORE @@ -88,7 +86,6 @@ public function sendMessage(\Magento\Framework\Mail\Message $message = Null) } catch (\Exception $e) { throw new MailException(__($e->getMessage()), $e); } - } public function getMessage() diff --git a/Model/Emailcatcher.php b/Model/Emailcatcher.php index 921a7ff..b226d4f 100644 --- a/Model/Emailcatcher.php +++ b/Model/Emailcatcher.php @@ -1,35 +1,37 @@ -_init('Experius\EmailCatcher\Model\ResourceModel\Emailcatcher'); - } + protected function _construct() + { + $this->_init('Experius\EmailCatcher\Model\ResourceModel\Emailcatcher'); + } - public function saveMessage(\Magento\Framework\Mail\Message $message){ + public function saveMessage(\Magento\Framework\Mail\Message $message) + { $subject = mb_decode_mimeheader($message->getSubject()); @@ -39,7 +41,5 @@ public function saveMessage(\Magento\Framework\Mail\Message $message){ $this->setFrom($message->getFrom()); $this->setCreatedAt(date('c')); $this->save(); - } - } diff --git a/Model/Mail.php b/Model/Mail.php index 3dff4a5..8ad765b 100644 --- a/Model/Mail.php +++ b/Model/Mail.php @@ -2,7 +2,8 @@ namespace Experius\EmailCatcher\Model; -class Mail{ +class Mail +{ protected $messageFactory; @@ -14,13 +15,14 @@ public function __construct( \Magento\Framework\Mail\Message $messageFactory, \Experius\EmailCatcher\Model\EmailcatcherFactory $emailcatcherFactory, \Experius\EmailCatcher\Mail\Transport $transport - ){ + ) { $this->messageFactory = $messageFactory; $this->emailCatcherFactory = $emailcatcherFactory; $this->transport = $transport; } - public function sendMessage($emailCatcherId,$alternativeToAddress){ + public function sendMessage($emailCatcherId, $alternativeToAddress) + { /* @var $emailCatcher \Experius\EmailCatcher\Model\Emailcatcher */ $emailCatcher = $this->emailCatcherFactory->create()->load($emailCatcherId); @@ -37,8 +39,5 @@ public function sendMessage($emailCatcherId,$alternativeToAddress){ $message->setSubject(mb_encode_mimeheader($emailCatcher->getSubject())); $this->transport->sendMessage($message); - } - - } diff --git a/Model/ResourceModel/Emailcatcher.php b/Model/ResourceModel/Emailcatcher.php index e2c199c..258a379 100644 --- a/Model/ResourceModel/Emailcatcher.php +++ b/Model/ResourceModel/Emailcatcher.php @@ -1,22 +1,23 @@ -_init('experius_emailcatcher', 'emailcatcher_id'); - } + + + protected function _construct() + { + $this->_init('experius_emailcatcher', 'emailcatcher_id'); + } } diff --git a/Model/ResourceModel/Emailcatcher/Collection.php b/Model/ResourceModel/Emailcatcher/Collection.php index a8152a3..fcd8732 100644 --- a/Model/ResourceModel/Emailcatcher/Collection.php +++ b/Model/ResourceModel/Emailcatcher/Collection.php @@ -1,24 +1,26 @@ -_init( - 'Experius\EmailCatcher\Model\Emailcatcher', - 'Experius\EmailCatcher\Model\ResourceModel\Emailcatcher'); - } + + + protected function _construct() + { + $this->_init( + 'Experius\EmailCatcher\Model\Emailcatcher', + 'Experius\EmailCatcher\Model\ResourceModel\Emailcatcher' + ); + } } diff --git a/Model/ResourceModel/Emailcatcher/Grid/Collection.php b/Model/ResourceModel/Emailcatcher/Grid/Collection.php index 121431d..20af870 100644 --- a/Model/ResourceModel/Emailcatcher/Grid/Collection.php +++ b/Model/ResourceModel/Emailcatcher/Grid/Collection.php @@ -16,7 +16,8 @@ use Magento\Framework\Event\ManagerInterface as EventManager; use Psr\Log\LoggerInterface as Logger; -class Collection extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult { +class Collection extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult +{ public function __construct(EntityFactory $entityFactory, Logger $logger, FetchStrategy $fetchStrategy, EventManager $eventManager) { @@ -28,7 +29,7 @@ public function addItem(\Magento\Framework\DataObject $item) { $itemId = $this->_getItemId($item); - if(isset($item['body'])) { + if (isset($item['body'])) { unset($item['body']); } @@ -44,5 +45,4 @@ public function addItem(\Magento\Framework\DataObject $item) } return $this; } - } diff --git a/Plugin/Magento/Framework/Mail/TransportInterface.php b/Plugin/Magento/Framework/Mail/TransportInterface.php index ab02918..300680a 100644 --- a/Plugin/Magento/Framework/Mail/TransportInterface.php +++ b/Plugin/Magento/Framework/Mail/TransportInterface.php @@ -2,7 +2,6 @@ namespace Experius\EmailCatcher\Plugin\Magento\Framework\Mail; - class TransportInterface { public function aroundSendMessage( diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php index 92cf4c9..fe2e50b 100644 --- a/Setup/InstallSchema.php +++ b/Setup/InstallSchema.php @@ -1,10 +1,10 @@ -startSetup(); + + public function install( + SchemaSetupInterface $setup, + ModuleContextInterface $context + ) { + $installer = $setup; + $installer->startSetup(); - $table_experius_emailcatcher = $setup->getConnection()->newTable($setup->getTable('experius_emailcatcher')); + $table_experius_emailcatcher = $setup->getConnection()->newTable($setup->getTable('experius_emailcatcher')); - $table_experius_emailcatcher->addColumn( - 'emailcatcher_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true,'nullable' => false,'primary' => true,'unsigned' => true,), - 'Entity ID' - ); + $table_experius_emailcatcher->addColumn( + 'emailcatcher_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true,'nullable' => false,'primary' => true,'unsigned' => true,], + 'Entity ID' + ); - $table_experius_emailcatcher->addColumn( - 'to', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'to' - ); + $table_experius_emailcatcher->addColumn( + 'to', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'to' + ); - $table_experius_emailcatcher->addColumn( - 'from', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'from' - ); + $table_experius_emailcatcher->addColumn( + 'from', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'from' + ); - $table_experius_emailcatcher->addColumn( - 'subject', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'subject' - ); + $table_experius_emailcatcher->addColumn( + 'subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'subject' + ); - $table_experius_emailcatcher->addColumn( - 'body', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'body' - ); + $table_experius_emailcatcher->addColumn( + 'body', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'body' + ); - $table_experius_emailcatcher->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - [], - 'created_at' - ); + $table_experius_emailcatcher->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'created_at' + ); - $table_experius_emailcatcher->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'store_id' - ); + $table_experius_emailcatcher->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'store_id' + ); - $setup->getConnection()->createTable($table_experius_emailcatcher); + $setup->getConnection()->createTable($table_experius_emailcatcher); - $setup->endSetup(); - } + $setup->endSetup(); + } } diff --git a/Test/Intergration/EmailCatcherTest.php b/Test/Intergration/EmailCatcherTest.php index dbe3f0b..385a218 100644 --- a/Test/Intergration/EmailCatcherTest.php +++ b/Test/Intergration/EmailCatcherTest.php @@ -22,7 +22,8 @@ class EmailCatcherTest extends \PHPUnit\Framework\TestCase * @magentoConfigFixture current_store system/smtp/disable 1 * */ - public function testEmailCatch(){ + public function testEmailCatch() + { /* @var $transportBuilder \Experius\EmailCatcher\Test\Mail\Template\TransportBuilder */ $transportBuilder = Bootstrap::getObjectManager()->create(\Experius\EmailCatcher\Test\Mail\Template\TransportBuilder::class); @@ -50,12 +51,10 @@ public function testEmailCatch(){ /* @var $emailCatcher \Experius\EmailCatcher\Model\Emailcatcher */ $emailCatcher = Bootstrap::getObjectManager()->create(\Experius\EmailCatcher\Model\Emailcatcher::class); - $emailCatcher->load(self::XML_PATH_EMAIL_TO,'to'); - - $this->assertEquals(self::XML_PATH_EMAIL_TO,$emailCatcher->getTo()); - $this->assertEquals('

test-email

',$emailCatcher->getBody()); - $this->assertEquals('Test Email',$emailCatcher->getSubject()); + $emailCatcher->load(self::XML_PATH_EMAIL_TO, 'to'); + $this->assertEquals(self::XML_PATH_EMAIL_TO, $emailCatcher->getTo()); + $this->assertEquals('

test-email

', $emailCatcher->getBody()); + $this->assertEquals('Test Email', $emailCatcher->getSubject()); } - -} \ No newline at end of file +} diff --git a/Test/Mail/Template/TransportBuilder.php b/Test/Mail/Template/TransportBuilder.php index 5614a68..37524b7 100644 --- a/Test/Mail/Template/TransportBuilder.php +++ b/Test/Mail/Template/TransportBuilder.php @@ -106,5 +106,4 @@ public function __construct( $this->_senderResolver = $senderResolver; $this->mailTransportFactory = $mailTransportFactory; } - } diff --git a/Ui/Component/Listing/Column/EmailcatcherActions.php b/Ui/Component/Listing/Column/EmailcatcherActions.php index 2e5ee08..882fab9 100644 --- a/Ui/Component/Listing/Column/EmailcatcherActions.php +++ b/Ui/Component/Listing/Column/EmailcatcherActions.php @@ -1,55 +1,56 @@ -urlBuilder = $urlBuilder; - parent::__construct($context, $uiComponentFactory, $components, $data); - } + + public function __construct( + \Magento\Framework\View\Element\UiComponent\ContextInterface $context, + \Magento\Framework\View\Element\UiComponentFactory $uiComponentFactory, + \Magento\Framework\UrlInterface $urlBuilder, + array $components = [], + array $data = [] + ) { + $this->urlBuilder = $urlBuilder; + parent::__construct($context, $uiComponentFactory, $components, $data); + } - - public function prepareDataSource(array $dataSource){ - if (isset($dataSource['data']['items'])) { - foreach ($dataSource['data']['items'] as & $item) { - if (isset($item['emailcatcher_id'])) { - $item[$this->getData('name')] = [ - 'view' => [ - 'href' => $this->urlBuilder->getUrl( - static::URL_PATH_EDIT, - [ - 'emailcatcher_id' => $item['emailcatcher_id'] - ] - ), - 'label' => __('View'), - 'popup' => true - ], + + public function prepareDataSource(array $dataSource) + { + if (isset($dataSource['data']['items'])) { + foreach ($dataSource['data']['items'] as & $item) { + if (isset($item['emailcatcher_id'])) { + $item[$this->getData('name')] = [ + 'view' => [ + 'href' => $this->urlBuilder->getUrl( + static::URL_PATH_EDIT, + [ + 'emailcatcher_id' => $item['emailcatcher_id'] + ] + ), + 'label' => __('View'), + 'popup' => true + ], 'resend' => [ 'href' => $this->urlBuilder->getUrl( static::URL_PATH_SEND, @@ -72,11 +73,11 @@ public function prepareDataSource(array $dataSource){ ), 'label' => __('Forward') ] - ]; - } - } - } - - return $dataSource; - } + ]; + } + } + } + + return $dataSource; + } } diff --git a/registration.php b/registration.php index 82b0dc1..3d6c89e 100644 --- a/registration.php +++ b/registration.php @@ -1,6 +1,6 @@ -