Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
- Changed property names to match PSR-2
- Fixed misspellings
  • Loading branch information
Erik Hansen committed Nov 16, 2015
1 parent 5ade3d9 commit a3c9d3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
23 changes: 12 additions & 11 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
use \Magento\Store\Model\Website;
use \Magento\Store\Model\Store;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
/** @var \Magento\Framework\App\Helper\Context */
protected $_context;
protected $context;

/** @var \Magento\Store\Model\StoreManagerInterface */
protected $_storeManger;
protected $storeManager;

/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Store\Model\StoreManagerInterface $storeManager
\Magento\Store\Model\StoreManagerInterface $storeManager,
) {
$this->_storeManger = $storeManager;
$this->_context = $context;
$this->storeManager = $storeManager;
$this->context = $context;
}

/**
Expand All @@ -32,7 +33,7 @@ public function __construct(
public function getScopeTree() {
$tree = array('websites' => array());

$websites = $this->_storeManger->getWebsites();
$websites = $this->storeManager->getWebsites();

/* @var $website Website */
foreach($websites as $website) {
Expand All @@ -56,7 +57,7 @@ public function getScopeTree() {
* @return mixed
*/
protected function _getConfigValue($path, $contextScope, $contextScopeId) {
return $this->_context->getScopeConfig()->getValue($path, $contextScope, $contextScopeId);
return $this->context->getScopeConfig()->getValue($path, $contextScope, $contextScopeId);
}

/**
Expand All @@ -69,7 +70,7 @@ protected function _getConfigValue($path, $contextScope, $contextScopeId) {
* @param $contextScopeId
* @return array
*/
public function getOverridenLevels($path, $contextScope, $contextScopeId) {
public function getOverriddenLevels($path, $contextScope, $contextScopeId) {
$tree = $this->getScopeTree();

$currentValue = $this->_getConfigValue($path, $contextScope, $contextScopeId);
Expand Down Expand Up @@ -151,12 +152,12 @@ public function formatOverriddenScopes(\Magento\Config\Block\System\Config\Form
$scopeLabel = sprintf(
'website <a href="%s">%s</a>',
$url,
$this->_storeManger->getWebsite($scopeId)->getName()
$this->storeManager->getWebsite($scopeId)->getName()
);

break;
case 'store':
$store = $this->_storeManger->getStore($scopeId);
$store = $this->storeManager->getStore($scopeId);
$website = $store->getWebsite();
$url = $this->_context->getUrlBuilder()->getUrl(
'*/*/*',
Expand Down
8 changes: 4 additions & 4 deletions Model/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
class Plugin
{
/** @var \EW\ConfigScopeHints\Helper\Data */
protected $_helper;
protected $helper;

/**
* @param \EW\ConfigScopeHints\Helper\Data $helper
*/
public function __construct(\EW\ConfigScopeHints\Helper\Data $helper) {
$this->_helper = $helper;
$this->helper = $helper;
}

/**
Expand All @@ -37,13 +37,13 @@ public function aroundGetScopeLabel(\Magento\Config\Block\System\Config\Form $fo
$currentScopeId = $form->getStoreCode();
break;
}
$overriddenLevels = $this->_helper->getOverridenLevels($field->getPath(), $form->getScope(), $currentScopeId);
$overriddenLevels = $this->helper->getOverriddenLevels($field->getPath(), $form->getScope(), $currentScopeId);

/* @var $returnPhrase Phrase */
$labelPhrase = $getScopeLabel($field);

if(!empty($overriddenLevels)) {
$scopeHintText = $labelPhrase . $this->_helper->formatOverriddenScopes($form, $overriddenLevels);
$scopeHintText = $labelPhrase . $this->helper->formatOverriddenScopes($form, $overriddenLevels);

// create new phrase, now that constituent strings are translated individually
$labelPhrase = new Phrase($scopeHintText, $labelPhrase->getArguments());
Expand Down

0 comments on commit a3c9d3a

Please sign in to comment.