Skip to content

Commit

Permalink
Merge pull request #1728 from magento-engcom/2.2-develop-prs
Browse files Browse the repository at this point in the history
Public Pull Requests

#12257 Phpdoc improvements by @KarlDeux
  • Loading branch information
Oleksii Korshenko committed Nov 16, 2017
2 parents 255fecc + 42fd99b commit 7ea830f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
19 changes: 10 additions & 9 deletions app/code/Magento/CatalogImportExport/Model/Import/Product.php
Expand Up @@ -9,6 +9,7 @@
use Magento\Catalog\Model\Product\Visibility;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor;
use Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface;
Expand Down Expand Up @@ -712,7 +713,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
* @param \Magento\CatalogInventory\Model\Spi\StockStateProviderInterface $stockStateProvider
* @param \Magento\Catalog\Helper\Data $catalogData
* @param \Magento\ImportExport\Model\Import\Config $importConfig
* @param Proxy\Product\ResourceFactory $resourceFactory
* @param Proxy\Product\ResourceModelFactory $resourceFactory
* @param Product\OptionFactory $optionFactory
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setColFactory
* @param Product\Type\Factory $productTypeFactory
Expand Down Expand Up @@ -1084,12 +1085,12 @@ protected function _initTypeModels()
$params = [$this, $productTypeName];
if (!($model = $this->_productTypeFactory->create($productTypeConfig['model'], ['params' => $params]))
) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__('Entity type model \'%1\' is not found', $productTypeConfig['model'])
);
}
if (!$model instanceof \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__(
'Entity type model must be an instance of '
. \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType::class
Expand Down Expand Up @@ -1551,6 +1552,7 @@ public function getImagesFromRow(array $rowData)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
* @throws LocalizedException
*/
protected function _saveProducts()
{
Expand Down Expand Up @@ -1611,7 +1613,7 @@ protected function _saveProducts()

// wrong attribute_set_code was received
if (!$attributeSetId) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__(
'Wrong attribute set code "%1", please correct it and try again.',
$rowData['attribute_set_code']
Expand Down Expand Up @@ -1998,7 +2000,7 @@ protected function _getUploader()
}

if (!$this->_fileUploader->setTmpDir($tmpPath)) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__('File directory \'%1\' is not readable.', $tmpPath)
);
}
Expand All @@ -2007,7 +2009,7 @@ protected function _getUploader()

$this->_mediaDirectory->create($destinationPath);
if (!$this->_fileUploader->setDestDir($destinationPath)) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__('File directory \'%1\' is not writable.', $destinationPath)
);
}
Expand All @@ -2029,6 +2031,7 @@ public function getUploader()
* Return a new file name if the same file is already exists.
*
* @param string $fileName
* @param bool $renameFileOff
* @return string
*/
protected function uploadMediaFiles($fileName, $renameFileOff = false)
Expand Down Expand Up @@ -2753,9 +2756,7 @@ private function _customFieldsMapping($rowData)
}

/**
* Validate data rows and save bunches to DB
*
* @return $this
* {@inheritdoc}
*/
protected function _saveValidatedBunches()
{
Expand Down
Expand Up @@ -7,6 +7,7 @@

use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\ImportExport\Model\Import\AbstractSource;
use Magento\ImportExport\Model\Import as ImportExport;
Expand Down Expand Up @@ -310,7 +311,7 @@ public function __construct(
protected function _getSource()
{
if (!$this->_source) {
throw new \Magento\Framework\Exception\LocalizedException(__('Please specify a source.'));
throw new LocalizedException(__('Please specify a source.'));
}
return $this->_source;
}
Expand Down Expand Up @@ -378,7 +379,7 @@ protected function addErrors($code, $errors)
/**
* Validate data rows and save bunches to DB.
*
* @return $this|void
* @return $this
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function _saveValidatedBunches()
Expand Down Expand Up @@ -548,11 +549,11 @@ public function getBehavior()
if (!isset(
$this->_parameters['behavior']
) ||
$this->_parameters['behavior'] != \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND &&
$this->_parameters['behavior'] != \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE &&
$this->_parameters['behavior'] != \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE
$this->_parameters['behavior'] != ImportExport::BEHAVIOR_APPEND &&
$this->_parameters['behavior'] != ImportExport::BEHAVIOR_REPLACE &&
$this->_parameters['behavior'] != ImportExport::BEHAVIOR_DELETE
) {
return \Magento\ImportExport\Model\Import::getDefaultBehavior();
return ImportExport::getDefaultBehavior();
}
return $this->_parameters['behavior'];
}
Expand Down Expand Up @@ -604,7 +605,7 @@ public function getProcessedRowsCount()
public function getSource()
{
if (!$this->_source) {
throw new \Magento\Framework\Exception\LocalizedException(__('The source is not set.'));
throw new LocalizedException(__('The source is not set.'));
}
return $this->_source;
}
Expand Down Expand Up @@ -879,7 +880,7 @@ public function getValidColumnNames()
protected function getMetadataPool()
{
if (!$this->metadataPool) {
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
$this->metadataPool = ObjectManager::getInstance()
->get(\Magento\Framework\EntityManager\MetadataPool::class);
}
return $this->metadataPool;
Expand Down

0 comments on commit 7ea830f

Please sign in to comment.