Showing 25 of 29 total issues
ProductLabel
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ProductLabel extends AbstractModel implements ProductLabelInterface
{
public const CACHE_TAG = 'smile_productlabel';
protected StoreManagerInterface $storeManager;
Function getProductLabels
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getProductLabels(): array
{
$productLabels = [];
$productLabelList = $this->getProductLabelsList();
$attributesProduct = $this->getAttributesOfCurrentProduct();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _afterLoad
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function _afterLoad()
{
$linkedIds = $this->getColumnValues(ProductLabelInterface::PRODUCTLABEL_ID);
if (count($linkedIds)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method checkUnicity
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkUnicity(AbstractModel $object, array $stores): bool
{
$isDefaultStore = $this->storeManager->isSingleStoreMode()
|| array_search(Store::DEFAULT_STORE_ID, $stores) !== false;
Method create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function create(Product $product, string $imageId, ?array $attributes = null): ImageBlock
{
$viewImageConfig = $this->presentationConfig->getViewConfig()->getMediaAttributes(
'Magento_Catalog',
ImageHelper::MEDIA_TYPE_CONFIG_NODE,
Method _renderFiltersBefore
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function _renderFiltersBefore()
{
parent::_renderFiltersBefore();
$storeCondition = Store::DEFAULT_STORE_ID;
Method execute
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute()
{
/** @var ResultRedirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$resultRedirect->setPath('*/*/');
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
EntityFactory $entityFactory,
LoggerInterface $logger,
FetchStrategyInterface $fetchStrategy,
ManagerInterface $eventManager,
Config $eavConfig,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
PageFactory $resultPageFactory,
Registry $coreRegistry,
DataPersistorInterface $dataPersistor,
Filter $filter,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $name,
string $primaryFieldName,
string $requestFieldName,
CollectionFactory $collectionFactory,
RequestInterface $request,
Method prepareDataSource
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function prepareDataSource(array $dataSource): array
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
if (isset($item['product_label_id'])) {
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
Registry $registry,
StoreManagerInterface $storeManager,
Filesystem $filesystem,
ImageUploader $imageUploader,
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
Registry $coreRegistry,
ProductLabelFactory $modelFactory,
ProductLabelRepository $modelRepository,
DataPersistorInterface $dataPersistor,
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
Registry $registry,
Image $imageHelper,
ProductLabelCollectionFactory $productLabelCollectionFactory,
CacheInterface $cache,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
EntityManager $entityManager,
MetadataPool $metadataPool,
StoreManagerInterface $storeManager,
Json $jsonSerializer,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
Image $imageHelper,
UrlInterface $urlBuilder,
array $components = [],
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
UrlInterface $urlBuilder,
Escaper $escaper,
array $components = [],
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
CollectionProcessor $collectionProcessor,
$objectFactory,
AbstractResourceModel $objectResource,
$objectCollectionFactory,
$objectSearchResultsFactory,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
Registry $coreRegistry,
ProductLabelFactory $modelFactory,
ProductLabelRepository $modelRepository,
Filter $filter,
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
RepositoryManagerFactory $repositoryManagerFactory,
ProductLabelInterfaceFactory $objectFactory,
ProductLabelResourceModel $objectResource,
ProductLabelCollectionFactory $objectCollectionFactory,
ProductLabelSearchResultsInterfaceFactory $objectSearchResultsFactory