Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
haitv282 committed Nov 4, 2019
1 parent d07dfa0 commit e9e43d0
Show file tree
Hide file tree
Showing 47 changed files with 1,503 additions and 1,472 deletions.
26 changes: 13 additions & 13 deletions .github/no-response.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Configuration for probot-no-response - https://github.com/probot/no-response

# Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 7
# Label requiring a response
responseRequiredLabel: waiting-customer-response
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information from the original author. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further.
# Configuration for probot-no-response - https://github.com/probot/no-response

# Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 7
# Label requiring a response
responseRequiredLabel: waiting-customer-response
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information from the original author. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further.
138 changes: 69 additions & 69 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
language: php
php:
- 7.0
- 7.1
sudo: required
dist: trusty
env:
global:
- COMPOSER_BIN_DIR=~/bin
- INTEGRATION_SETS=3
- NODE_JS_VERSION=6
- MAGENTO_HOST_NAME="magento2.travis"
- COMPOSER_MODULE=mageplaza/module-smtp
matrix:
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=3
- MAGENTO_VERSION=2.2.2 TEST_SUITE=static
- MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=3
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=3
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=3

matrix:
exclude:
- php: 7.0
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
- php: 7.0
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=static
cache:
apt: true
directories:
- "$HOME/.composer/cache"
- "$HOME/.nvm"
addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
- postfix
firefox: '46.0'
hosts:
- magento2.travis
before_install:
- git clone https://github.com/magento/magento2 --branch $MAGENTO_VERSION
- cd magento2
- bash ./dev/travis/before_install.sh
install:
- composer install --no-interaction --prefer-dist
- composer require $COMPOSER_MODULE
before_script:
#- cp -f ${TRAVIS_BUILD_DIR}/dev/tests/integration/phpunit.xml.dist dev/tests/integration/
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt
- echo "vendor/$COMPOSER_MODULE/**/*.js" > dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/magento.txt
- bash ./dev/travis/before_script.sh
script:
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true
- if [ $TEST_SUITE == "functional" ]; then dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE != "functional" ] && [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi
language: php
php:
- 7.0
- 7.1
sudo: required
dist: trusty
env:
global:
- COMPOSER_BIN_DIR=~/bin
- INTEGRATION_SETS=3
- NODE_JS_VERSION=6
- MAGENTO_HOST_NAME="magento2.travis"
- COMPOSER_MODULE=mageplaza/module-smtp
matrix:
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=3
- MAGENTO_VERSION=2.2.2 TEST_SUITE=static
- MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=3
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=3
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=1
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=2
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=3

matrix:
exclude:
- php: 7.0
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
- php: 7.0
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=static
cache:
apt: true
directories:
- "$HOME/.composer/cache"
- "$HOME/.nvm"
addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
- postfix
firefox: '46.0'
hosts:
- magento2.travis
before_install:
- git clone https://github.com/magento/magento2 --branch $MAGENTO_VERSION
- cd magento2
- bash ./dev/travis/before_install.sh
install:
- composer install --no-interaction --prefer-dist
- composer require $COMPOSER_MODULE
before_script:
#- cp -f ${TRAVIS_BUILD_DIR}/dev/tests/integration/phpunit.xml.dist dev/tests/integration/
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt
- echo "vendor/$COMPOSER_MODULE/**/*.js" > dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/magento.txt
- bash ./dev/travis/before_script.sh
script:
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true
- if [ $TEST_SUITE == "functional" ]; then dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE != "functional" ] && [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi
4 changes: 2 additions & 2 deletions Block/Adminhtml/Log/ClearButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function getButtonData()
'label' => __('Clear All Logs'),
'class' => 'primary',
'on_click' => 'deleteConfirm(\'' . __(
'Are you sure you want to clear all email logs?'
) . '\', \'' . $this->_urlBuilder->getUrl('*/*/clear') . '\')',
'Are you sure you want to clear all email logs?'
) . '\', \'' . $this->_urlBuilder->getUrl('*/*/clear') . '\')',
'sort_order' => 10,
];
}
Expand Down
2 changes: 2 additions & 0 deletions Block/Adminhtml/System/Config/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Button extends Field
* Unset scope
*
* @param AbstractElement $element
*
* @return string
*/
public function render(AbstractElement $element)
Expand All @@ -52,6 +53,7 @@ public function render(AbstractElement $element)
* Get the button and scripts contents
*
* @param AbstractElement $element
*
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
Expand Down
9 changes: 6 additions & 3 deletions Block/Adminhtml/System/Config/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Phrase;

/**
* Class Host
Expand All @@ -49,13 +50,14 @@ protected function _construct()
/**
* Get the button
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @param AbstractElement $element
*
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
$originalData = $element->getOriginalData();
$buttonLabel = !empty($originalData['button_label']) ? $originalData['button_label'] : $this->_buttonLabel;
$buttonLabel = !empty($originalData['button_label']) ? $originalData['button_label'] : $this->_buttonLabel;
$this->addData(
[
'button_label' => __($buttonLabel),
Expand All @@ -70,7 +72,8 @@ protected function _getElementHtml(AbstractElement $element)

/**
* @param $key
* @return \Magento\Framework\Phrase
*
* @return Phrase
*/
public function getLabel($key)
{
Expand Down
1 change: 1 addition & 0 deletions Controller/Adminhtml/Smtp/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Delete extends Action

/**
* Delete constructor.
*
* @param Action\Context $context
* @param LogFactory $logFactory
*/
Expand Down
7 changes: 4 additions & 3 deletions Controller/Adminhtml/Smtp/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Email extends Action

/**
* Email constructor.
*
* @param Context $context
* @param LogFactory $logFactory
* @param StateInterface $inlineTranslation
Expand All @@ -79,9 +80,9 @@ public function __construct(
TransportBuilder $transportBuilder,
StoreManagerInterface $storeManager
) {
$this->logFactory = $logFactory;
$this->scopeConfig = $scopeConfig;
$this->storeManager = $storeManager;
$this->logFactory = $logFactory;
$this->scopeConfig = $scopeConfig;
$this->storeManager = $storeManager;
$this->_transportBuilder = $transportBuilder;
$this->inlineTranslation = $inlineTranslation;

Expand Down
5 changes: 3 additions & 2 deletions Controller/Adminhtml/Smtp/MassDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class MassDelete extends Action

/**
* MassDelete constructor.
*
* @param Filter $filter
* @param Action\Context $context
* @param CollectionFactory $emailLog
Expand All @@ -57,7 +58,7 @@ public function __construct(
Action\Context $context,
CollectionFactory $emailLog
) {
$this->filter = $filter;
$this->filter = $filter;
$this->emailLog = $emailLog;

parent::__construct($context);
Expand All @@ -73,7 +74,7 @@ public function execute()

try {
$collection = $this->filter->getCollection($this->emailLog->create());
$deleted = 0;
$deleted = 0;
foreach ($collection->getItems() as $item) {
$item->delete();
$deleted++;
Expand Down
5 changes: 3 additions & 2 deletions Controller/Adminhtml/Smtp/MassResend.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MassResend extends Action

/**
* MassResend constructor.
*
* @param Filter $filter
* @param Action\Context $context
* @param CollectionFactory $emailLog
Expand All @@ -62,7 +63,7 @@ public function __construct(
Action\Context $context,
CollectionFactory $emailLog
) {
$this->filter = $filter;
$this->filter = $filter;
$this->emailLog = $emailLog;

parent::__construct($context);
Expand All @@ -75,7 +76,7 @@ public function __construct(
public function execute()
{
$collection = $this->filter->getCollection($this->emailLog->create());
$resend = 0;
$resend = 0;

/** @var \Mageplaza\Smtp\Model\Log $item */
foreach ($collection->getItems() as $item) {
Expand Down
9 changes: 5 additions & 4 deletions Controller/Adminhtml/Smtp/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Test extends Action

/**
* Test constructor.
*
* @param Context $context
* @param LoggerInterface $logger
* @param SmtpData $smtpDataHelper
Expand All @@ -90,11 +91,11 @@ public function __construct(
TransportBuilder $transportBuilder,
SenderResolver $senderResolver
) {
$this->logger = $logger;
$this->smtpDataHelper = $smtpDataHelper;
$this->mailResource = $mailResource;
$this->logger = $logger;
$this->smtpDataHelper = $smtpDataHelper;
$this->mailResource = $mailResource;
$this->_transportBuilder = $transportBuilder;
$this->senderResolver = $senderResolver;
$this->senderResolver = $senderResolver;

parent::__construct($context);
}
Expand Down
9 changes: 5 additions & 4 deletions Cron/ClearLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class ClearLog

/**
* ClearLog constructor.
*
* @param LoggerInterface $logger
* @param DateTime $date
* @param CollectionFactory $collectionLog
Expand All @@ -67,10 +68,10 @@ public function __construct(
CollectionFactory $collectionLog,
Data $helper
) {
$this->logger = $logger;
$this->date = $date;
$this->logger = $logger;
$this->date = $date;
$this->collectionLog = $collectionLog;
$this->helper = $helper;
$this->helper = $helper;
}

/**
Expand All @@ -84,7 +85,7 @@ public function execute()
return $this;
}

$day = (int)$this->helper->getConfigGeneral('clean_email');
$day = (int) $this->helper->getConfigGeneral('clean_email');
if (isset($day) && $day > 0) {
$timeEnd = strtotime($this->date->date()) - $day * 24 * 60 * 60;

Expand Down
Loading

0 comments on commit e9e43d0

Please sign in to comment.