Skip to content

Commit ae9010b

Browse files
committed
Add @see annotation, MD & CS fixes
1 parent e85e717 commit ae9010b

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
// @codingStandardsIgnoreFile
8+
69
namespace Magento\Sitemap\Model\ResourceModel\Catalog;
710

811
use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;
@@ -14,6 +17,9 @@
1417
*
1518
* @author Magento Core Team <core@magentocommerce.com>
1619
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
20+
* @SuppressWarnings(PHPMD.LongVariable)
21+
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
22+
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
1723
*/
1824
class Product extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1925
{
@@ -72,6 +78,7 @@ class Product extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
7278

7379
/**
7480
* @var \Magento\Catalog\Model\Product\Media\Config
81+
* @deprecated unused
7582
*/
7683
protected $_mediaConfig;
7784

@@ -397,6 +404,7 @@ protected function _getAllProductImages($product, $storeId)
397404
*
398405
* @return \Magento\Catalog\Model\Product\Media\Config
399406
* @deprecated No longer used, as we're getting full image URL from getProductImageUrl method
407+
* @see getProductImageUrl()
400408
*/
401409
protected function _getMediaConfig()
402410
{

app/code/Magento/Sitemap/Model/Sitemap.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
* @method \Magento\Sitemap\Model\Sitemap setStoreId(int $value)
2828
* @SuppressWarnings(PHPMD.TooManyFields)
2929
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
30+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
31+
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
32+
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
3033
*/
3134
class Sitemap extends \Magento\Framework\Model\AbstractModel
3235
{
@@ -448,7 +451,7 @@ protected function _isSplitRequired($row)
448451
* @param null|string $lastmod
449452
* @param null|string $changefreq
450453
* @param null|string $priority
451-
* @param null|array $images
454+
* @param null|array|\Magento\Framework\DataObject $images
452455
* @return string
453456
* Sitemap images
454457
* @see http://support.google.com/webmasters/bin/answer.py?hl=en&answer=178636
@@ -473,7 +476,7 @@ protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $pr
473476
// Add Images to sitemap
474477
foreach ($images->getCollection() as $image) {
475478
$row .= '<image:image>';
476-
$row .= '<image:loc>' . htmlspecialchars($this->_getMediaUrl($image->getUrl())) . '</image:loc>';
479+
$row .= '<image:loc>' . htmlspecialchars($image->getUrl()) . '</image:loc>';
477480
$row .= '<image:title>' . htmlspecialchars($images->getTitle()) . '</image:title>';
478481
if ($image->getCaption()) {
479482
$row .= '<image:caption>' . htmlspecialchars($image->getCaption()) . '</image:caption>';
@@ -483,9 +486,7 @@ protected function _getSitemapRow($url, $lastmod = null, $changefreq = null, $pr
483486
// Add PageMap image for Google web search
484487
$row .= '<PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail">';
485488
$row .= '<Attribute name="name" value="' . htmlspecialchars($images->getTitle()) . '"/>';
486-
$row .= '<Attribute name="src" value="' . htmlspecialchars(
487-
$this->_getMediaUrl($images->getThumbnail())
488-
) . '"/>';
489+
$row .= '<Attribute name="src" value="' . htmlspecialchars($images->getThumbnail()) . '"/>';
489490
$row .= '</DataObject></PageMap>';
490491
}
491492

@@ -591,6 +592,7 @@ protected function _getBaseDir()
591592
*/
592593
protected function _getStoreBaseUrl($type = \Magento\Framework\UrlInterface::URL_TYPE_LINK)
593594
{
595+
/** @var \Magento\Store\Model\Store $store */
594596
$store = $this->_storeManager->getStore($this->getStoreId());
595597
$isSecure = $store->isUrlSecure();
596598
return rtrim($store->getBaseUrl($type, $isSecure), '/') . '/';
@@ -612,12 +614,13 @@ protected function _getUrl($url, $type = \Magento\Framework\UrlInterface::URL_TY
612614
* Get media url
613615
*
614616
* @param string $url
615-
* @return string $url
617+
* @return string
616618
* @deprecated No longer used, as we're generating product image URLs inside collection instead
619+
* @see \Magento\Sitemap\Model\ResourceModel\Catalog\Product::_loadProductImages()
617620
*/
618621
protected function _getMediaUrl($url)
619622
{
620-
return $url;
623+
return $this->_getUrl($url, \Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
621624
}
622625

623626
/**

0 commit comments

Comments
 (0)