Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Format Code
Browse files Browse the repository at this point in the history
  • Loading branch information
haitv282 committed Jan 31, 2019
1 parent 386d013 commit fe94da5
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 138 deletions.
84 changes: 42 additions & 42 deletions .travis.yml
Expand Up @@ -6,63 +6,63 @@ 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-sitemap
- COMPOSER_BIN_DIR=~/bin
- INTEGRATION_SETS=3
- NODE_JS_VERSION=6
- MAGENTO_HOST_NAME="magento2.travis"
- COMPOSER_MODULE=mageplaza/module-sitemap
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
- 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
- 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"
- "$HOME/.composer/cache"
- "$HOME/.nvm"
addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
- postfix
- 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
- 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
- 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
#- 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
- 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


52 changes: 25 additions & 27 deletions Block/Sitemap.php
Expand Up @@ -23,7 +23,6 @@

use Magento\Catalog\Helper\Category;
use Magento\Catalog\Model\CategoryRepository;
use Magento\Catalog\Model\Indexer\Category\Flat\State;
use Magento\Catalog\Model\Product\Visibility as ProductVisibility;
use Magento\Catalog\Model\ResourceModel\Category\Collection;
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
Expand All @@ -32,7 +31,6 @@
use Magento\Cms\Model\ResourceModel\Page\Collection as PageCollection;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Theme\Block\Html\Topmenu;
use Mageplaza\Sitemap\Helper\Data as HelperConfig;

/**
Expand Down Expand Up @@ -90,24 +88,21 @@ class Sitemap extends Template

/**
* Sitemap constructor.
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Catalog\Helper\Category $categoryHelper
* @param \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState
* @param \Magento\Theme\Block\Html\Topmenu $topMenu
* @param \Magento\Catalog\Model\ResourceModel\Category\Collection $collection
* @param \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollection
* @param \Magento\Catalog\Model\CategoryRepository $categoryRepository
*
* @param Context $context
* @param Category $categoryHelper
* @param Collection $collection
* @param CollectionFactory $categoryCollection
* @param CategoryRepository $categoryRepository
* @param HelperConfig $helper
* @param \Magento\CatalogInventory\Helper\Stock $stockFilter
* @param \Magento\Catalog\Model\Product\Visibility $productVisibility
* @param \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection
* @param \Magento\Cms\Model\ResourceModel\Page\Collection $pageCollection
* @param Stock $stockFilter
* @param ProductVisibility $productVisibility
* @param ProductCollection $productCollection
* @param PageCollection $pageCollection
*/
public function __construct(
Context $context,
Category $categoryHelper,
State $categoryFlatState,
Topmenu $topMenu,
Collection $collection,
CollectionFactory $categoryCollection,
CategoryRepository $categoryRepository,
Expand All @@ -116,17 +111,16 @@ public function __construct(
ProductVisibility $productVisibility,
ProductCollection $productCollection,
PageCollection $pageCollection
)
{
$this->collection = $collection;
$this->_categoryHelper = $categoryHelper;
) {
$this->collection = $collection;
$this->_categoryHelper = $categoryHelper;
$this->_categoryCollection = $categoryCollection;
$this->categoryRepository = $categoryRepository;
$this->_helper = $helper;
$this->_stockFilter = $stockFilter;
$this->productVisibility = $productVisibility;
$this->productCollection = $productCollection;
$this->pageCollection = $pageCollection;
$this->categoryRepository = $categoryRepository;
$this->_helper = $helper;
$this->_stockFilter = $stockFilter;
$this->productVisibility = $productVisibility;
$this->productCollection = $productCollection;
$this->pageCollection = $pageCollection;

parent::__construct($context);
}
Expand All @@ -137,7 +131,7 @@ public function __construct(
*/
public function getProductCollection()
{
$limit = $this->_helper->getProductLimit() ? $this->_helper->getProductLimit() : self::DEFAULT_PRODUCT_LIMIT;
$limit = $this->_helper->getProductLimit() ? $this->_helper->getProductLimit() : self::DEFAULT_PRODUCT_LIMIT;
$collection = $this->productCollection
->setVisibility($this->productVisibility->getVisibleInCatalogIds())
->addMinimalPrice()
Expand All @@ -161,6 +155,7 @@ public function getCategoryCollection()

/**
* @param $categoryId
*
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
Expand Down Expand Up @@ -201,7 +196,7 @@ public function getExcludedPages()
public function getAdditionLinksCollection()
{
$additionLinks = $this->_helper->getAdditionalLinks();
$allLink = explode("\n", $additionLinks);
$allLink = explode("\n", $additionLinks);

$result = [];
foreach ($allLink as $link) {
Expand All @@ -215,8 +210,10 @@ public function getAdditionLinksCollection()

/**
* Render link element
*
* @param $link
* @param $title
*
* @return string
*/
public function renderLinkElement($link, $title)
Expand All @@ -229,6 +226,7 @@ public function renderLinkElement($link, $title)
* @param $config
* @param $title
* @param $collection
*
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG
@@ -1 +1 @@
Changelog: https://www.mageplaza.com/changelog/m2-seo.txt
Changelog: https://www.mageplaza.com/releases/google-xml-sitemap/
3 changes: 2 additions & 1 deletion Controller/Index/Index.php
Expand Up @@ -45,13 +45,14 @@ class Index extends Action

/**
* Index constructor.
*
* @param Context $context
* @param PageFactory $pageFactory
* @param HelperConfig $helperConfig
*/
public function __construct(Context $context, PageFactory $pageFactory, HelperConfig $helperConfig)
{
$this->pageFactory = $pageFactory;
$this->pageFactory = $pageFactory;
$this->helperConfig = $helperConfig;

return parent::__construct($context);
Expand Down
12 changes: 11 additions & 1 deletion Helper/Data.php
Expand Up @@ -34,7 +34,9 @@ class Data extends AbstractHelper

/************************ HTML Sitemap Configuration *************************
* Is enable html site map
*
* @param null $storeId
*
* @return mixed
*/
public function isEnableHtmlSiteMap($storeId = null)
Expand All @@ -45,6 +47,7 @@ public function isEnableHtmlSiteMap($storeId = null)
/**
* @param $code
* @param null $storeId
*
* @return array|bool|mixed
*/
public function getHtmlSitemapConfig($code, $storeId = null)
Expand Down Expand Up @@ -125,8 +128,10 @@ public function getProductLimit()
}

/*********************** XML Sitemap Configuration *************************
*
* @param $code
* @param null $storeId
*
* @return mixed
*/
public function getXmlSitemapConfig($code, $storeId = null)
Expand All @@ -136,6 +141,7 @@ public function getXmlSitemapConfig($code, $storeId = null)

/**
* @param null $storeId
*
* @return mixed
*/
public function isEnableHomepageOptimization($storeId = null)
Expand All @@ -145,6 +151,7 @@ public function isEnableHomepageOptimization($storeId = null)

/**
* @param null $storeId
*
* @return mixed
*/
public function isEnableAdditionalLinks($storeId = null)
Expand All @@ -154,6 +161,7 @@ public function isEnableAdditionalLinks($storeId = null)

/**
* @param null $storeId
*
* @return array
*/
public function getXmlAdditionalLinks($storeId = null)
Expand All @@ -163,6 +171,7 @@ public function getXmlAdditionalLinks($storeId = null)

/**
* @param null $storeId
*
* @return mixed
*/
public function getFrequency($storeId = null)
Expand All @@ -172,10 +181,11 @@ public function getFrequency($storeId = null)

/**
* @param null $storeId
*
* @return mixed
*/
public function getPriority($storeId = null)
{
return $this->getXmlSitemapConfig('priority', $storeId);
}
}
}

0 comments on commit fe94da5

Please sign in to comment.