From a3c9d3ab269b5a5855e8411942e743d2d2d3d461 Mon Sep 17 00:00:00 2001 From: Erik Hansen Date: Mon, 16 Nov 2015 15:53:04 -0600 Subject: [PATCH] Code cleanup - Changed property names to match PSR-2 - Fixed misspellings --- Helper/Data.php | 23 ++++++++++++----------- Model/Plugin.php | 8 ++++---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Helper/Data.php b/Helper/Data.php index 18edb63..4fa549f 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -4,12 +4,13 @@ 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 @@ -17,10 +18,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ 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; } /** @@ -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) { @@ -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); } /** @@ -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); @@ -151,12 +152,12 @@ public function formatOverriddenScopes(\Magento\Config\Block\System\Config\Form $scopeLabel = sprintf( 'website %s', $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( '*/*/*', diff --git a/Model/Plugin.php b/Model/Plugin.php index b5f0ebd..8470f9d 100644 --- a/Model/Plugin.php +++ b/Model/Plugin.php @@ -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; } /** @@ -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());