From c0a2ad10307296693911312c29f397182ab7f762 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Sat, 15 Sep 2018 14:33:58 +0300 Subject: [PATCH 01/12] Fix bool scope config and update throws and update use clases --- .../Model/Recommendations/DataProvider.php | 4 +- .../CatalogInventory/Model/Configuration.php | 31 ++--- app/code/Magento/Checkout/Helper/Data.php | 12 +- app/code/Magento/Customer/Helper/Address.php | 106 ++++++++++-------- .../Customer/Model/AccountConfirmation.php | 2 +- .../Ui/Component/DataProvider/Document.php | 24 ++-- app/code/Magento/Directory/Helper/Data.php | 38 ++++--- app/code/Magento/Downloadable/Helper/Data.php | 16 +-- .../Model/DataProvider/Suggestions.php | 14 ++- .../Model/GiftMessageConfigProvider.php | 27 +++-- .../Magento/GoogleOptimizer/Helper/Data.php | 2 +- app/code/Magento/Msrp/Model/Config.php | 2 +- .../NewRelicReporting/Model/Config.php | 4 +- .../Magento/Reports/Model/ReportStatus.php | 4 +- .../Model/ResourceModel/Catalog/Product.php | 47 ++++---- .../Magento/Store/Model/BaseUrlChecker.php | 12 +- .../Store/Model/HeaderProvider/Hsts.php | 2 +- .../Model/HeaderProvider/UpgradeInsecure.php | 2 +- app/code/Magento/Store/Model/StoreManager.php | 4 +- .../Magento/Wishlist/Model/Rss/Wishlist.php | 16 +-- .../Magento/Framework/Session/SidResolver.php | 12 +- .../Magento/Framework/View/Asset/Config.php | 9 +- .../Framework/View/Asset/Minification.php | 2 +- 23 files changed, 218 insertions(+), 174 deletions(-) diff --git a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php index 546983bb5e5a8..77df85e52003c 100644 --- a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php +++ b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php @@ -73,7 +73,7 @@ public function __construct( */ public function isResultsCountEnabled() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::CONFIG_RESULTS_COUNT_ENABLED, ScopeInterface::SCOPE_STORE ); @@ -130,7 +130,7 @@ private function getSearchRecommendations(\Magento\Search\Model\QueryInterface $ */ private function isSearchRecommendationsEnabled() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::CONFIG_IS_ENABLED, ScopeInterface::SCOPE_STORE ); diff --git a/app/code/Magento/CatalogInventory/Model/Configuration.php b/app/code/Magento/CatalogInventory/Model/Configuration.php index 2f0415b40dc01..b0f8aebf1da26 100644 --- a/app/code/Magento/CatalogInventory/Model/Configuration.php +++ b/app/code/Magento/CatalogInventory/Model/Configuration.php @@ -9,6 +9,7 @@ use Magento\CatalogInventory\Helper\Minsaleqty as MinsaleqtyHelper; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Catalog\Model\ProductTypes\ConfigInterface; +use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; /** @@ -201,7 +202,7 @@ public function canSubtractQty($store = null) { return $this->scopeConfig->isSetFlag( self::XML_PATH_CAN_SUBTRACT, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -214,7 +215,7 @@ public function getMinQty($store = null) { return (float)$this->scopeConfig->getValue( self::XML_PATH_MIN_QTY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -237,7 +238,7 @@ public function getMaxSaleQty($store = null) { return (float)$this->scopeConfig->getValue( self::XML_PATH_MAX_SALE_QTY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -250,7 +251,7 @@ public function getNotifyStockQty($store = null) { return (float) $this->scopeConfig->getValue( self::XML_PATH_NOTIFY_STOCK_QTY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -264,9 +265,9 @@ public function getNotifyStockQty($store = null) */ public function getEnableQtyIncrements($store = null) { - return (bool) $this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_ENABLE_QTY_INCREMENTS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -279,7 +280,7 @@ public function getQtyIncrements($store = null) { return (float)$this->scopeConfig->getValue( self::XML_PATH_QTY_INCREMENTS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -294,7 +295,7 @@ public function getBackorders($store = null) { return (int) $this->scopeConfig->getValue( self::XML_PATH_BACKORDERS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -309,7 +310,7 @@ public function getManageStock($store = null) { return (int) $this->scopeConfig->isSetFlag( self::XML_PATH_MANAGE_STOCK, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -325,7 +326,7 @@ public function getCanBackInStock($store = null) { return $this->scopeConfig->isSetFlag( self::XML_PATH_CAN_BACK_IN_STOCK, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -340,7 +341,7 @@ public function isShowOutOfStock($store = null) { return $this->scopeConfig->isSetFlag( self::XML_PATH_SHOW_OUT_OF_STOCK, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -355,7 +356,7 @@ public function isAutoReturnEnabled($store = null) { return $this->scopeConfig->isSetFlag( self::XML_PATH_ITEM_AUTO_RETURN, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -371,7 +372,7 @@ public function isDisplayProductStockStatus($store = null) { return $this->scopeConfig->isSetFlag( self::XML_PATH_DISPLAY_PRODUCT_STOCK_STATUS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -385,7 +386,7 @@ public function getDefaultConfigValue($field, $store = null) { return $this->scopeConfig->getValue( self::XML_PATH_ITEM . $field, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -398,7 +399,7 @@ public function getStockThresholdQty($store = null) { return $this->scopeConfig->getValue( self::XML_PATH_STOCK_THRESHOLD_QTY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 0f2326d37c1ad..5a920ee2f5d8a 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -145,9 +145,9 @@ public function convertPrice($price, $format = true) */ public function canOnepageCheckout() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( 'checkout/options/onepage_checkout_enabled', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } @@ -217,7 +217,7 @@ public function sendPaymentFailedEmail( \Magento\Quote\Model\Quote $checkout, string $message, string $checkoutType = 'onepage' - ): \Magento\Checkout\Helper\Data { + ): Data { $this->paymentFailures->handle((int)$checkout->getId(), $message, $checkoutType); return $this; @@ -232,7 +232,7 @@ protected function _getEmails($configPath, $storeId) { $data = $this->scopeConfig->getValue( $configPath, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $storeId ); if (!empty($data)) { @@ -256,7 +256,7 @@ public function isAllowedGuestCheckout(\Magento\Quote\Model\Quote $quote, $store } $guestCheckout = $this->scopeConfig->isSetFlag( self::XML_PATH_GUEST_CHECKOUT, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); @@ -295,7 +295,7 @@ public function isCustomerMustBeLogged() { return $this->scopeConfig->isSetFlag( self::XML_PATH_CUSTOMER_MUST_BE_LOGGED, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php index c74c62dc6d98c..8e867c891d932 100644 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -10,6 +10,8 @@ use Magento\Customer\Api\Data\AttributeMetadataInterface; use Magento\Directory\Model\Country\Format; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\View\Element\BlockInterface; +use Magento\Store\Model\ScopeInterface; /** * Customer address helper @@ -148,8 +150,8 @@ public function getCreateUrl() } /** - * @param string $renderer - * @return \Magento\Framework\View\Element\BlockInterface + * @param BlockInterface|string $renderer + * @return BlockInterface */ public function getRenderer($renderer) { @@ -160,13 +162,15 @@ public function getRenderer($renderer) } } - /** - * Return customer address config value by key and store - * - * @param string $key - * @param \Magento\Store\Model\Store|int|string $store - * @return string|null - */ + /** + * Return customer address config value by key and store + * + * @param string $key + * @param \Magento\Store\Model\Store|int|string $store + * + * @return string|null + * @throws NoSuchEntityException + */ public function getConfig($key, $store = null) { $store = $this->_storeManager->getStore($store); @@ -174,19 +178,22 @@ public function getConfig($key, $store = null) if (!isset($this->_config[$websiteId])) { $this->_config[$websiteId] = $this->scopeConfig->getValue( 'customer/address', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } return isset($this->_config[$websiteId][$key]) ? (string)$this->_config[$websiteId][$key] : null; } - /** - * Return Number of Lines in a Street Address for store - * - * @param \Magento\Store\Model\Store|int|string $store - * @return int - */ + /** + * Return Number of Lines in a Street Address for store + * + * @param \Magento\Store\Model\Store|int|string $store + * + * @return int + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getStreetLines($store = null) { $websiteId = $this->_storeManager->getStore($store)->getWebsiteId(); @@ -228,25 +235,29 @@ public function getFormatTypeRenderer($code) return $formatType->getRenderer(); } - /** - * Determine if specified address config value can be shown - * - * @param string $key - * @return bool - */ + /** + * Determine if specified address config value can be shown + * + * @param string $key + * + * @return bool + * @throws NoSuchEntityException + */ public function canShowConfig($key) { return (bool)$this->getConfig($key); } - /** - * Get string with frontend validation classes for attribute - * - * @param string $attributeCode - * @return string - * - * @SuppressWarnings(PHPMD.NPathComplexity) - */ + /** + * Get string with frontend validation classes for attribute + * + * @param string $attributeCode + * + * @return string + * + * @SuppressWarnings(PHPMD.NPathComplexity) + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getAttributeValidationClass($attributeCode) { $class = ''; @@ -313,9 +324,9 @@ public function convertStreetLines($origStreets, $toCount) */ public function isVatValidationEnabled($store = null) { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_VAT_VALIDATION_ENABLED, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -327,9 +338,9 @@ public function isVatValidationEnabled($store = null) */ public function isDisableAutoGroupAssignDefaultValue() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } @@ -341,9 +352,9 @@ public function isDisableAutoGroupAssignDefaultValue() */ public function hasValidateOnEachTransaction($store = null) { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_VIV_ON_EACH_TRANSACTION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -358,7 +369,7 @@ public function getTaxCalculationAddressType($store = null) { return (string)$this->scopeConfig->getValue( self::XML_PATH_VIV_TAX_CALCULATION_ADDRESS_TYPE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + ScopeInterface::SCOPE_STORE, $store ); } @@ -370,19 +381,22 @@ public function getTaxCalculationAddressType($store = null) */ public function isVatAttributeVisible() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_VAT_FRONTEND_VISIBILITY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } - /** - * Retrieve attribute visibility - * - * @param string $code - * @return bool - * @since 100.2.0 - */ + /** + * Retrieve attribute visibility + * + * @param string $code + * + * @return bool + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + * @since 100.2.0 + */ public function isAttributeVisible($code) { $attributeMetadata = $this->_addressMetadataService->getAttributeMetadata($code); diff --git a/app/code/Magento/Customer/Model/AccountConfirmation.php b/app/code/Magento/Customer/Model/AccountConfirmation.php index 7d01ff0efc411..3c473dec78400 100644 --- a/app/code/Magento/Customer/Model/AccountConfirmation.php +++ b/app/code/Magento/Customer/Model/AccountConfirmation.php @@ -56,7 +56,7 @@ public function isConfirmationRequired($websiteId, $customerId, $customerEmail): return false; } - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_IS_CONFIRM, ScopeInterface::SCOPE_WEBSITES, $websiteId diff --git a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php index a9a5c5b17744e..89a3c2e855f6f 100644 --- a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php +++ b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php @@ -117,11 +117,12 @@ public function getCustomAttribute($attributeCode) return parent::getCustomAttribute($attributeCode); } - /** - * Update customer gender value - * Method set gender label instead of id value - * @return void - */ + /** + * Update customer gender value + * Method set gender label instead of id value + * @return void + * @throws \Magento\Framework\Exception\LocalizedException + */ private function setGenderValue() { $value = $this->getData(self::$genderAttributeCode); @@ -140,11 +141,12 @@ private function setGenderValue() } } - /** - * Update customer group value - * Method set group code instead id value - * @return void - */ + /** + * Update customer group value + * Method set group code instead id value + * @return void + * @throws \Magento\Framework\Exception\LocalizedException + */ private function setCustomerGroupValue() { $value = $this->getData(self::$groupAttributeCode); @@ -178,7 +180,7 @@ private function setConfirmationValue() { $value = $this->getData(self::$confirmationAttributeCode); $websiteId = $this->getData(self::$websiteIdAttributeCode) ?: $this->getData(self::$websiteAttributeCode); - $isConfirmationRequired = (bool)$this->scopeConfig->getValue( + $isConfirmationRequired = $this->scopeConfig->isSetFlag( AccountManagement::XML_PATH_IS_CONFIRM, ScopeInterface::SCOPE_WEBSITES, $websiteId diff --git a/app/code/Magento/Directory/Helper/Data.php b/app/code/Magento/Directory/Helper/Data.php index 99e1d1ad5394e..3f1e272345ed8 100644 --- a/app/code/Magento/Directory/Helper/Data.php +++ b/app/code/Magento/Directory/Helper/Data.php @@ -6,6 +6,7 @@ namespace Magento\Directory\Helper; +use Magento\Directory\Model\Currency; use Magento\Store\Model\ScopeInterface; /** @@ -165,11 +166,12 @@ public function getCountryCollection($store = null) return $this->_countryCollection; } - /** - * Retrieve regions data json - * - * @return string - */ + /** + * Retrieve regions data json + * + * @return string + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ public function getRegionJson() { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); @@ -191,15 +193,17 @@ public function getRegionJson() return $this->_regionJson; } - /** - * Convert currency - * - * @param float $amount - * @param string $from - * @param string $to - * @return float - * @SuppressWarnings(PHPMD.ShortVariable) - */ + /** + * Convert currency + * + * @param float $amount + * @param string $from + * @param string $to + * + * @return float + * @SuppressWarnings(PHPMD.ShortVariable) + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ public function currencyConvert($amount, $from, $to = null) { if (empty($this->_currencyCache[$from])) { @@ -251,7 +255,7 @@ public function isZipCodeOptional($countryCode) * Returns the list of countries, for which region is required * * @param boolean $asJson - * @return array + * @return array|string */ public function getCountriesWithStatesRequired($asJson = false) { @@ -275,7 +279,7 @@ public function getCountriesWithStatesRequired($asJson = false) */ public function isShowNonRequiredState() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_DISPLAY_ALL_STATES, ScopeInterface::SCOPE_STORE ); @@ -303,7 +307,7 @@ public function isRegionRequired($countryId) */ public function getBaseCurrencyCode() { - return $this->scopeConfig->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default'); + return $this->scopeConfig->getValue( Currency::XML_PATH_CURRENCY_BASE, 'default'); } /** diff --git a/app/code/Magento/Downloadable/Helper/Data.php b/app/code/Magento/Downloadable/Helper/Data.php index 96aa5bdfeffd7..e9b2a5ce44c01 100644 --- a/app/code/Magento/Downloadable/Helper/Data.php +++ b/app/code/Magento/Downloadable/Helper/Data.php @@ -5,7 +5,9 @@ */ namespace Magento\Downloadable\Helper; +use Magento\Downloadable\Model\Link; use Magento\Downloadable\Model\Link\Purchased\Item; +use Magento\Store\Model\ScopeInterface; /** * Downloadable helper @@ -17,7 +19,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Check is link shareable or not * - * @param \Magento\Downloadable\Model\Link|Item $link + * @param Link|Item $link * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ @@ -25,14 +27,14 @@ public function getIsShareable($link) { $shareable = false; switch ($link->getIsShareable()) { - case \Magento\Downloadable\Model\Link::LINK_SHAREABLE_YES: - case \Magento\Downloadable\Model\Link::LINK_SHAREABLE_NO: + case Link::LINK_SHAREABLE_YES: + case Link::LINK_SHAREABLE_NO: $shareable = (bool)$link->getIsShareable(); break; - case \Magento\Downloadable\Model\Link::LINK_SHAREABLE_CONFIG: - $shareable = (bool)$this->scopeConfig->isSetFlag( - \Magento\Downloadable\Model\Link::XML_PATH_CONFIG_IS_SHAREABLE, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + case Link::LINK_SHAREABLE_CONFIG: + $shareable = $this->scopeConfig->isSetFlag( + Link::XML_PATH_CONFIG_IS_SHAREABLE, + ScopeInterface::SCOPE_STORE ); } return $shareable; diff --git a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php index 8ebd45596d399..0ab1b626b074f 100644 --- a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php +++ b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php @@ -122,16 +122,18 @@ public function getItems(QueryInterface $query, $limit = null, $additionalFilter */ public function isResultsCountEnabled() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::CONFIG_SUGGESTION_COUNT_RESULTS_ENABLED, ScopeInterface::SCOPE_STORE ); } - /** - * @param QueryInterface $query - * @return array - */ + /** + * @param QueryInterface $query + * + * @return array + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ private function getSuggestions(QueryInterface $query) { $suggestions = []; @@ -204,7 +206,7 @@ private function getSearchSuggestionsCount() */ private function isSuggestionsAllowed() { - $isSearchSuggestionsEnabled = (bool)$this->scopeConfig->getValue( + $isSearchSuggestionsEnabled = $this->scopeConfig->isSetFlag( self::CONFIG_SUGGESTION_ENABLED, ScopeInterface::SCOPE_STORE ); diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php index c7f145eaddbb4..3001fa411655c 100644 --- a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php +++ b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php @@ -13,6 +13,7 @@ use Magento\Framework\Locale\FormatInterface as LocaleFormat; use Magento\Framework\Data\Form\FormKey; use Magento\Catalog\Model\Product\Attribute\Source\Boolean; +use Magento\Store\Model\ScopeInterface; /** * Configuration provider for GiftMessage rendering on "Checkout cart" page. @@ -41,7 +42,12 @@ class GiftMessageConfigProvider implements ConfigProviderInterface */ protected $checkoutSession; - /** + /** + * @var HttpContext + */ + protected $httpContext; + + /** * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -93,13 +99,13 @@ public function getConfig() { $configuration = []; $configuration['giftMessage'] = []; - $orderLevelGiftMessageConfiguration = (bool)$this->scopeConfiguration->getValue( + $orderLevelGiftMessageConfiguration = $this->scopeConfiguration->isSetFlag( GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); - $itemLevelGiftMessageConfiguration = (bool)$this->scopeConfiguration->getValue( + $itemLevelGiftMessageConfiguration = $this->scopeConfiguration->isSetFlag( GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); if ($orderLevelGiftMessageConfiguration) { $orderMessages = $this->getOrderLevelGiftMessages(); @@ -164,11 +170,12 @@ protected function getOrderLevelGiftMessages() return $this->cartRepository->get($cartId); } - /** - * Load already specified item level gift messages and related configuration. - * - * @return \Magento\GiftMessage\Api\Data\MessageInterface[]|null - */ + /** + * Load already specified item level gift messages and related configuration. + * + * @return \Magento\GiftMessage\Api\Data\MessageInterface[]|null + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ protected function getItemLevelGiftMessages() { $itemLevelConfig = []; diff --git a/app/code/Magento/GoogleOptimizer/Helper/Data.php b/app/code/Magento/GoogleOptimizer/Helper/Data.php index 5b0291eb1435d..4929e474949b3 100644 --- a/app/code/Magento/GoogleOptimizer/Helper/Data.php +++ b/app/code/Magento/GoogleOptimizer/Helper/Data.php @@ -51,7 +51,7 @@ public function __construct( */ public function isGoogleExperimentEnabled($store = null) { - return (bool)$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE, $store); + return $this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE, $store); } /** diff --git a/app/code/Magento/Msrp/Model/Config.php b/app/code/Magento/Msrp/Model/Config.php index 2ee9f41870a5a..7a990e82cbdf7 100644 --- a/app/code/Magento/Msrp/Model/Config.php +++ b/app/code/Magento/Msrp/Model/Config.php @@ -74,7 +74,7 @@ public function setStoreId($store) */ public function isEnabled() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_MSRP_ENABLED, ScopeInterface::SCOPE_STORE, $this->storeId diff --git a/app/code/Magento/NewRelicReporting/Model/Config.php b/app/code/Magento/NewRelicReporting/Model/Config.php index 32e1078c01c9d..7c0273334d7ce 100644 --- a/app/code/Magento/NewRelicReporting/Model/Config.php +++ b/app/code/Magento/NewRelicReporting/Model/Config.php @@ -88,7 +88,7 @@ public function __construct( */ public function isNewRelicEnabled() { - return (bool)$this->scopeConfig->getValue('newrelicreporting/general/enable'); + return $this->scopeConfig->getValue('newrelicreporting/general/enable'); } /** @@ -168,7 +168,7 @@ public function getNewRelicAppName() */ public function isCronEnabled() { - return (bool)$this->scopeConfig->getValue('newrelicreporting/cron/enable_cron'); + return $this->scopeConfig->getValue('newrelicreporting/cron/enable_cron'); } /** diff --git a/app/code/Magento/Reports/Model/ReportStatus.php b/app/code/Magento/Reports/Model/ReportStatus.php index ec0c32d9af1ec..112b9e9ccc45d 100644 --- a/app/code/Magento/Reports/Model/ReportStatus.php +++ b/app/code/Magento/Reports/Model/ReportStatus.php @@ -37,8 +37,8 @@ public function __construct(ScopeConfigInterface $scopeConfig) */ public function isReportEnabled(string $reportEventType): bool { - return (bool)$this->scopeConfig->getValue('reports/options/enabled') - && (bool)$this->scopeConfig->getValue($this->getConfigPathByEventType($reportEventType)); + return $this->scopeConfig->isSetFlag('reports/options/enabled') + && $this->scopeConfig->isSetFlag($this->getConfigPathByEventType($reportEventType)); } /** diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php index 11a59cfa59f17..621206d9bbbb3 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php @@ -256,12 +256,14 @@ protected function _joinAttribute($storeId, $attributeCode, $column = null) } } - /** - * Get attribute data by attribute code - * - * @param string $attributeCode - * @return array - */ + /** + * Get attribute data by attribute code + * + * @param string $attributeCode + * + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ protected function _getAttribute($attributeCode) { if (!isset($this->_attributesCache[$attributeCode])) { @@ -279,12 +281,15 @@ protected function _getAttribute($attributeCode) return $this->_attributesCache[$attributeCode]; } - /** - * Get category collection array - * - * @param null|string|bool|int|Store $storeId - * @return array|bool - */ + /** + * Get category collection array + * + * @param null|string|bool|int|Store $storeId + * + * @return array|bool + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ public function getCollection($storeId) { $products = []; @@ -343,13 +348,15 @@ public function getCollection($storeId) return $products; } - /** - * Prepare product - * - * @param array $productRow - * @param int $storeId - * @return \Magento\Framework\DataObject - */ + /** + * Prepare product + * + * @param array $productRow + * @param int $storeId + * + * @return \Magento\Framework\DataObject + * @throws \Magento\Framework\Exception\LocalizedException + */ protected function _prepareProduct(array $productRow, $storeId) { $product = new \Magento\Framework\DataObject(); @@ -482,7 +489,7 @@ private function getProductImageUrl($image) */ private function isCategoryProductURLsConfig($storeId) { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( HelperProduct::XML_PATH_PRODUCT_URL_USE_CATEGORY, ScopeInterface::SCOPE_STORE, $storeId diff --git a/app/code/Magento/Store/Model/BaseUrlChecker.php b/app/code/Magento/Store/Model/BaseUrlChecker.php index b65a76e8806f1..6e3defac9a1cd 100644 --- a/app/code/Magento/Store/Model/BaseUrlChecker.php +++ b/app/code/Magento/Store/Model/BaseUrlChecker.php @@ -5,6 +5,8 @@ */ namespace Magento\Store\Model; +use Magento\Store\Model\ScopeInterface; + /** * Verifies that the requested URL matches to base URL of store. */ @@ -47,9 +49,9 @@ public function execute($uri, $request) */ public function isEnabled() { - return (bool) $this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( 'web/url/redirect_to_base', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } @@ -62,13 +64,13 @@ public function isFrontendSecure() { $baseUrl = $this->scopeConfig->getValue( 'web/unsecure/base_url', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); $baseUrlParts = explode('://', $baseUrl); $baseUrlProtocol = array_shift($baseUrlParts); - $isSecure = (bool) $this->scopeConfig->getValue( + $isSecure = $this->scopeConfig->isSetFlag( 'web/secure/use_in_frontend', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); return $isSecure && $baseUrlProtocol == 'https'; diff --git a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php index 623fbed57e6c6..63afa7ad1fc84 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php +++ b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php @@ -45,7 +45,7 @@ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $ */ public function canApply() { - return (bool)$this->scopeConfig->isSetFlag(Store::XML_PATH_SECURE_IN_FRONTEND) + return $this->scopeConfig->isSetFlag(Store::XML_PATH_SECURE_IN_FRONTEND) && $this->scopeConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML) && $this->scopeConfig->isSetFlag(Store::XML_PATH_ENABLE_HSTS); } diff --git a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php index a0bd015c15061..5dbe65141f184 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php +++ b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php @@ -45,7 +45,7 @@ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $ */ public function canApply() { - return (bool)$this->scopeConfig->isSetFlag(Store::XML_PATH_SECURE_IN_FRONTEND) + return $this->scopeConfig->isSetFlag(Store::XML_PATH_SECURE_IN_FRONTEND) && $this->scopeConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML) && $this->scopeConfig->isSetFlag(Store::XML_PATH_ENABLE_UPGRADE_INSECURE); } diff --git a/app/code/Magento/Store/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php index 445824baadfe0..0f2d0c90bd51a 100644 --- a/app/code/Magento/Store/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -291,9 +291,9 @@ function ($item) { */ protected function isSingleStoreModeEnabled() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( self::XML_PATH_SINGLE_STORE_MODE_ENABLED, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } diff --git a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php index 75df3027ad9a9..233b7a804d94d 100644 --- a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php @@ -7,6 +7,7 @@ namespace Magento\Wishlist\Model\Rss; use Magento\Framework\App\Rss\DataProviderInterface; +use Magento\Store\Model\ScopeInterface; /** * Wishlist RSS model @@ -114,17 +115,18 @@ public function __construct( */ public function isAllowed() { - return (bool)$this->scopeConfig->getValue( + return $this->scopeConfig->isSetFlag( 'rss/wishlist/active', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); } - /** - * Get RSS feed items - * - * @return array - */ + /** + * Get RSS feed items + * + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getRssData() { $wishlist = $this->getWishlist(); diff --git a/lib/internal/Magento/Framework/Session/SidResolver.php b/lib/internal/Magento/Framework/Session/SidResolver.php index feb4877028dae..90ee7541a5d6a 100644 --- a/lib/internal/Magento/Framework/Session/SidResolver.php +++ b/lib/internal/Magento/Framework/Session/SidResolver.php @@ -85,10 +85,12 @@ public function __construct( $this->appState = $appState ?: \Magento\Framework\App\ObjectManager::getInstance()->get(State::class); } - /** - * @param SessionManagerInterface $session - * @return string|null - */ + /** + * @param SessionManagerInterface $session + * + * @return string|null + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getSid(SessionManagerInterface $session) { if ($this->appState->getAreaCode() !== \Magento\Framework\App\Area::AREA_FRONTEND) { @@ -169,7 +171,7 @@ public function getUseSessionInUrl() if ($this->_useSessionInUrl === null) { //Using config value by default, can be overridden by using the //setter. - $this->_useSessionInUrl = (bool)$this->scopeConfig->getValue( + $this->_useSessionInUrl = $this->scopeConfig->getValue( self::XML_PATH_USE_FRONTEND_SID, $this->_scopeType ); diff --git a/lib/internal/Magento/Framework/View/Asset/Config.php b/lib/internal/Magento/Framework/View/Asset/Config.php index 2a3d0d3dad467..6a0548b3395a0 100644 --- a/lib/internal/Magento/Framework/View/Asset/Config.php +++ b/lib/internal/Magento/Framework/View/Asset/Config.php @@ -8,7 +8,6 @@ use Magento\Store\Model\ScopeInterface; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\App\State; /** * View asset configuration interface @@ -55,7 +54,7 @@ public function __construct(ScopeConfigInterface $scopeConfig) */ public function isMergeCssFiles() { - return (bool)$this->scopeConfig->isSetFlag( + return $this->scopeConfig->isSetFlag( self::XML_PATH_MERGE_CSS_FILES, ScopeInterface::SCOPE_STORE ); @@ -68,7 +67,7 @@ public function isMergeCssFiles() */ public function isBundlingJsFiles() { - return (bool)$this->scopeConfig->isSetFlag( + return $this->scopeConfig->isSetFlag( self::XML_PATH_JS_BUNDLING, ScopeInterface::SCOPE_STORE ); @@ -81,7 +80,7 @@ public function isBundlingJsFiles() */ public function isMergeJsFiles() { - return (bool)$this->scopeConfig->isSetFlag( + return $this->scopeConfig->isSetFlag( self::XML_PATH_MERGE_JS_FILES, ScopeInterface::SCOPE_STORE ); @@ -94,7 +93,7 @@ public function isMergeJsFiles() */ public function isMinifyHtml() { - return (bool)$this->scopeConfig->isSetFlag( + return $this->scopeConfig->isSetFlag( self::XML_PATH_MINIFICATION_HTML, ScopeInterface::SCOPE_STORE ); diff --git a/lib/internal/Magento/Framework/View/Asset/Minification.php b/lib/internal/Magento/Framework/View/Asset/Minification.php index 596add349dbfa..ceee78469f090 100644 --- a/lib/internal/Magento/Framework/View/Asset/Minification.php +++ b/lib/internal/Magento/Framework/View/Asset/Minification.php @@ -64,7 +64,7 @@ public function isEnabled($contentType) if (!isset($this->configCache[self::XML_PATH_MINIFICATION_ENABLED][$contentType])) { $this->configCache[self::XML_PATH_MINIFICATION_ENABLED][$contentType] = $this->appState->getMode() != State::MODE_DEVELOPER && - (bool)$this->scopeConfig->isSetFlag( + $this->scopeConfig->isSetFlag( sprintf(self::XML_PATH_MINIFICATION_ENABLED, $contentType), $this->scope ); From 7674152461aeaee9de3b53534c2868c83f0dc2af Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Tue, 18 Sep 2018 21:31:21 +0300 Subject: [PATCH 02/12] Fix Tests --- .../Model/Recommendations/DataProvider.php | 35 +++-- .../CatalogInventory/Model/Configuration.php | 40 +++-- .../Test/Unit/Model/ConfigurationTest.php | 2 +- app/code/Magento/Checkout/Helper/Data.php | 34 +++-- .../Checkout/Test/Unit/Helper/DataTest.php | 2 +- app/code/Magento/Customer/Helper/Address.php | 104 +++++++------ .../Customer/Model/AccountConfirmation.php | 10 +- .../Customer/Test/Unit/Helper/AddressTest.php | 8 +- .../Unit/Model/AccountConfirmationTest.php | 2 +- .../Component/DataProvider/DocumentTest.php | 2 +- .../Ui/Component/DataProvider/Document.php | 37 +++-- app/code/Magento/Directory/Helper/Data.php | 36 ++--- .../Directory/Test/Unit/Helper/DataTest.php | 1 + .../Model/DataProvider/Suggestions.php | 35 ++++- .../Model/GiftMessageConfigProvider.php | 29 ++-- .../Model/GiftMessageConfigProviderTest.php | 2 +- .../Magento/GoogleOptimizer/Helper/Data.php | 12 +- app/code/Magento/Msrp/Model/Config.php | 15 +- .../NewRelicReporting/Model/Config.php | 3 + .../Magento/Reports/Model/ReportStatus.php | 10 +- .../Model/ResourceModel/Catalog/Product.php | 67 +++++---- .../Magento/Store/Model/BaseUrlChecker.php | 8 +- .../Store/Model/HeaderProvider/Hsts.php | 12 +- .../Model/HeaderProvider/UpgradeInsecure.php | 12 +- app/code/Magento/Store/Model/StoreManager.php | 140 ++++++++++++------ .../Test/Unit/Model/BaseUrlCheckerTest.php | 21 +-- .../Magento/Wishlist/Model/Rss/Wishlist.php | 25 +++- .../Test/Unit/Model/Rss/WishlistTest.php | 2 +- .../Framework/View/Asset/Minification.php | 6 + 29 files changed, 456 insertions(+), 256 deletions(-) diff --git a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php index 77df85e52003c..c1103e514e0f0 100644 --- a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php +++ b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php @@ -10,6 +10,9 @@ use Magento\Search\Model\QueryInterface; use Magento\AdvancedSearch\Model\SuggestedQueriesInterface; +/** + * Class DataProvider + */ class DataProvider implements SuggestedQueriesInterface { /** @@ -50,12 +53,14 @@ class DataProvider implements SuggestedQueriesInterface */ private $recommendationsFactory; - /** - * @param ScopeConfigInterface $scopeConfig - * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver - * @param \Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory $recommendationsFactory - * @param \Magento\Search\Model\QueryResultFactory $queryResultFactory - */ + /** + * DataProvider constructor. + * + * @param ScopeConfigInterface $scopeConfig + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver + * @param \Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory $recommendationsFactory + * @param \Magento\Search\Model\QueryResultFactory $queryResultFactory + */ public function __construct( ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Layer\Resolver $layerResolver, @@ -69,6 +74,8 @@ public function __construct( } /** + * Is Results Count Enabled + * * @return bool */ public function isResultsCountEnabled() @@ -79,9 +86,13 @@ public function isResultsCountEnabled() ); } - /** - * {@inheritdoc} - */ + /** + * Get Items + * + * @param QueryInterface $query + * + * @return array|\Magento\Search\Model\QueryResult[] + */ public function getItems(QueryInterface $query) { $recommendations = []; @@ -102,6 +113,8 @@ public function getItems(QueryInterface $query) } /** + * Return Search Recommendations + * * @param QueryInterface $query * @return array */ @@ -126,6 +139,8 @@ private function getSearchRecommendations(\Magento\Search\Model\QueryInterface $ } /** + * Is Search Recommendations Enabled + * * @return bool */ private function isSearchRecommendationsEnabled() @@ -137,6 +152,8 @@ private function isSearchRecommendationsEnabled() } /** + * Return Search Recommendations Count + * * @return int */ private function getSearchRecommendationsCount() diff --git a/app/code/Magento/CatalogInventory/Model/Configuration.php b/app/code/Magento/CatalogInventory/Model/Configuration.php index b0f8aebf1da26..a303b15d11a4e 100644 --- a/app/code/Magento/CatalogInventory/Model/Configuration.php +++ b/app/code/Magento/CatalogInventory/Model/Configuration.php @@ -131,12 +131,14 @@ class Configuration implements StockConfigurationInterface */ protected $storeManager; - /** - * @param ConfigInterface $config - * @param ScopeConfigInterface $scopeConfig - * @param MinsaleqtyHelper $minsaleqtyHelper - * @param StoreManagerInterface $storeManager - */ + /** + * Configuration constructor. + * + * @param ConfigInterface $config + * @param ScopeConfigInterface $scopeConfig + * @param MinsaleqtyHelper $minsaleqtyHelper + * @param StoreManagerInterface $storeManager + */ public function __construct( ConfigInterface $config, ScopeConfigInterface $scopeConfig, @@ -149,9 +151,11 @@ public function __construct( $this->storeManager = $storeManager; } - /** - * {@inheritdoc} - */ + /** + * Default Scope Id + * + * @return int + */ public function getDefaultScopeId() { // TODO: should be fixed in MAGETWO-46043 @@ -160,6 +164,8 @@ public function getDefaultScopeId() } /** + * Is Qty Type Ids + * * @param int|null $filter * @return array */ @@ -183,6 +189,8 @@ public function getIsQtyTypeIds($filter = null) } /** + * Is Qty + * * @param int $productTypeId * @return bool */ @@ -208,6 +216,8 @@ public function canSubtractQty($store = null) } /** + * Get Min Qty + * * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return float */ @@ -221,6 +231,8 @@ public function getMinQty($store = null) } /** + * Get Min Sale Qty + * * @param null|string|bool|int|\Magento\Store\Model\Store $store * @param int $customerGroupId * @return float @@ -231,6 +243,8 @@ public function getMinSaleQty($store = null, $customerGroupId = null) } /** + * Get Max Sale Qty + * * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return float|null */ @@ -244,6 +258,8 @@ public function getMaxSaleQty($store = null) } /** + * Get Notify Stock Qty + * * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return float */ @@ -273,6 +289,8 @@ public function getEnableQtyIncrements($store = null) } /** + * Get Qty Increments + * * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return float */ @@ -378,6 +396,8 @@ public function isDisplayProductStockStatus($store = null) } /** + * Get Default Config Value + * * @param string $field * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return string|null @@ -392,6 +412,8 @@ public function getDefaultConfigValue($field, $store = null) } /** + * Get Stock Threshold Qty + * * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return string|null */ diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php index d2779b79b30d7..cefc4ada7d212 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/ConfigurationTest.php @@ -144,7 +144,7 @@ public function testGetEnableQtyIncrements() $store = 1; $this->scopeConfigMock->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with( Configuration::XML_PATH_ENABLE_QTY_INCREMENTS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 5a920ee2f5d8a..eb96913806f06 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -58,17 +58,19 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ private $paymentFailures; - /** - * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation - * @param PriceCurrencyInterface $priceCurrency - * @param PaymentFailuresInterface|null $paymentFailures - * @codeCoverageIgnore - */ + /** + * Data constructor. + * + * @param \Magento\Framework\App\Helper\Context $context + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + * @param PriceCurrencyInterface $priceCurrency + * @param PaymentFailuresInterface|null $paymentFailures + * @codeCoverageIgnore + */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -113,6 +115,7 @@ public function getQuote() } /** + * Format Price * @param float $price * @return string */ @@ -127,6 +130,8 @@ public function formatPrice($price) } /** + * Convert Price + * * @param float $price * @param bool $format * @return float @@ -184,6 +189,8 @@ public function getSubtotalInclTax($item) } /** + * Get Base Price Incl Tax + * * @param AbstractItem $item * @return float */ @@ -196,6 +203,8 @@ public function getBasePriceInclTax($item) } /** + * Get Base Subtotal Incl Tax + * * @param AbstractItem $item * @return float */ @@ -224,6 +233,8 @@ public function sendPaymentFailedEmail( } /** + * Get Emails + * * @param string $configPath * @param null|string|bool|int|Store $storeId * @return array|false @@ -302,6 +313,7 @@ public function isCustomerMustBeLogged() /** * Checks if display billing address on payment method is available, otherwise * billing address should be display on payment page + * * @return bool */ public function isDisplayBillingOnPaymentMethodAvailable() diff --git a/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php b/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php index 53132ffaa748b..089ea15726c68 100644 --- a/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php @@ -179,7 +179,7 @@ public function testConvertPrice() public function testCanOnepageCheckout() { - $this->scopeConfig->expects($this->once())->method('getValue')->with( + $this->scopeConfig->expects($this->once())->method('isSetFlag')->with( 'checkout/options/onepage_checkout_enabled', 'store' )->will($this->returnValue(true)); diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php index 8e867c891d932..a05a4845f4a4d 100644 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -96,6 +96,8 @@ class Address extends \Magento\Framework\App\Helper\AbstractHelper protected $_addressConfig; /** + * Address constructor. + * * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\View\Element\BlockFactory $blockFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager @@ -129,6 +131,8 @@ public function getBookUrl() } /** + * Edit Url + * * @return void */ public function getEditUrl() @@ -136,6 +140,8 @@ public function getEditUrl() } /** + * Delete Url + * * @return void */ public function getDeleteUrl() @@ -143,6 +149,8 @@ public function getDeleteUrl() } /** + * Create Url + * * @return void */ public function getCreateUrl() @@ -150,6 +158,8 @@ public function getCreateUrl() } /** + * Get Renderer + * * @param BlockInterface|string $renderer * @return BlockInterface */ @@ -162,15 +172,15 @@ public function getRenderer($renderer) } } - /** - * Return customer address config value by key and store - * - * @param string $key - * @param \Magento\Store\Model\Store|int|string $store - * - * @return string|null - * @throws NoSuchEntityException - */ + /** + * Return customer address config value by key and store + * + * @param string $key + * @param \Magento\Store\Model\Store|int|string $store + * + * @return string|null + * @throws NoSuchEntityException + */ public function getConfig($key, $store = null) { $store = $this->_storeManager->getStore($store); @@ -185,15 +195,15 @@ public function getConfig($key, $store = null) return isset($this->_config[$websiteId][$key]) ? (string)$this->_config[$websiteId][$key] : null; } - /** - * Return Number of Lines in a Street Address for store - * - * @param \Magento\Store\Model\Store|int|string $store - * - * @return int - * @throws NoSuchEntityException - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Return Number of Lines in a Street Address for store + * + * @param \Magento\Store\Model\Store|int|string $store + * + * @return int + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getStreetLines($store = null) { $websiteId = $this->_storeManager->getStore($store)->getWebsiteId(); @@ -211,6 +221,8 @@ public function getStreetLines($store = null) } /** + * Get Format + * * @param string $code * @return Format|string */ @@ -235,29 +247,29 @@ public function getFormatTypeRenderer($code) return $formatType->getRenderer(); } - /** - * Determine if specified address config value can be shown - * - * @param string $key - * - * @return bool - * @throws NoSuchEntityException - */ + /** + * Determine if specified address config value can be shown + * + * @param string $key + * + * @return bool + * @throws NoSuchEntityException + */ public function canShowConfig($key) { return (bool)$this->getConfig($key); } - /** - * Get string with frontend validation classes for attribute - * - * @param string $attributeCode - * - * @return string - * - * @SuppressWarnings(PHPMD.NPathComplexity) - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Get string with frontend validation classes for attribute + * + * @param string $attributeCode + * + * @return string + * + * @SuppressWarnings(PHPMD.NPathComplexity) + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getAttributeValidationClass($attributeCode) { $class = ''; @@ -387,16 +399,16 @@ public function isVatAttributeVisible() ); } - /** - * Retrieve attribute visibility - * - * @param string $code - * - * @return bool - * @throws NoSuchEntityException - * @throws \Magento\Framework\Exception\LocalizedException - * @since 100.2.0 - */ + /** + * Retrieve attribute visibility + * + * @param string $code + * + * @return bool + * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\LocalizedException + * @since 100.2.0 + */ public function isAttributeVisible($code) { $attributeMetadata = $this->_addressMetadataService->getAttributeMetadata($code); diff --git a/app/code/Magento/Customer/Model/AccountConfirmation.php b/app/code/Magento/Customer/Model/AccountConfirmation.php index 3c473dec78400..cb35c16c7f3bf 100644 --- a/app/code/Magento/Customer/Model/AccountConfirmation.php +++ b/app/code/Magento/Customer/Model/AccountConfirmation.php @@ -30,10 +30,12 @@ class AccountConfirmation */ private $registry; - /** - * @param ScopeConfigInterface $scopeConfig - * @param Registry $registry - */ + /** + * AccountConfirmation constructor. + * + * @param ScopeConfigInterface $scopeConfig + * @param Registry $registry + */ public function __construct( ScopeConfigInterface $scopeConfig, Registry $registry diff --git a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php index 74af4ec57c77f..fe0c495e8c44a 100644 --- a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php +++ b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php @@ -212,7 +212,7 @@ public function getConvertStreetLinesDataProvider() public function testIsVatValidationEnabled($store, $result) { $this->scopeConfig->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with( \Magento\Customer\Helper\Address::XML_PATH_VAT_VALIDATION_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, @@ -242,7 +242,7 @@ public function getVatValidationEnabledDataProvider() public function testHasValidateOnEachTransaction($store, $result) { $this->scopeConfig->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with( \Magento\Customer\Helper\Address::XML_PATH_VIV_ON_EACH_TRANSACTION, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, @@ -297,7 +297,7 @@ public function getTaxCalculationAddressTypeDataProvider() public function testIsDisableAutoGroupAssignDefaultValue() { $this->scopeConfig->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with( \Magento\Customer\Helper\Address::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE @@ -309,7 +309,7 @@ public function testIsDisableAutoGroupAssignDefaultValue() public function testIsVatAttributeVisible() { $this->scopeConfig->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with( \Magento\Customer\Helper\Address::XML_PATH_VAT_FRONTEND_VISIBILITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountConfirmationTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountConfirmationTest.php index ae246665b28ed..1ce80d9d1e99b 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountConfirmationTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountConfirmationTest.php @@ -59,7 +59,7 @@ public function testIsConfirmationRequired( $websiteId = 1; $this->scopeConfig->expects($this->any()) - ->method('getValue') + ->method('isSetFlag') ->with( $this->accountConfirmation::XML_PATH_IS_CONFIRM, ScopeInterface::SCOPE_WEBSITES, diff --git a/app/code/Magento/Customer/Test/Unit/Ui/Component/DataProvider/DocumentTest.php b/app/code/Magento/Customer/Test/Unit/Ui/Component/DataProvider/DocumentTest.php index 1d7905cca7941..a9c6de72acbef 100644 --- a/app/code/Magento/Customer/Test/Unit/Ui/Component/DataProvider/DocumentTest.php +++ b/app/code/Magento/Customer/Test/Unit/Ui/Component/DataProvider/DocumentTest.php @@ -175,7 +175,7 @@ public function testGetConfirmationAttribute() $this->document->setData('original_website_id', $websiteId); $this->scopeConfig->expects(static::once()) - ->method('getValue') + ->method('isSetFlag') ->with() ->willReturn(true); diff --git a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php index 89a3c2e855f6f..ce77cec6788f5 100644 --- a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php +++ b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php @@ -72,6 +72,7 @@ class Document extends \Magento\Framework\View\Element\UiComponent\DataProvider\ /** * Document constructor. + * * @param AttributeValueFactory $attributeValueFactory * @param GroupRepositoryInterface $groupRepository * @param CustomerMetadataInterface $customerMetadata @@ -93,7 +94,12 @@ public function __construct( } /** - * @inheritdoc + * Get Custom Attribute + * + * @param string $attributeCode + * + * @return \Magento\Framework\Api\AttributeInterface|null + * @throws \Magento\Framework\Exception\LocalizedException */ public function getCustomAttribute($attributeCode) { @@ -117,12 +123,13 @@ public function getCustomAttribute($attributeCode) return parent::getCustomAttribute($attributeCode); } - /** - * Update customer gender value - * Method set gender label instead of id value - * @return void - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Update customer gender value + * Method set gender label instead of id value + * + * @return void + * @throws \Magento\Framework\Exception\LocalizedException + */ private function setGenderValue() { $value = $this->getData(self::$genderAttributeCode); @@ -141,12 +148,13 @@ private function setGenderValue() } } - /** - * Update customer group value - * Method set group code instead id value - * @return void - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Update customer group value + * Method set group code instead id value + * + * @return void + * @throws \Magento\Framework\Exception\LocalizedException + */ private function setCustomerGroupValue() { $value = $this->getData(self::$groupAttributeCode); @@ -161,6 +169,7 @@ private function setCustomerGroupValue() /** * Update website value * Method set website name instead id value + * * @return void */ private function setWebsiteValue() @@ -174,6 +183,7 @@ private function setWebsiteValue() /** * Update confirmation value * Method set confirmation text value to match what is shown in grid + * * @return void */ private function setConfirmationValue() @@ -197,6 +207,7 @@ private function setConfirmationValue() /** * Update lock expires value * Method set account lock text value to match what is shown in grid + * * @return void */ private function setAccountLockValue() diff --git a/app/code/Magento/Directory/Helper/Data.php b/app/code/Magento/Directory/Helper/Data.php index 3f1e272345ed8..3617bf52d720f 100644 --- a/app/code/Magento/Directory/Helper/Data.php +++ b/app/code/Magento/Directory/Helper/Data.php @@ -112,6 +112,8 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper protected $_currencyFactory; /** + * Data constructor. + * * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\App\Cache\Type\Config $configCacheType * @param \Magento\Directory\Model\ResourceModel\Country\Collection $countryCollection @@ -166,12 +168,12 @@ public function getCountryCollection($store = null) return $this->_countryCollection; } - /** - * Retrieve regions data json - * - * @return string - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ + /** + * Retrieve regions data json + * + * @return string + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ public function getRegionJson() { \Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]); @@ -193,17 +195,17 @@ public function getRegionJson() return $this->_regionJson; } - /** - * Convert currency - * - * @param float $amount - * @param string $from - * @param string $to - * - * @return float - * @SuppressWarnings(PHPMD.ShortVariable) - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ + /** + * Convert currency + * + * @param float $amount + * @param string $from + * @param string $to + * + * @return float + * @SuppressWarnings(PHPMD.ShortVariable) + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ public function currencyConvert($amount, $from, $to = null) { if (empty($this->_currencyCache[$from])) { diff --git a/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php b/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php index 73e9f0f5fa1a5..5d1cf957df71a 100644 --- a/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php @@ -46,6 +46,7 @@ protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->scopeConfigMock = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); + $this->scopeConfigMock->expects($this->any())->method('isSetFlag')->willReturn(false); $context = $this->createMock(\Magento\Framework\App\Helper\Context::class); $context->expects($this->any()) ->method('getScopeConfig') diff --git a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php index 0ab1b626b074f..420300ebd7e87 100644 --- a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php +++ b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php @@ -15,6 +15,9 @@ use Magento\Elasticsearch\SearchAdapter\SearchIndexNameResolver; use Magento\Store\Model\StoreManagerInterface as StoreManager; +/** + * Class Suggestions + */ class Suggestions implements SuggestedQueriesInterface { /** @@ -66,6 +69,8 @@ class Suggestions implements SuggestedQueriesInterface private $storeManager; /** + * Suggestions constructor. + * * @param ScopeConfigInterface $scopeConfig * @param Config $config * @param QueryResultFactory $queryResultFactory @@ -90,8 +95,14 @@ public function __construct( } /** - * {@inheritdoc} + * Get Items + * + * @param QueryInterface $query + * @param null $limit + * @param null $additionalFilters * + * @return array|\Magento\Search\Model\QueryResult[] + * @throws \Magento\Framework\Exception\NoSuchEntityException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getItems(QueryInterface $query, $limit = null, $additionalFilters = null) @@ -118,7 +129,9 @@ public function getItems(QueryInterface $query, $limit = null, $additionalFilter } /** - * {@inheritdoc} + * Is Results Count Enabled + * + * @return bool */ public function isResultsCountEnabled() { @@ -128,12 +141,14 @@ public function isResultsCountEnabled() ); } - /** - * @param QueryInterface $query - * - * @return array - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ + /** + * Get Suggestions + * + * @param QueryInterface $query + * + * @return array + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ private function getSuggestions(QueryInterface $query) { $suggestions = []; @@ -180,6 +195,8 @@ private function getSuggestions(QueryInterface $query) } /** + * Fetch Query + * * @param array $query * @return array */ @@ -202,6 +219,8 @@ private function getSearchSuggestionsCount() } /** + * Is Suggestions Allowed + * * @return bool */ private function isSuggestionsAllowed() diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php index 3001fa411655c..52d43943daf06 100644 --- a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php +++ b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php @@ -42,12 +42,12 @@ class GiftMessageConfigProvider implements ConfigProviderInterface */ protected $checkoutSession; - /** - * @var HttpContext - */ - protected $httpContext; + /** + * @var HttpContext + */ + protected $httpContext; - /** + /** * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -63,6 +63,8 @@ class GiftMessageConfigProvider implements ConfigProviderInterface protected $formKey; /** + * GiftMessageConfigProvider constructor. + * * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\GiftMessage\Api\CartRepositoryInterface $cartRepository * @param \Magento\GiftMessage\Api\ItemRepositoryInterface $itemRepository @@ -93,7 +95,10 @@ public function __construct( } /** - * {@inheritdoc} + * Get Config + * + * @return array + * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function getConfig() { @@ -170,12 +175,12 @@ protected function getOrderLevelGiftMessages() return $this->cartRepository->get($cartId); } - /** - * Load already specified item level gift messages and related configuration. - * - * @return \Magento\GiftMessage\Api\Data\MessageInterface[]|null - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ + /** + * Load already specified item level gift messages and related configuration. + * + * @return \Magento\GiftMessage\Api\Data\MessageInterface[]|null + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ protected function getItemLevelGiftMessages() { $itemLevelConfig = []; diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageConfigProviderTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageConfigProviderTest.php index a5580606134b4..08ebefb68d724 100644 --- a/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageConfigProviderTest.php +++ b/app/code/Magento/GiftMessage/Test/Unit/Model/GiftMessageConfigProviderTest.php @@ -111,7 +111,7 @@ public function testGetConfig() ); $messageMock = $this->createMock(\Magento\GiftMessage\Model\Message::class); - $this->scopeConfigMock->expects($this->atLeastOnce())->method('getValue')->willReturnMap( + $this->scopeConfigMock->expects($this->atLeastOnce())->method('isSetFlag')->willReturnMap( [ [GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, Scope::SCOPE_STORE, null, $orderLevel], [GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, Scope::SCOPE_STORE, null, $itemLevel] diff --git a/app/code/Magento/GoogleOptimizer/Helper/Data.php b/app/code/Magento/GoogleOptimizer/Helper/Data.php index 4929e474949b3..d1e668cc9ec80 100644 --- a/app/code/Magento/GoogleOptimizer/Helper/Data.php +++ b/app/code/Magento/GoogleOptimizer/Helper/Data.php @@ -11,6 +11,8 @@ use \Magento\Store\Model\ScopeInterface; /** + * Class Data + * * @api * @since 100.0.2 */ @@ -31,10 +33,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_analyticsHelper; - /** - * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\GoogleAnalytics\Helper\Data $analyticsHelper - */ + /** + * Data constructor. + * + * @param \Magento\Framework\App\Helper\Context $context + * @param \Magento\GoogleAnalytics\Helper\Data $analyticsHelper + */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\GoogleAnalytics\Helper\Data $analyticsHelper diff --git a/app/code/Magento/Msrp/Model/Config.php b/app/code/Magento/Msrp/Model/Config.php index 7a990e82cbdf7..71ac1b08fd575 100644 --- a/app/code/Magento/Msrp/Model/Config.php +++ b/app/code/Magento/Msrp/Model/Config.php @@ -10,6 +10,9 @@ use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\Escaper; +/** + * Class Config + */ class Config { /**#@+ @@ -39,11 +42,13 @@ class Config */ protected $storeId; - /** - * @param ScopeConfigInterface $scopeConfig - * @param StoreManagerInterface $storeManager - * @param Escaper $escaper - */ + /** + * Config constructor. + * + * @param ScopeConfigInterface $scopeConfig + * @param StoreManagerInterface $storeManager + * @param Escaper $escaper + */ public function __construct( ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, diff --git a/app/code/Magento/NewRelicReporting/Model/Config.php b/app/code/Magento/NewRelicReporting/Model/Config.php index 7c0273334d7ce..b42007aed9da0 100644 --- a/app/code/Magento/NewRelicReporting/Model/Config.php +++ b/app/code/Magento/NewRelicReporting/Model/Config.php @@ -5,6 +5,9 @@ */ namespace Magento\NewRelicReporting\Model; +/** + * Class Config + */ class Config { /**#@+ diff --git a/app/code/Magento/Reports/Model/ReportStatus.php b/app/code/Magento/Reports/Model/ReportStatus.php index 112b9e9ccc45d..13f71c00c7330 100644 --- a/app/code/Magento/Reports/Model/ReportStatus.php +++ b/app/code/Magento/Reports/Model/ReportStatus.php @@ -20,9 +20,11 @@ class ReportStatus */ private $scopeConfig; - /** - * @param ScopeConfigInterface $scopeConfig - */ + /** + * ReportStatus constructor. + * + * @param ScopeConfigInterface $scopeConfig + */ public function __construct(ScopeConfigInterface $scopeConfig) { $this->scopeConfig = $scopeConfig; @@ -42,6 +44,8 @@ public function isReportEnabled(string $reportEventType): bool } /** + * Get Config Path By Event Type + * * @param string $reportEventType * @return string * @throws InputException diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php index 621206d9bbbb3..0d85648c18a1f 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php @@ -105,6 +105,8 @@ class Product extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb private $scopeConfig; /** + * Product constructor. + * * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Sitemap\Helper\Data $sitemapData * @param \Magento\Catalog\Model\ResourceModel\Product $productResource @@ -157,6 +159,8 @@ public function __construct( } /** + * Construct + * * @return void */ protected function _construct() @@ -167,11 +171,13 @@ protected function _construct() /** * Add attribute to filter * - * @param int $storeId + * @param int $storeId * @param string $attributeCode - * @param mixed $value + * @param mixed $value * @param string $type + * * @return \Magento\Framework\DB\Select|bool + * @throws \Magento\Framework\Exception\LocalizedException */ protected function _addFilter($storeId, $attributeCode, $value, $type = '=') { @@ -214,10 +220,12 @@ protected function _addFilter($storeId, $attributeCode, $value, $type = '=') /** * Join attribute by code * - * @param int $storeId + * @param int $storeId * @param string $attributeCode * @param string $column Add attribute value to given column + * * @return void + * @throws \Magento\Framework\Exception\LocalizedException */ protected function _joinAttribute($storeId, $attributeCode, $column = null) { @@ -256,14 +264,14 @@ protected function _joinAttribute($storeId, $attributeCode, $column = null) } } - /** - * Get attribute data by attribute code - * - * @param string $attributeCode - * - * @return array - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Get attribute data by attribute code + * + * @param string $attributeCode + * + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ protected function _getAttribute($attributeCode) { if (!isset($this->_attributesCache[$attributeCode])) { @@ -281,15 +289,16 @@ protected function _getAttribute($attributeCode) return $this->_attributesCache[$attributeCode]; } - /** - * Get category collection array - * - * @param null|string|bool|int|Store $storeId - * - * @return array|bool - * @throws \Magento\Framework\Exception\LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ + /** + * Get category collection array + * + * @param null|string|bool|int|Store $storeId + * + * @return array|bool + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Zend_Db_Statement_Exception + */ public function getCollection($storeId) { $products = []; @@ -348,15 +357,15 @@ public function getCollection($storeId) return $products; } - /** - * Prepare product - * - * @param array $productRow - * @param int $storeId - * - * @return \Magento\Framework\DataObject - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Prepare product + * + * @param array $productRow + * @param int $storeId + * + * @return \Magento\Framework\DataObject + * @throws \Magento\Framework\Exception\LocalizedException + */ protected function _prepareProduct(array $productRow, $storeId) { $product = new \Magento\Framework\DataObject(); diff --git a/app/code/Magento/Store/Model/BaseUrlChecker.php b/app/code/Magento/Store/Model/BaseUrlChecker.php index 6e3defac9a1cd..ee108fe484be1 100644 --- a/app/code/Magento/Store/Model/BaseUrlChecker.php +++ b/app/code/Magento/Store/Model/BaseUrlChecker.php @@ -17,9 +17,11 @@ class BaseUrlChecker */ private $scopeConfig; - /** - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ + /** + * BaseUrlChecker constructor. + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig ) { diff --git a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php index 63afa7ad1fc84..52fd66924b957 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php +++ b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php @@ -32,16 +32,20 @@ class Hsts extends \Magento\Framework\App\Response\HeaderProvider\AbstractHeader */ protected $scopeConfig; - /** - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ + /** + * Hsts constructor. + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + */ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) { $this->scopeConfig = $scopeConfig; } /** - * {@inheritdoc} + * Whether the header should be attached to the response + * + * @return bool */ public function canApply() { diff --git a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php index 5dbe65141f184..cb6b0045e6673 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php +++ b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php @@ -32,16 +32,20 @@ class UpgradeInsecure extends \Magento\Framework\App\Response\HeaderProvider\Abs */ protected $scopeConfig; - /** - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ + /** + * UpgradeInsecure constructor. + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + */ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) { $this->scopeConfig = $scopeConfig; } /** - * {@inheritdoc} + * Whether the header should be attached to the response + * + * @return bool */ public function canApply() { diff --git a/app/code/Magento/Store/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php index 0f2d0c90bd51a..b9ab168f68dc2 100644 --- a/app/code/Magento/Store/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -6,6 +6,7 @@ namespace Magento\Store\Model; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Store\Api\StoreResolverInterface; use Magento\Store\Model\ResourceModel\StoreWebsiteRelation; @@ -86,15 +87,17 @@ class StoreManager implements */ protected $isSingleStoreAllowed; - /** - * @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository - * @param \Magento\Store\Api\GroupRepositoryInterface $groupRepository - * @param \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param StoreResolverInterface $storeResolver - * @param \Magento\Framework\Cache\FrontendInterface $cache - * @param bool $isSingleStoreAllowed - */ + /** + * StoreManager constructor. + * + * @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository + * @param \Magento\Store\Api\GroupRepositoryInterface $groupRepository + * @param \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param StoreResolverInterface $storeResolver + * @param \Magento\Framework\Cache\FrontendInterface $cache + * @param bool $isSingleStoreAllowed + */ public function __construct( \Magento\Store\Api\StoreRepositoryInterface $storeRepository, \Magento\Store\Api\GroupRepositoryInterface $groupRepository, @@ -113,42 +116,54 @@ public function __construct( $this->isSingleStoreAllowed = $isSingleStoreAllowed; } - /** - * {@inheritdoc} - */ + /** + * Set current default store + * + * @param string $store + */ public function setCurrentStore($store) { $this->currentStoreId = $store; } - /** - * {@inheritdoc} - */ + /** + * Allow or disallow single store mode + * + * @param bool $value + */ public function setIsSingleStoreModeAllowed($value) { $this->isSingleStoreAllowed = $value; } - /** - * {@inheritdoc} - */ + /** + * Check if store has only one store view + * + * @return bool + */ public function hasSingleStore() { // TODO: MAGETWO-39902 add cache, move value to consts return $this->isSingleStoreAllowed && count($this->getStores(true)) < 3; } - /** - * {@inheritdoc} - */ + /** + * Check if system is run in the single store mode + * + * @return bool + */ public function isSingleStoreMode() { return $this->isSingleStoreModeEnabled() && $this->hasSingleStore(); } - /** - * {@inheritdoc} - */ + /** + * Retrieve application store object + * + * @param null|string|bool|int|\Magento\Store\Api\Data\StoreInterface $storeId + * @return \Magento\Store\Api\Data\StoreInterface + * @throws NoSuchEntityException If given store doesn't exist. + */ public function getStore($storeId = null) { if (!isset($storeId) || '' === $storeId || $storeId === true) { @@ -170,9 +185,13 @@ public function getStore($storeId = null) return $store; } - /** - * {@inheritdoc} - */ + /** + * Retrieve stores array + * + * @param bool $withDefault + * @param bool $codeKey + * @return \Magento\Store\Api\Data\StoreInterface[] + */ public function getStores($withDefault = false, $codeKey = false) { $stores = []; @@ -189,9 +208,13 @@ public function getStores($withDefault = false, $codeKey = false) return $stores; } - /** - * {@inheritdoc} - */ + /** + * Retrieve application website object + * + * @param null|bool|int|string|\Magento\Store\Api\Data\WebsiteInterface $websiteId + * @return \Magento\Store\Api\Data\WebsiteInterface + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getWebsite($websiteId = null) { if ($websiteId === null || $websiteId === '') { @@ -209,9 +232,13 @@ public function getWebsite($websiteId = null) return $website; } - /** - * {@inheritdoc} - */ + /** + * Get loaded websites + * + * @param bool $withDefault + * @param bool $codeKey + * @return \Magento\Store\Api\Data\WebsiteInterface[] + */ public function getWebsites($withDefault = false, $codeKey = false) { $websites = []; @@ -228,9 +255,11 @@ public function getWebsites($withDefault = false, $codeKey = false) return $websites; } - /** - * {@inheritdoc} - */ + /** + * Reinitialize store list + * + * @return void + */ public function reinitStores() { $this->currentStoreId = null; @@ -241,9 +270,12 @@ public function reinitStores() $this->groupRepository->clean(); } - /** - * {@inheritdoc} - */ + /** + * Retrieve default store for default group and website + * + * @return \Magento\Store\Api\Data\StoreInterface|null + * @throws NoSuchEntityException + */ public function getDefaultStoreView() { $defaultWebsite = $this->websiteRepository->getDefault(); @@ -251,9 +283,14 @@ public function getDefaultStoreView() return $defaultStore ?: null; } - /** - * {@inheritdoc} - */ + /** + * Retrieve application store group object + * + * @param null|\Magento\Store\Api\Data\GroupInterface|string $groupId + * + * @return \Magento\Store\Api\Data\GroupInterface + * @throws NoSuchEntityException + */ public function getGroup($groupId = null) { if (null === $groupId) { @@ -266,9 +303,12 @@ public function getGroup($groupId = null) return $group; } - /** - * {@inheritdoc} - */ + /** + * Prepare array of store groups + * + * @param bool $withDefault + * @return \Magento\Store\Api\Data\GroupInterface[] + */ public function getGroups($withDefault = false) { $groups = $this->groupRepository->getList(); @@ -306,9 +346,13 @@ private function getStoreWebsiteRelation() return ObjectManager::getInstance()->get(StoreWebsiteRelation::class); } - /** - * @inheritdoc - */ + /** + * Get assigned to website store + * + * @param int $websiteId + * + * @return array + */ public function getStoreByWebsiteId($websiteId) { return $this->getStoreWebsiteRelation()->getStoreByWebsiteId($websiteId); diff --git a/app/code/Magento/Store/Test/Unit/Model/BaseUrlCheckerTest.php b/app/code/Magento/Store/Test/Unit/Model/BaseUrlCheckerTest.php index 0eea86da61b3b..78a627c195f81 100644 --- a/app/code/Magento/Store/Test/Unit/Model/BaseUrlCheckerTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/BaseUrlCheckerTest.php @@ -78,9 +78,9 @@ public function testExecute() public function testIsEnabled() { $this->scopeConfig->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with('web/url/redirect_to_base', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) - ->willReturn(1); + ->willReturn(!!1); $this->assertTrue($this->baseUrlChecker->isEnabled()); } @@ -89,15 +89,16 @@ public function testIsEnabled() */ public function testIsFrontendSecure() { - $this->scopeConfig->expects($this->exactly(2)) + $this->scopeConfig->expects($this->once()) ->method('getValue') - ->withConsecutive( - ['web/unsecure/base_url', \Magento\Store\Model\ScopeInterface::SCOPE_STORE], - ['web/secure/use_in_frontend', \Magento\Store\Model\ScopeInterface::SCOPE_STORE] - )->will($this->onConsecutiveCalls( - $this->returnValue('https://localhost'), - 1 - )); + ->with('web/unsecure/base_url', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) + ->willReturn('https://localhost'); + + $this->scopeConfig->expects($this->once()) + ->method('isSetFlag') + ->with('web/secure/use_in_frontend', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) + ->willReturn(!!1); + $this->assertTrue($this->baseUrlChecker->isFrontendSecure()); } } diff --git a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php index 233b7a804d94d..d5beab83cdd2b 100644 --- a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php @@ -11,6 +11,7 @@ /** * Wishlist RSS model + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Wishlist implements DataProviderInterface @@ -71,6 +72,8 @@ class Wishlist implements DataProviderInterface protected $customerFactory; /** + * Wishlist constructor. + * * @param \Magento\Wishlist\Helper\Rss $wishlistHelper * @param \Magento\Wishlist\Block\Customer\Wishlist $wishlistBlock * @param \Magento\Catalog\Helper\Output $outputHelper @@ -121,12 +124,12 @@ public function isAllowed() ); } - /** - * Get RSS feed items - * - * @return array - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Get RSS feed items + * + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getRssData() { $wishlist = $this->getWishlist(); @@ -193,6 +196,8 @@ public function getRssData() } /** + * GetCacheKey + * * @return string */ public function getCacheKey() @@ -201,6 +206,8 @@ public function getCacheKey() } /** + * Get Cache Lifetime + * * @return int */ public function getCacheLifetime() @@ -266,6 +273,8 @@ public function getProductPriceHtml(\Magento\Catalog\Model\Product $product) } /** + * Get Feeds + * * @return array */ public function getFeeds() @@ -274,7 +283,9 @@ public function getFeeds() } /** - * {@inheritdoc} + * Is Auth Required + * + * @return bool */ public function isAuthRequired() { diff --git a/app/code/Magento/Wishlist/Test/Unit/Model/Rss/WishlistTest.php b/app/code/Magento/Wishlist/Test/Unit/Model/Rss/WishlistTest.php index 98d36dea28a2a..85f6c504457d3 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Model/Rss/WishlistTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Model/Rss/WishlistTest.php @@ -278,7 +278,7 @@ protected function processWishlistItemDescription($wishlistModelMock, $staticArg public function testIsAllowed() { - $this->scopeConfig->expects($this->once())->method('getValue') + $this->scopeConfig->expects($this->once())->method('isSetFlag') ->with('rss/wishlist/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) ->will($this->returnValue(true)); $this->assertTrue($this->model->isAllowed()); diff --git a/lib/internal/Magento/Framework/View/Asset/Minification.php b/lib/internal/Magento/Framework/View/Asset/Minification.php index ceee78469f090..087d57ffa4162 100644 --- a/lib/internal/Magento/Framework/View/Asset/Minification.php +++ b/lib/internal/Magento/Framework/View/Asset/Minification.php @@ -112,6 +112,8 @@ public function removeMinifiedSign($filename) } /** + * Is Minified Filename + * * @param string $filename * @return bool */ @@ -121,6 +123,8 @@ public function isMinifiedFilename($filename) } /** + * Is Excluded + * * @param string $filename * @return boolean */ @@ -135,6 +139,8 @@ public function isExcluded($filename) } /** + * Get Excludes + * * @param string $contentType * @return string[] */ From 77822528e599d014d1151e360ffa9f0a7cc94be4 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Tue, 18 Sep 2018 23:02:35 +0300 Subject: [PATCH 03/12] update variable name --- .../Magento/Customer/Ui/Component/DataProvider/Document.php | 4 ++-- .../Elasticsearch/Model/DataProvider/Suggestions.php | 6 +++--- .../Magento/GiftMessage/Model/GiftMessageConfigProvider.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php index ce77cec6788f5..714e2b11daead 100644 --- a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php +++ b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php @@ -190,14 +190,14 @@ private function setConfirmationValue() { $value = $this->getData(self::$confirmationAttributeCode); $websiteId = $this->getData(self::$websiteIdAttributeCode) ?: $this->getData(self::$websiteAttributeCode); - $isConfirmationRequired = $this->scopeConfig->isSetFlag( + $isConfirmRequired = $this->scopeConfig->isSetFlag( AccountManagement::XML_PATH_IS_CONFIRM, ScopeInterface::SCOPE_WEBSITES, $websiteId ); $valueText = __('Confirmation Not Required'); - if ($isConfirmationRequired) { + if ($isConfirmRequired) { $valueText = $value === null ? __('Confirmed') : __('Confirmation Required'); } diff --git a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php index 420300ebd7e87..44c542d04d6cb 100644 --- a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php +++ b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php @@ -219,18 +219,18 @@ private function getSearchSuggestionsCount() } /** - * Is Suggestions Allowed + * Is Search Suggestions Allowed * * @return bool */ private function isSuggestionsAllowed() { - $isSearchSuggestionsEnabled = $this->scopeConfig->isSetFlag( + $isSuggestionsEnabled = $this->scopeConfig->isSetFlag( self::CONFIG_SUGGESTION_ENABLED, ScopeInterface::SCOPE_STORE ); $isEnabled = $this->config->isElasticsearchEnabled(); - $isSuggestionsAllowed = ($isEnabled && $isSearchSuggestionsEnabled); + $isSuggestionsAllowed = ($isEnabled && $isSuggestionsEnabled); return $isSuggestionsAllowed; } } diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php index 52d43943daf06..3d184bf1a77b9 100644 --- a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php +++ b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php @@ -108,7 +108,7 @@ public function getConfig() GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, ScopeInterface::SCOPE_STORE ); - $itemLevelGiftMessageConfiguration = $this->scopeConfiguration->isSetFlag( + $itemLevelGiftMessage = $this->scopeConfiguration->isSetFlag( GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, ScopeInterface::SCOPE_STORE ); @@ -119,7 +119,7 @@ public function getConfig() } $itemMessages = $this->getItemLevelGiftMessages(); - $configuration['isItemLevelGiftOptionsEnabled'] = $itemLevelGiftMessageConfiguration; + $configuration['isItemLevelGiftOptionsEnabled'] = $itemLevelGiftMessage; $configuration['giftMessage']['itemLevel'] = $itemMessages === null ? true : $itemMessages; $configuration['priceFormat'] = $this->localeFormat->getPriceFormat( From 8ed02153e5ef7053b95b8bc1a31e5b6ee501fc63 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Tue, 18 Sep 2018 23:45:58 +0300 Subject: [PATCH 04/12] update variable name --- .../Magento/GiftMessage/Model/GiftMessageConfigProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php index 3d184bf1a77b9..25e728aab7d1b 100644 --- a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php +++ b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php @@ -104,7 +104,7 @@ public function getConfig() { $configuration = []; $configuration['giftMessage'] = []; - $orderLevelGiftMessageConfiguration = $this->scopeConfiguration->isSetFlag( + $orderLevelGiftMessage = $this->scopeConfiguration->isSetFlag( GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, ScopeInterface::SCOPE_STORE ); @@ -112,7 +112,7 @@ public function getConfig() GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, ScopeInterface::SCOPE_STORE ); - if ($orderLevelGiftMessageConfiguration) { + if ($orderLevelGiftMessage) { $orderMessages = $this->getOrderLevelGiftMessages(); $configuration['isOrderLevelGiftOptionsEnabled'] = (bool)$this->isQuoteVirtual() ? false : true; $configuration['giftMessage']['orderLevel'] = $orderMessages === null ? true : $orderMessages->getData(); From ace0bc51c37be9b1e04aa656068a742d6ed84a2a Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Wed, 19 Sep 2018 00:11:12 +0300 Subject: [PATCH 05/12] update variable name --- .../Magento/GiftMessage/Model/GiftMessageConfigProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php index 25e728aab7d1b..82c2b52c97040 100644 --- a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php +++ b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php @@ -104,7 +104,7 @@ public function getConfig() { $configuration = []; $configuration['giftMessage'] = []; - $orderLevelGiftMessage = $this->scopeConfiguration->isSetFlag( + $orderLevelGiftMsg = $this->scopeConfiguration->isSetFlag( GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, ScopeInterface::SCOPE_STORE ); @@ -112,7 +112,7 @@ public function getConfig() GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, ScopeInterface::SCOPE_STORE ); - if ($orderLevelGiftMessage) { + if ($orderLevelGiftMsg) { $orderMessages = $this->getOrderLevelGiftMessages(); $configuration['isOrderLevelGiftOptionsEnabled'] = (bool)$this->isQuoteVirtual() ? false : true; $configuration['giftMessage']['orderLevel'] = $orderMessages === null ? true : $orderMessages->getData(); From 25b15e5feb8b764b538b92d551eaea79541c851b Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Thu, 20 Sep 2018 21:47:55 +0300 Subject: [PATCH 06/12] Update Tests --- .../Model/Recommendations/DataProvider.php | 30 +-- .../CatalogInventory/Model/Configuration.php | 29 ++- app/code/Magento/Checkout/Helper/Data.php | 33 ++-- app/code/Magento/Customer/Helper/Address.php | 2 +- .../Customer/Model/AccountConfirmation.php | 15 +- .../Ui/Component/DataProvider/Document.php | 15 +- app/code/Magento/Directory/Helper/Data.php | 56 +++--- .../Directory/Test/Unit/Helper/DataTest.php | 2 +- .../Model/DataProvider/Suggestions.php | 4 +- .../Magento/GoogleOptimizer/Helper/Data.php | 12 +- app/code/Magento/Msrp/Model/Config.php | 14 +- .../Magento/Reports/Model/ReportStatus.php | 10 +- .../Model/ResourceModel/Catalog/Product.php | 10 +- .../Magento/Store/Model/BaseUrlChecker.php | 10 +- .../Store/Model/HeaderProvider/Hsts.php | 10 +- .../Model/HeaderProvider/UpgradeInsecure.php | 10 +- app/code/Magento/Store/Model/StoreManager.php | 184 +++++++++--------- .../Magento/Wishlist/Model/Rss/Wishlist.php | 2 +- .../Magento/Framework/Session/SidResolver.php | 17 +- 19 files changed, 236 insertions(+), 229 deletions(-) diff --git a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php index c1103e514e0f0..f0d998e19d7f1 100644 --- a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php +++ b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php @@ -53,14 +53,14 @@ class DataProvider implements SuggestedQueriesInterface */ private $recommendationsFactory; - /** - * DataProvider constructor. - * - * @param ScopeConfigInterface $scopeConfig - * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver - * @param \Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory $recommendationsFactory - * @param \Magento\Search\Model\QueryResultFactory $queryResultFactory - */ + /** + * DataProvider constructor. + * + * @param ScopeConfigInterface $scopeConfig + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver + * @param \Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory $recommendationsFactory + * @param \Magento\Search\Model\QueryResultFactory $queryResultFactory + */ public function __construct( ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Layer\Resolver $layerResolver, @@ -86,13 +86,13 @@ public function isResultsCountEnabled() ); } - /** - * Get Items - * - * @param QueryInterface $query - * - * @return array|\Magento\Search\Model\QueryResult[] - */ + /** + * Get Items + * + * @param QueryInterface $query + * + * @return array|\Magento\Search\Model\QueryResult[] + */ public function getItems(QueryInterface $query) { $recommendations = []; diff --git a/app/code/Magento/CatalogInventory/Model/Configuration.php b/app/code/Magento/CatalogInventory/Model/Configuration.php index a303b15d11a4e..a18fe053d5cef 100644 --- a/app/code/Magento/CatalogInventory/Model/Configuration.php +++ b/app/code/Magento/CatalogInventory/Model/Configuration.php @@ -131,14 +131,14 @@ class Configuration implements StockConfigurationInterface */ protected $storeManager; - /** - * Configuration constructor. - * - * @param ConfigInterface $config - * @param ScopeConfigInterface $scopeConfig - * @param MinsaleqtyHelper $minsaleqtyHelper - * @param StoreManagerInterface $storeManager - */ + /** + * Configuration constructor. + * + * @param ConfigInterface $config + * @param ScopeConfigInterface $scopeConfig + * @param MinsaleqtyHelper $minsaleqtyHelper + * @param StoreManagerInterface $storeManager + */ public function __construct( ConfigInterface $config, ScopeConfigInterface $scopeConfig, @@ -151,11 +151,11 @@ public function __construct( $this->storeManager = $storeManager; } - /** - * Default Scope Id - * - * @return int - */ + /** + * Default Scope Id + * + * @return int + */ public function getDefaultScopeId() { // TODO: should be fixed in MAGETWO-46043 @@ -380,8 +380,7 @@ public function isAutoReturnEnabled($store = null) } /** - * Get 'Display product stock status' option value - * Shows if it is necessary to show product stock status ('in stock'/'out of stock') + * Display product stock status. Shows if it is necessary to show product stock status in stock/out of stock. * * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return bool diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index eb96913806f06..40bdf93d161ed 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -58,19 +58,19 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ private $paymentFailures; - /** - * Data constructor. - * - * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation - * @param PriceCurrencyInterface $priceCurrency - * @param PaymentFailuresInterface|null $paymentFailures - * @codeCoverageIgnore - */ + /** + * Data constructor. + * + * @param \Magento\Framework\App\Helper\Context $context + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + * @param PriceCurrencyInterface $priceCurrency + * @param PaymentFailuresInterface|null $paymentFailures + * @codeCoverageIgnore + */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -116,6 +116,7 @@ public function getQuote() /** * Format Price + * * @param float $price * @return string */ @@ -253,8 +254,7 @@ protected function _getEmails($configPath, $storeId) } /** - * Check is allowed Guest Checkout - * Use config settings and observer + * Check is allowed Guest Checkout. Use config settings and observer * * @param \Magento\Quote\Model\Quote $quote * @param int|Store $store @@ -311,8 +311,7 @@ public function isCustomerMustBeLogged() } /** - * Checks if display billing address on payment method is available, otherwise - * billing address should be display on payment page + * If display billing address on payment method is available, otherwise should be display on payment page * * @return bool */ diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php index a05a4845f4a4d..cae8ea16c6348 100644 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -175,7 +175,7 @@ public function getRenderer($renderer) /** * Return customer address config value by key and store * - * @param string $key + * @param string $key * @param \Magento\Store\Model\Store|int|string $store * * @return string|null diff --git a/app/code/Magento/Customer/Model/AccountConfirmation.php b/app/code/Magento/Customer/Model/AccountConfirmation.php index cb35c16c7f3bf..f29330af25874 100644 --- a/app/code/Magento/Customer/Model/AccountConfirmation.php +++ b/app/code/Magento/Customer/Model/AccountConfirmation.php @@ -10,8 +10,7 @@ use Magento\Framework\Registry; /** - * Class AccountConfirmation. - * Checks if email confirmation required for customer. + * Class AccountConfirmation. Checks if email confirmation required for customer. */ class AccountConfirmation { @@ -30,12 +29,12 @@ class AccountConfirmation */ private $registry; - /** - * AccountConfirmation constructor. - * - * @param ScopeConfigInterface $scopeConfig - * @param Registry $registry - */ + /** + * AccountConfirmation constructor. + * + * @param ScopeConfigInterface $scopeConfig + * @param Registry $registry + */ public function __construct( ScopeConfigInterface $scopeConfig, Registry $registry diff --git a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php index 714e2b11daead..9180268ac5cc6 100644 --- a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php +++ b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php @@ -124,8 +124,7 @@ public function getCustomAttribute($attributeCode) } /** - * Update customer gender value - * Method set gender label instead of id value + * Update customer gender value. Method set gender label instead of id value * * @return void * @throws \Magento\Framework\Exception\LocalizedException @@ -149,8 +148,7 @@ private function setGenderValue() } /** - * Update customer group value - * Method set group code instead id value + * Update customer group value. Method set group code instead id value * * @return void * @throws \Magento\Framework\Exception\LocalizedException @@ -167,8 +165,7 @@ private function setCustomerGroupValue() } /** - * Update website value - * Method set website name instead id value + * Update website value. Method set website name instead id value * * @return void */ @@ -181,8 +178,7 @@ private function setWebsiteValue() } /** - * Update confirmation value - * Method set confirmation text value to match what is shown in grid + * Update confirmation value. Method set confirmation text value to match what is shown in grid * * @return void */ @@ -205,8 +201,7 @@ private function setConfirmationValue() } /** - * Update lock expires value - * Method set account lock text value to match what is shown in grid + * Update lock expires value. Method set account lock text value to match what is shown in grid * * @return void */ diff --git a/app/code/Magento/Directory/Helper/Data.php b/app/code/Magento/Directory/Helper/Data.php index 3617bf52d720f..14619ce9bfc50 100644 --- a/app/code/Magento/Directory/Helper/Data.php +++ b/app/code/Magento/Directory/Helper/Data.php @@ -7,7 +7,14 @@ namespace Magento\Directory\Helper; use Magento\Directory\Model\Currency; +use Magento\Directory\Model\CurrencyFactory; +use Magento\Directory\Model\ResourceModel\Country\Collection; +use Magento\Directory\Model\ResourceModel\Region\CollectionFactory; +use Magento\Framework\App\Cache\Type\Config; +use Magento\Framework\App\Helper\Context; +use Magento\Framework\Json\Helper\Data as JsonData; use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; /** * Directory data helper @@ -54,7 +61,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Country collection * - * @var \Magento\Directory\Model\ResourceModel\Country\Collection + * @var Collection */ protected $_countryCollection; @@ -87,49 +94,49 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper protected $_optZipCountries = null; /** - * @var \Magento\Framework\App\Cache\Type\Config + * @var Config */ protected $_configCacheType; /** - * @var \Magento\Directory\Model\ResourceModel\Region\CollectionFactory + * @var CollectionFactory */ protected $_regCollectionFactory; /** - * @var \Magento\Framework\Json\Helper\Data + * @var JsonData */ protected $jsonHelper; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Directory\Model\CurrencyFactory + * @var CurrencyFactory */ protected $_currencyFactory; /** * Data constructor. * - * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Framework\App\Cache\Type\Config $configCacheType - * @param \Magento\Directory\Model\ResourceModel\Country\Collection $countryCollection - * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regCollectionFactory, - * @param \Magento\Framework\Json\Helper\Data $jsonHelper - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory + * @param Context $context + * @param Config $configCacheType + * @param Collection $countryCollection + * @param CollectionFactory $regCollectionFactory, + * @param JsonData $jsonHelper + * @param StoreManagerInterface $storeManager + * @param CurrencyFactory currencyFactory */ public function __construct( - \Magento\Framework\App\Helper\Context $context, - \Magento\Framework\App\Cache\Type\Config $configCacheType, - \Magento\Directory\Model\ResourceModel\Country\Collection $countryCollection, - \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regCollectionFactory, - \Magento\Framework\Json\Helper\Data $jsonHelper, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Directory\Model\CurrencyFactory $currencyFactory + Context $context, + Config $configCacheType, + Collection $countryCollection, + CollectionFactory $regCollectionFactory, + JsonData $jsonHelper, + StoreManagerInterface $storeManager, + CurrencyFactory $currencyFactory ) { parent::__construct($context); $this->_configCacheType = $configCacheType; @@ -158,7 +165,7 @@ public function getRegionCollection() * Retrieve country collection * * @param null|int|string|\Magento\Store\Model\Store $store - * @return \Magento\Directory\Model\ResourceModel\Country\Collection + * @return Collection */ public function getCountryCollection($store = null) { @@ -198,7 +205,7 @@ public function getRegionJson() /** * Convert currency * - * @param float $amount + * @param float $amount * @param string $from * @param string $to * @@ -309,7 +316,10 @@ public function isRegionRequired($countryId) */ public function getBaseCurrencyCode() { - return $this->scopeConfig->getValue( Currency::XML_PATH_CURRENCY_BASE, 'default'); + return $this->scopeConfig->getValue( + Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); } /** diff --git a/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php b/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php index 5d1cf957df71a..6ff0f8ea0f30b 100644 --- a/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Directory/Test/Unit/Helper/DataTest.php @@ -46,7 +46,7 @@ protected function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->scopeConfigMock = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); - $this->scopeConfigMock->expects($this->any())->method('isSetFlag')->willReturn(false); + $this->scopeConfigMock->expects($this->any())->method('isSetFlag')->willReturn(false); $context = $this->createMock(\Magento\Framework\App\Helper\Context::class); $context->expects($this->any()) ->method('getScopeConfig') diff --git a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php index 44c542d04d6cb..6338851bd2ff4 100644 --- a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php +++ b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php @@ -98,14 +98,12 @@ public function __construct( * Get Items * * @param QueryInterface $query - * @param null $limit - * @param null $additionalFilters * * @return array|\Magento\Search\Model\QueryResult[] * @throws \Magento\Framework\Exception\NoSuchEntityException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getItems(QueryInterface $query, $limit = null, $additionalFilters = null) + public function getItems(QueryInterface $query) { $result = []; if ($this->isSuggestionsAllowed()) { diff --git a/app/code/Magento/GoogleOptimizer/Helper/Data.php b/app/code/Magento/GoogleOptimizer/Helper/Data.php index d1e668cc9ec80..7138a7729fe0e 100644 --- a/app/code/Magento/GoogleOptimizer/Helper/Data.php +++ b/app/code/Magento/GoogleOptimizer/Helper/Data.php @@ -33,12 +33,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper */ protected $_analyticsHelper; - /** - * Data constructor. - * - * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\GoogleAnalytics\Helper\Data $analyticsHelper - */ + /** + * Data constructor. + * + * @param \Magento\Framework\App\Helper\Context $context + * @param \Magento\GoogleAnalytics\Helper\Data $analyticsHelper + */ public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\GoogleAnalytics\Helper\Data $analyticsHelper diff --git a/app/code/Magento/Msrp/Model/Config.php b/app/code/Magento/Msrp/Model/Config.php index 71ac1b08fd575..3662a2cef8d20 100644 --- a/app/code/Magento/Msrp/Model/Config.php +++ b/app/code/Magento/Msrp/Model/Config.php @@ -42,13 +42,13 @@ class Config */ protected $storeId; - /** - * Config constructor. - * - * @param ScopeConfigInterface $scopeConfig - * @param StoreManagerInterface $storeManager - * @param Escaper $escaper - */ + /** + * Config constructor. + * + * @param ScopeConfigInterface $scopeConfig + * @param StoreManagerInterface $storeManager + * @param Escaper $escaper + */ public function __construct( ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, diff --git a/app/code/Magento/Reports/Model/ReportStatus.php b/app/code/Magento/Reports/Model/ReportStatus.php index 13f71c00c7330..d5d4611682090 100644 --- a/app/code/Magento/Reports/Model/ReportStatus.php +++ b/app/code/Magento/Reports/Model/ReportStatus.php @@ -20,11 +20,11 @@ class ReportStatus */ private $scopeConfig; - /** - * ReportStatus constructor. - * - * @param ScopeConfigInterface $scopeConfig - */ + /** + * ReportStatus constructor. + * + * @param ScopeConfigInterface $scopeConfig + */ public function __construct(ScopeConfigInterface $scopeConfig) { $this->scopeConfig = $scopeConfig; diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php index 0d85648c18a1f..82024b3b015e5 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php @@ -171,9 +171,9 @@ protected function _construct() /** * Add attribute to filter * - * @param int $storeId + * @param int $storeId * @param string $attributeCode - * @param mixed $value + * @param mixed $value * @param string $type * * @return \Magento\Framework\DB\Select|bool @@ -220,7 +220,7 @@ protected function _addFilter($storeId, $attributeCode, $value, $type = '=') /** * Join attribute by code * - * @param int $storeId + * @param int $storeId * @param string $attributeCode * @param string $column Add attribute value to given column * @@ -361,7 +361,7 @@ public function getCollection($storeId) * Prepare product * * @param array $productRow - * @param int $storeId + * @param int $storeId * * @return \Magento\Framework\DataObject * @throws \Magento\Framework\Exception\LocalizedException @@ -492,7 +492,7 @@ private function getProductImageUrl($image) /** * Return Use Categories Path for Product URLs config value * - * @param $storeId + * @param null|string $storeId * * @return bool */ diff --git a/app/code/Magento/Store/Model/BaseUrlChecker.php b/app/code/Magento/Store/Model/BaseUrlChecker.php index ee108fe484be1..dbdcd9ff17bf9 100644 --- a/app/code/Magento/Store/Model/BaseUrlChecker.php +++ b/app/code/Magento/Store/Model/BaseUrlChecker.php @@ -17,11 +17,11 @@ class BaseUrlChecker */ private $scopeConfig; - /** - * BaseUrlChecker constructor. - * - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ + /** + * BaseUrlChecker constructor. + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig ) { diff --git a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php index 52fd66924b957..3f6cb41ce3939 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php +++ b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php @@ -32,11 +32,11 @@ class Hsts extends \Magento\Framework\App\Response\HeaderProvider\AbstractHeader */ protected $scopeConfig; - /** - * Hsts constructor. - * - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ + /** + * Hsts constructor. + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + */ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) { $this->scopeConfig = $scopeConfig; diff --git a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php index cb6b0045e6673..265e9dbeb33da 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php +++ b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php @@ -32,11 +32,11 @@ class UpgradeInsecure extends \Magento\Framework\App\Response\HeaderProvider\Abs */ protected $scopeConfig; - /** - * UpgradeInsecure constructor. - * - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - */ + /** + * UpgradeInsecure constructor. + * + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + */ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) { $this->scopeConfig = $scopeConfig; diff --git a/app/code/Magento/Store/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php index b9ab168f68dc2..b86e386c847ab 100644 --- a/app/code/Magento/Store/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -87,17 +87,17 @@ class StoreManager implements */ protected $isSingleStoreAllowed; - /** - * StoreManager constructor. - * - * @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository - * @param \Magento\Store\Api\GroupRepositoryInterface $groupRepository - * @param \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param StoreResolverInterface $storeResolver - * @param \Magento\Framework\Cache\FrontendInterface $cache - * @param bool $isSingleStoreAllowed - */ + /** + * StoreManager constructor. + * + * @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository + * @param \Magento\Store\Api\GroupRepositoryInterface $groupRepository + * @param \Magento\Store\Api\WebsiteRepositoryInterface $websiteRepository + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param StoreResolverInterface $storeResolver + * @param \Magento\Framework\Cache\FrontendInterface $cache + * @param bool $isSingleStoreAllowed + */ public function __construct( \Magento\Store\Api\StoreRepositoryInterface $storeRepository, \Magento\Store\Api\GroupRepositoryInterface $groupRepository, @@ -116,54 +116,54 @@ public function __construct( $this->isSingleStoreAllowed = $isSingleStoreAllowed; } - /** - * Set current default store - * - * @param string $store - */ + /** + * Set current default store + * + * @param string $store + */ public function setCurrentStore($store) { $this->currentStoreId = $store; } - /** - * Allow or disallow single store mode - * - * @param bool $value - */ + /** + * Allow or disallow single store mode + * + * @param bool $value + */ public function setIsSingleStoreModeAllowed($value) { $this->isSingleStoreAllowed = $value; } - /** - * Check if store has only one store view - * - * @return bool - */ + /** + * Check if store has only one store view + * + * @return bool + */ public function hasSingleStore() { // TODO: MAGETWO-39902 add cache, move value to consts return $this->isSingleStoreAllowed && count($this->getStores(true)) < 3; } - /** - * Check if system is run in the single store mode - * - * @return bool - */ + /** + * Check if system is run in the single store mode + * + * @return bool + */ public function isSingleStoreMode() { return $this->isSingleStoreModeEnabled() && $this->hasSingleStore(); } - /** - * Retrieve application store object - * - * @param null|string|bool|int|\Magento\Store\Api\Data\StoreInterface $storeId - * @return \Magento\Store\Api\Data\StoreInterface - * @throws NoSuchEntityException If given store doesn't exist. - */ + /** + * Retrieve application store object + * + * @param null|string|bool|int|\Magento\Store\Api\Data\StoreInterface $storeId + * @return \Magento\Store\Api\Data\StoreInterface + * @throws NoSuchEntityException If given store doesn't exist. + */ public function getStore($storeId = null) { if (!isset($storeId) || '' === $storeId || $storeId === true) { @@ -185,13 +185,13 @@ public function getStore($storeId = null) return $store; } - /** - * Retrieve stores array - * - * @param bool $withDefault - * @param bool $codeKey - * @return \Magento\Store\Api\Data\StoreInterface[] - */ + /** + * Retrieve stores array + * + * @param bool $withDefault + * @param bool $codeKey + * @return \Magento\Store\Api\Data\StoreInterface[] + */ public function getStores($withDefault = false, $codeKey = false) { $stores = []; @@ -208,13 +208,13 @@ public function getStores($withDefault = false, $codeKey = false) return $stores; } - /** - * Retrieve application website object - * - * @param null|bool|int|string|\Magento\Store\Api\Data\WebsiteInterface $websiteId - * @return \Magento\Store\Api\Data\WebsiteInterface - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Retrieve application website object + * + * @param null|bool|int|string|\Magento\Store\Api\Data\WebsiteInterface $websiteId + * @return \Magento\Store\Api\Data\WebsiteInterface + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getWebsite($websiteId = null) { if ($websiteId === null || $websiteId === '') { @@ -232,13 +232,13 @@ public function getWebsite($websiteId = null) return $website; } - /** - * Get loaded websites - * - * @param bool $withDefault - * @param bool $codeKey - * @return \Magento\Store\Api\Data\WebsiteInterface[] - */ + /** + * Get loaded websites + * + * @param bool $withDefault + * @param bool $codeKey + * @return \Magento\Store\Api\Data\WebsiteInterface[] + */ public function getWebsites($withDefault = false, $codeKey = false) { $websites = []; @@ -255,11 +255,11 @@ public function getWebsites($withDefault = false, $codeKey = false) return $websites; } - /** - * Reinitialize store list - * - * @return void - */ + /** + * Reinitialize store list + * + * @return void + */ public function reinitStores() { $this->currentStoreId = null; @@ -270,12 +270,12 @@ public function reinitStores() $this->groupRepository->clean(); } - /** - * Retrieve default store for default group and website - * - * @return \Magento\Store\Api\Data\StoreInterface|null - * @throws NoSuchEntityException - */ + /** + * Retrieve default store for default group and website + * + * @return \Magento\Store\Api\Data\StoreInterface|null + * @throws NoSuchEntityException + */ public function getDefaultStoreView() { $defaultWebsite = $this->websiteRepository->getDefault(); @@ -283,14 +283,14 @@ public function getDefaultStoreView() return $defaultStore ?: null; } - /** - * Retrieve application store group object - * - * @param null|\Magento\Store\Api\Data\GroupInterface|string $groupId - * - * @return \Magento\Store\Api\Data\GroupInterface - * @throws NoSuchEntityException - */ + /** + * Retrieve application store group object + * + * @param null|\Magento\Store\Api\Data\GroupInterface|string $groupId + * + * @return \Magento\Store\Api\Data\GroupInterface + * @throws NoSuchEntityException + */ public function getGroup($groupId = null) { if (null === $groupId) { @@ -303,12 +303,12 @@ public function getGroup($groupId = null) return $group; } - /** - * Prepare array of store groups - * - * @param bool $withDefault - * @return \Magento\Store\Api\Data\GroupInterface[] - */ + /** + * Prepare array of store groups + * + * @param bool $withDefault + * @return \Magento\Store\Api\Data\GroupInterface[] + */ public function getGroups($withDefault = false) { $groups = $this->groupRepository->getList(); @@ -338,6 +338,8 @@ protected function isSingleStoreModeEnabled() } /** + * Get Store Website Relation + * * @deprecated 100.2.0 * @return StoreWebsiteRelation */ @@ -346,13 +348,13 @@ private function getStoreWebsiteRelation() return ObjectManager::getInstance()->get(StoreWebsiteRelation::class); } - /** - * Get assigned to website store - * - * @param int $websiteId - * - * @return array - */ + /** + * Get assigned to website store + * + * @param int $websiteId + * + * @return array + */ public function getStoreByWebsiteId($websiteId) { return $this->getStoreWebsiteRelation()->getStoreByWebsiteId($websiteId); diff --git a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php index d5beab83cdd2b..2a8b3d4152703 100644 --- a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php @@ -11,7 +11,7 @@ /** * Wishlist RSS model - * + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Wishlist implements DataProviderInterface diff --git a/lib/internal/Magento/Framework/Session/SidResolver.php b/lib/internal/Magento/Framework/Session/SidResolver.php index 90ee7541a5d6a..30d1a96ea4236 100644 --- a/lib/internal/Magento/Framework/Session/SidResolver.php +++ b/lib/internal/Magento/Framework/Session/SidResolver.php @@ -9,6 +9,9 @@ use Magento\Framework\App\State; +/** + * Class SidResolver + */ class SidResolver implements SidResolverInterface { /** @@ -85,12 +88,14 @@ public function __construct( $this->appState = $appState ?: \Magento\Framework\App\ObjectManager::getInstance()->get(State::class); } - /** - * @param SessionManagerInterface $session - * - * @return string|null - * @throws \Magento\Framework\Exception\LocalizedException - */ + /** + * Get Sid + * + * @param SessionManagerInterface $session + * + * @return string|null + * @throws \Magento\Framework\Exception\LocalizedException + */ public function getSid(SessionManagerInterface $session) { if ($this->appState->getAreaCode() !== \Magento\Framework\App\Area::AREA_FRONTEND) { From 493239c74c66e5e05226996a576b938665b0c224 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Fri, 21 Sep 2018 00:14:19 +0300 Subject: [PATCH 07/12] Update Tests --- app/code/Magento/Directory/Helper/Data.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Directory/Helper/Data.php b/app/code/Magento/Directory/Helper/Data.php index 14619ce9bfc50..3a5558e6d6f3d 100644 --- a/app/code/Magento/Directory/Helper/Data.php +++ b/app/code/Magento/Directory/Helper/Data.php @@ -124,10 +124,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param Context $context * @param Config $configCacheType * @param Collection $countryCollection - * @param CollectionFactory $regCollectionFactory, + * @param CollectionFactory $regCollectionFactory * @param JsonData $jsonHelper * @param StoreManagerInterface $storeManager - * @param CurrencyFactory currencyFactory + * @param CurrencyFactory $currencyFactory */ public function __construct( Context $context, @@ -317,8 +317,8 @@ public function isRegionRequired($countryId) public function getBaseCurrencyCode() { return $this->scopeConfig->getValue( - Currency::XML_PATH_CURRENCY_BASE, - 'default' + Currency::XML_PATH_CURRENCY_BASE, + 'default' ); } From efad97ee46ebd340c6095648b8ba55776b00f318 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Wed, 3 Oct 2018 10:23:49 +0300 Subject: [PATCH 08/12] Fix methods descriptions --- .../AdvancedSearch/Model/Recommendations/DataProvider.php | 6 +----- app/code/Magento/CatalogInventory/Model/Configuration.php | 4 +--- .../Elasticsearch/Model/DataProvider/Suggestions.php | 8 +------- .../GiftMessage/Model/GiftMessageConfigProvider.php | 5 +---- app/code/Magento/NewRelicReporting/Model/Config.php | 4 ++-- app/code/Magento/Store/Model/HeaderProvider/Hsts.php | 4 +--- .../Store/Model/HeaderProvider/UpgradeInsecure.php | 4 +--- app/code/Magento/Store/Model/StoreManager.php | 8 ++------ app/code/Magento/Wishlist/Model/Rss/Wishlist.php | 8 ++------ 9 files changed, 12 insertions(+), 39 deletions(-) diff --git a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php index f0d998e19d7f1..c0c224766eb3c 100644 --- a/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php +++ b/app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php @@ -87,11 +87,7 @@ public function isResultsCountEnabled() } /** - * Get Items - * - * @param QueryInterface $query - * - * @return array|\Magento\Search\Model\QueryResult[] + * @inheritdoc */ public function getItems(QueryInterface $query) { diff --git a/app/code/Magento/CatalogInventory/Model/Configuration.php b/app/code/Magento/CatalogInventory/Model/Configuration.php index a18fe053d5cef..8b0849c8874bc 100644 --- a/app/code/Magento/CatalogInventory/Model/Configuration.php +++ b/app/code/Magento/CatalogInventory/Model/Configuration.php @@ -152,9 +152,7 @@ public function __construct( } /** - * Default Scope Id - * - * @return int + * @inheritdoc */ public function getDefaultScopeId() { diff --git a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php index 6338851bd2ff4..da8a32687535f 100644 --- a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php +++ b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php @@ -95,13 +95,7 @@ public function __construct( } /** - * Get Items - * - * @param QueryInterface $query - * - * @return array|\Magento\Search\Model\QueryResult[] - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @inheritdoc */ public function getItems(QueryInterface $query) { diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php index 82c2b52c97040..b124897770b6f 100644 --- a/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php +++ b/app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php @@ -95,10 +95,7 @@ public function __construct( } /** - * Get Config - * - * @return array - * @throws \Magento\Framework\Exception\NoSuchEntityException + * @inheritdoc */ public function getConfig() { diff --git a/app/code/Magento/NewRelicReporting/Model/Config.php b/app/code/Magento/NewRelicReporting/Model/Config.php index e09bae08dde75..6f3ff1df57448 100644 --- a/app/code/Magento/NewRelicReporting/Model/Config.php +++ b/app/code/Magento/NewRelicReporting/Model/Config.php @@ -91,7 +91,7 @@ public function __construct( */ public function isNewRelicEnabled() { - return $this->scopeConfig->getValue('newrelicreporting/general/enable'); + return $this->scopeConfig->isSetFlag('newrelicreporting/general/enable'); } /** @@ -181,7 +181,7 @@ public function isSeparateApps() */ public function isCronEnabled() { - return $this->scopeConfig->getValue('newrelicreporting/cron/enable_cron'); + return $this->scopeConfig->isSetFlag('newrelicreporting/cron/enable_cron'); } /** diff --git a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php index 3f6cb41ce3939..b22775e0987cb 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/Hsts.php +++ b/app/code/Magento/Store/Model/HeaderProvider/Hsts.php @@ -43,9 +43,7 @@ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $ } /** - * Whether the header should be attached to the response - * - * @return bool + * @inheritdoc */ public function canApply() { diff --git a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php index 265e9dbeb33da..0ef8726e07f1b 100644 --- a/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php +++ b/app/code/Magento/Store/Model/HeaderProvider/UpgradeInsecure.php @@ -43,9 +43,7 @@ public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $ } /** - * Whether the header should be attached to the response - * - * @return bool + * @inheritdoc */ public function canApply() { diff --git a/app/code/Magento/Store/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php index b86e386c847ab..79ea0d7408c59 100644 --- a/app/code/Magento/Store/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -117,9 +117,7 @@ public function __construct( } /** - * Set current default store - * - * @param string $store + * @inheritdoc */ public function setCurrentStore($store) { @@ -127,9 +125,7 @@ public function setCurrentStore($store) } /** - * Allow or disallow single store mode - * - * @param bool $value + * @inheritdoc */ public function setIsSingleStoreModeAllowed($value) { diff --git a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php index 2a8b3d4152703..9ccbf80f99a0c 100644 --- a/app/code/Magento/Wishlist/Model/Rss/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Rss/Wishlist.php @@ -273,9 +273,7 @@ public function getProductPriceHtml(\Magento\Catalog\Model\Product $product) } /** - * Get Feeds - * - * @return array + * @inheritdoc */ public function getFeeds() { @@ -283,9 +281,7 @@ public function getFeeds() } /** - * Is Auth Required - * - * @return bool + * @inheritdoc */ public function isAuthRequired() { From c2db6bfeb327802acf8879a64cbe30f7b547f4c2 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Wed, 3 Oct 2018 19:28:28 +0300 Subject: [PATCH 09/12] Fixed --- .../Ui/Component/DataProvider/Document.php | 7 +--- .../Model/DataProvider/Suggestions.php | 4 +- app/code/Magento/Store/Model/StoreManager.php | 39 ++++--------------- .../Magento/Framework/Session/SidResolver.php | 2 +- 4 files changed, 10 insertions(+), 42 deletions(-) diff --git a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php index 9180268ac5cc6..468a9e7946f2d 100644 --- a/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php +++ b/app/code/Magento/Customer/Ui/Component/DataProvider/Document.php @@ -94,12 +94,7 @@ public function __construct( } /** - * Get Custom Attribute - * - * @param string $attributeCode - * - * @return \Magento\Framework\Api\AttributeInterface|null - * @throws \Magento\Framework\Exception\LocalizedException + * @inheritdoc */ public function getCustomAttribute($attributeCode) { diff --git a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php index da8a32687535f..c4fab39dfde61 100644 --- a/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php +++ b/app/code/Magento/Elasticsearch/Model/DataProvider/Suggestions.php @@ -121,9 +121,7 @@ public function getItems(QueryInterface $query) } /** - * Is Results Count Enabled - * - * @return bool + * @inheritdoc */ public function isResultsCountEnabled() { diff --git a/app/code/Magento/Store/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php index 79ea0d7408c59..11f9787bf1471 100644 --- a/app/code/Magento/Store/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -205,11 +205,7 @@ public function getStores($withDefault = false, $codeKey = false) } /** - * Retrieve application website object - * - * @param null|bool|int|string|\Magento\Store\Api\Data\WebsiteInterface $websiteId - * @return \Magento\Store\Api\Data\WebsiteInterface - * @throws \Magento\Framework\Exception\LocalizedException + * @inheritdoc */ public function getWebsite($websiteId = null) { @@ -229,11 +225,7 @@ public function getWebsite($websiteId = null) } /** - * Get loaded websites - * - * @param bool $withDefault - * @param bool $codeKey - * @return \Magento\Store\Api\Data\WebsiteInterface[] + * @inheritdoc */ public function getWebsites($withDefault = false, $codeKey = false) { @@ -252,9 +244,7 @@ public function getWebsites($withDefault = false, $codeKey = false) } /** - * Reinitialize store list - * - * @return void + * @inheritdoc */ public function reinitStores() { @@ -267,10 +257,7 @@ public function reinitStores() } /** - * Retrieve default store for default group and website - * - * @return \Magento\Store\Api\Data\StoreInterface|null - * @throws NoSuchEntityException + * @inheritdoc */ public function getDefaultStoreView() { @@ -280,12 +267,7 @@ public function getDefaultStoreView() } /** - * Retrieve application store group object - * - * @param null|\Magento\Store\Api\Data\GroupInterface|string $groupId - * - * @return \Magento\Store\Api\Data\GroupInterface - * @throws NoSuchEntityException + * @inheritdoc */ public function getGroup($groupId = null) { @@ -300,10 +282,7 @@ public function getGroup($groupId = null) } /** - * Prepare array of store groups - * - * @param bool $withDefault - * @return \Magento\Store\Api\Data\GroupInterface[] + * @inheritdoc */ public function getGroups($withDefault = false) { @@ -345,11 +324,7 @@ private function getStoreWebsiteRelation() } /** - * Get assigned to website store - * - * @param int $websiteId - * - * @return array + * @inheritdoc */ public function getStoreByWebsiteId($websiteId) { diff --git a/lib/internal/Magento/Framework/Session/SidResolver.php b/lib/internal/Magento/Framework/Session/SidResolver.php index 30d1a96ea4236..1208aeb31eaee 100644 --- a/lib/internal/Magento/Framework/Session/SidResolver.php +++ b/lib/internal/Magento/Framework/Session/SidResolver.php @@ -176,7 +176,7 @@ public function getUseSessionInUrl() if ($this->_useSessionInUrl === null) { //Using config value by default, can be overridden by using the //setter. - $this->_useSessionInUrl = $this->scopeConfig->getValue( + $this->_useSessionInUrl = $this->scopeConfig->isSetFlag( self::XML_PATH_USE_FRONTEND_SID, $this->_scopeType ); From 75eb9b128cb68707d0e7a45d7b05d79432253f31 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Wed, 3 Oct 2018 19:31:16 +0300 Subject: [PATCH 10/12] Fixed --- app/code/Magento/Store/Model/StoreManager.php | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Store/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php index 11f9787bf1471..0fce3a5217058 100644 --- a/app/code/Magento/Store/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -133,9 +133,7 @@ public function setIsSingleStoreModeAllowed($value) } /** - * Check if store has only one store view - * - * @return bool + * @inheritdoc */ public function hasSingleStore() { @@ -144,9 +142,7 @@ public function hasSingleStore() } /** - * Check if system is run in the single store mode - * - * @return bool + * @inheritdoc */ public function isSingleStoreMode() { @@ -154,11 +150,7 @@ public function isSingleStoreMode() } /** - * Retrieve application store object - * - * @param null|string|bool|int|\Magento\Store\Api\Data\StoreInterface $storeId - * @return \Magento\Store\Api\Data\StoreInterface - * @throws NoSuchEntityException If given store doesn't exist. + * @inheritdoc */ public function getStore($storeId = null) { @@ -182,11 +174,7 @@ public function getStore($storeId = null) } /** - * Retrieve stores array - * - * @param bool $withDefault - * @param bool $codeKey - * @return \Magento\Store\Api\Data\StoreInterface[] + * @inheritdoc */ public function getStores($withDefault = false, $codeKey = false) { From c2fd8e9d47db8080f15f5d3634159c7d0d25d57e Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Thu, 4 Oct 2018 21:36:51 +0300 Subject: [PATCH 11/12] Fix test --- .../testsuite/Magento/Framework/Session/SidResolverTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php index e928422528409..e67d9f8ad1846 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php @@ -195,7 +195,7 @@ public function testSetGetUseSessionInUrl($configValue) $this->scopeConfig->expects( $this->any() )->method( - 'getValue' + 'isSetFlag' )->with( \Magento\Framework\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE From 6ed47bb3ef8ad8b83b635f3b772a93319753be51 Mon Sep 17 00:00:00 2001 From: Volodymyr Hryvinskyi Date: Wed, 10 Oct 2018 13:09:16 +0300 Subject: [PATCH 12/12] fix test --- .../testsuite/Magento/Framework/Session/SidResolverTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php index e67d9f8ad1846..5e70eb491b50c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SidResolverTest.php @@ -114,7 +114,7 @@ public function testGetSid($sid, $useFrontedSid, $isOwnOriginUrl, $testSid) $this->scopeConfig->expects( $this->any() )->method( - 'getValue' + 'isSetFlag' )->with( \Magento\Framework\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE