Skip to content

Commit

Permalink
Merge pull request #125 from firegento/develop
Browse files Browse the repository at this point in the history
New Release 0.1.1
  • Loading branch information
sprankhub authored Jan 9, 2019
2 parents 4ee4cdf + 46d9ed1 commit 1d5f13e
Show file tree
Hide file tree
Showing 38 changed files with 495 additions and 88 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea/
/composer.lock
/vendor
53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright © 2016 FireGento e.V.
# See LICENSE.md bundled with this module for license details.
sudo: required
dist: trusty
addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6

env:
global:
- COVERAGE: FALSE

matrix:
fast_finish: true
include:
- php: 5.6
env: MAGENTO_VERSION=2.0.12
- php: 5.6
env: MAGENTO_VERSION=2.0.*
- php: 7.0
env: MAGENTO_VERSION=2.1.0
- php: 7.0
env: MAGENTO_VERSION=2.1.*
- php: 7.1
env: MAGENTO_VERSION=2.2.0
- php: 7.1
env: MAGENTO_VERSION=2.2.* CODE_QUALITY=true
- php: 7.2
env: MAGENTO_VERSION=2.3.0
- php: 7.2
env: MAGENTO_VERSION=2.3.*


language: php
cache:
directories:
- "$HOME/.composer/cache"
- "$HOME/.php-cs-fixer"
- "$HOME/.local"

before_install:
- "./Test/script/travis_before_install.sh"

install:
- echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > $HOME/.composer/auth.json
- export MAGENTO_ROOT=`mktemp -d /tmp/mage.XXXXXXXX`
- "./Test/script/travis_install_magento.sh $MAGENTO_VERSION"

script:
- "./Test/script/travis_script.sh"
6 changes: 4 additions & 2 deletions Block/Imprint/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
namespace FireGento\MageSetup\Block\Imprint;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Directory\Api\CountryInformationAcquirerInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\ScopeInterface;

Expand Down Expand Up @@ -110,7 +110,9 @@ public function getEmail($antispam = false)
}

$html = '<a href="#" onclick="toRecipient();">';
$html .= $parts[0] . '<span class="no-display">nospamplease</span>@<span class="no-display">nospamplease</span>' . $parts[1];
$html .= $parts[0];
$html .= '<span class="no-display">nospamplease</span>@<span class="no-display">nospamplease</span>';
$html .= $parts[1];
$html .= '</a>';
$html .= $this->getEmailJs($parts);

Expand Down
3 changes: 1 addition & 2 deletions Block/Imprint/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/
namespace FireGento\MageSetup\Block\Imprint;

use Magento\Framework\View\Element\Template;

/**
* Class Field
*
Expand All @@ -19,6 +17,7 @@ class Field extends \FireGento\MageSetup\Block\Imprint\Content
*
* @return string
*/
// phpcs:ignore
protected function _toHtml()
{
if ($this->getField() == 'email') {
Expand Down
5 changes: 2 additions & 3 deletions Block/Price/Details.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace FireGento\MageSetup\Block\Price;

use Magento\Customer\Model\ResourceModel\GroupRepository;
use Magento\Store\Model\StoreManagerInterface;

/**
* Class Details
Expand Down Expand Up @@ -120,7 +119,7 @@ public function isIncludingShippingCosts()
public function canShowShippingLink()
{
$productTypeId = $this->saleableItem->getTypeId();
$ignoreTypeIds = array('virtual', 'downloadable');
$ignoreTypeIds = ['virtual', 'downloadable'];
if (in_array($productTypeId, $ignoreTypeIds)) {
return false;
}
Expand All @@ -142,7 +141,7 @@ public function getShippingCostUrl()
private function getTaxPercentBySaleableItem()
{
$taxPercent = $this->saleableItem->getTaxPercent();
if (is_null($taxPercent)) {
if ($taxPercent === null) {
$productTaxClassId = $this->saleableItem->getTaxClassId();
if ($productTaxClassId) {
$store = $this->storeManager->getStore();
Expand Down
2 changes: 1 addition & 1 deletion Block/Product/Delivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class Delivery extends \Magento\Catalog\Block\Product\View\Description
*/
public function getProduct()
{
return $this->getData('product');;
return $this->getData('product');
}
}
23 changes: 14 additions & 9 deletions Command/SetupRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* Copyright © 2016 FireGento e.V.
* See LICENSE.md bundled with this module for license details.
*/

namespace FireGento\MageSetup\Command;

use FireGento\MageSetup\Model\ConfigFactory;
use FireGento\MageSetup\Model\Setup\SubProcessor\SubProcessorPool;
use FireGento\MageSetup\Service\SetupServiceFactory;
use Magento\Framework\App\ObjectManager\ConfigLoader;
use Magento\Framework\App\State as AppState;
use Magento\Framework\ObjectManagerInterface;
Expand All @@ -15,7 +17,6 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use FireGento\MageSetup\Service\SetupServiceFactory;

/**
* Class SetupRunCommand
Expand Down Expand Up @@ -65,12 +66,12 @@ class SetupRunCommand extends Command
private $subProcessorPool;

/**
* @param SetupServiceFactory $setupService
* @param ConfigFactory $magesetupConfig
* @param SubProcessorPool $subProcessorPool
* @param Registry $registry
* @param AppState $appState
* @param ConfigLoader $configLoader
* @param SetupServiceFactory $setupService
* @param ConfigFactory $magesetupConfig
* @param SubProcessorPool $subProcessorPool
* @param Registry $registry
* @param AppState $appState
* @param ConfigLoader $configLoader
* @param ObjectManagerInterface $objectManager
*/
public function __construct(
Expand Down Expand Up @@ -106,7 +107,7 @@ protected function configure()
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
* @return int Non zero if invalid type, 0 otherwise
*/
Expand All @@ -119,6 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$area = $this->appState->getAreaCode();
}

// phpcs:ignore
$configLoader = $this->objectManager->get('Magento\Framework\ObjectManager\ConfigLoaderInterface');
$this->objectManager->configure($configLoader->load($area));
$this->registry->register('isSecureArea', true);
Expand All @@ -131,7 +133,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$config = $this->magesetupConfig->create(['country' => $country]);
$allowedCountries = $config->getAllowedCountries();
if (!in_array($country, $allowedCountries)) {
throw new \InvalidArgumentException('Country code "' . $country . '" is not allowed. Supported countries are: ' . implode(', ', $allowedCountries));
throw new \InvalidArgumentException(
'Country code "' . $country . '" is not allowed. Supported countries are: '
. implode(', ', $allowedCountries)
);
}

/*
Expand Down
26 changes: 26 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Copyright © 2018 FireGento e.V.
* See LICENSE.md bundled with this module for license details.
*/

namespace FireGento\MageSetup\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;

/**
* Class AroundRenderPlugin
* @package FireGento\MageSetup\Helper
*/
class Data extends AbstractHelper
{
public function getConfigValue($field, $storeId = null)
{
return $this->scopeConfig->getValue(
$field,
ScopeInterface::SCOPE_STORE,
$storeId
);
}
}
5 changes: 2 additions & 3 deletions Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
namespace FireGento\MageSetup\Model;

use Magento\Framework\Config\CacheInterface;
use FireGento\MageSetup\Model\Config\Reader;
use Magento\Framework\Config\CacheInterface;

/**
* Class Config
Expand Down Expand Up @@ -48,8 +48,7 @@ public function __construct(
Reader $reader,
CacheInterface $cache,
$country
)
{
) {
$this->reader = $reader;
$this->cache = $cache;
$this->country = $country;
Expand Down
1 change: 1 addition & 0 deletions Model/Config/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public function getTaxConfig(\DOMElement $node)
if ($subSubChildNode->nodeType != XML_ELEMENT_NODE) {
continue;
}
// phpcs:ignore
$data[$childNode->nodeName][$subChildNode->nodeName][$subSubChildNode->nodeName] = $subSubChildNode->nodeValue;
}
}
Expand Down
1 change: 1 addition & 0 deletions Model/Config/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Reader extends \Magento\Framework\Config\Reader\Filesystem
*
* @var array
*/
// phpcs:ignore
protected $_idAttributes = [
'/magesetup/setup' => 'name',
];
Expand Down
2 changes: 2 additions & 0 deletions Model/Config/SchemaLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
*
* @var string
*/
// phpcs:ignore
protected $_schema = null;

/**
* Path to corresponding XSD file with validation rules for separate config files
*
* @var string
*/
// phpcs:ignore
protected $_perFileSchema = null;

/**
Expand Down
3 changes: 3 additions & 0 deletions Model/Setup/SubProcessor/AgreementsSubProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public function process(Config $config)
// Check if template filename exists
$filename = $agreementData['filename'];
$template = $this->getTemplatePath() . $filename;

// phpcs:ignore
if (!file_exists($template)) {
continue;
}
Expand All @@ -79,6 +81,7 @@ public function process(Config $config)
unset($agreementData['filename']);

// Fetch template content
// phpcs:ignore
$templateContent = @file_get_contents($template);

// Fetch agreement name
Expand Down
17 changes: 10 additions & 7 deletions Model/Setup/SubProcessor/CmsSubProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace FireGento\MageSetup\Model\Setup\SubProcessor;

use FireGento\MageSetup\Model\Config;
use Magento\Framework\App\Config\Storage\WriterInterface;
use Magento\Cms\Model\BlockFactory;
use Magento\Cms\Model\BlockRepository;
use Magento\Cms\Model\PageFactory;
use Magento\Cms\Model\PageRepository;
use Magento\Framework\App\Config\Storage\WriterInterface;

/**
* Class CmsSubProcessor
Expand Down Expand Up @@ -64,8 +64,7 @@ public function __construct(
PageRepository $pageRepository,
BlockFactory $blockFactory,
BlockRepository $blockRepository
)
{
) {
$this->moduleReader = $moduleReader;
$this->pageFactory = $pageFactory;
$this->pageRepository = $pageRepository;
Expand Down Expand Up @@ -107,6 +106,7 @@ private function createCmsPage($pageData)
// Check if template filename exists
$filename = $pageData['filename'];
$template = $this->getTemplatePath('pages') . $filename;
// phpcs:ignore
if (!file_exists($template)) {
return;
}
Expand All @@ -115,12 +115,13 @@ private function createCmsPage($pageData)
unset($pageData['filename']);

// Fetch template content
// phpcs:ignore
$templateContent = @file_get_contents($template);

$data = array(
$data = [
'stores' => [0],
'is_active' => 1,
);
];

if (preg_match('/<!--@title\s*(.*?)\s*@-->/u', $templateContent, $matches)) {
$data['title'] = $matches[1];
Expand Down Expand Up @@ -171,6 +172,7 @@ private function createCmsBlock($blockData)
// Check if template filename exists
$filename = $blockData['filename'];
$template = $this->getTemplatePath('blocks') . $filename;
// phpcs:ignore
if (!file_exists($template)) {
return;
}
Expand All @@ -179,12 +181,13 @@ private function createCmsBlock($blockData)
unset($blockData['filename']);

// Fetch template content
// phpcs:ignore
$templateContent = @file_get_contents($template);

$data = array(
$data = [
'stores' => [0],
'is_active' => 1,
);
];

// Find title
if (preg_match('/<!--@title\s*(.*?)\s*@-->/u', $templateContent, $matches)) {
Expand Down
1 change: 0 additions & 1 deletion Model/Setup/SubProcessor/SubProcessorPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\ObjectManager\TMap;
use Magento\Framework\ObjectManager\TMapFactory;
use Traversable;

/**
* Class SubProcessorPool
Expand Down
Loading

0 comments on commit 1d5f13e

Please sign in to comment.