Smile-SA/magento2-module-product-label

View on GitHub

Showing 25 of 29 total issues

ProductLabel has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class ProductLabel extends AbstractModel implements ProductLabelInterface
{
    public const CACHE_TAG = 'smile_productlabel';

    protected StoreManagerInterface $storeManager;
Severity: Minor
Found in Model/ProductLabel.php - About 3 hrs to fix

    Function getProductLabels has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getProductLabels(): array
        {
            $productLabels     = [];
            $productLabelList  = $this->getProductLabelsList();
            $attributesProduct = $this->getAttributesOfCurrentProduct();
    Severity: Minor
    Found in Block/ProductLabel/ProductLabel.php - About 2 hrs to fix

    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

        protected function _afterLoad()
        {
            $linkedIds = $this->getColumnValues(ProductLabelInterface::PRODUCTLABEL_ID);
    
            if (count($linkedIds)) {
    Severity: Minor
    Found in Model/ResourceModel/ProductLabel/Collection.php - About 1 hr to fix

    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

        private function checkUnicity(AbstractModel $object, array $stores): bool
        {
            $isDefaultStore = $this->storeManager->isSingleStoreMode()
                || array_search(Store::DEFAULT_STORE_ID, $stores) !== false;
    
    
    Severity: Minor
    Found in Model/ResourceModel/ProductLabel.php - About 1 hr to fix

      Method create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function create(Product $product, string $imageId, ?array $attributes = null): ImageBlock
          {
              $viewImageConfig = $this->presentationConfig->getViewConfig()->getMediaAttributes(
                  'Magento_Catalog',
                  ImageHelper::MEDIA_TYPE_CONFIG_NODE,
      Severity: Minor
      Found in Block/Product/ImageFactory.php - About 1 hr to fix

        Method execute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function execute()
            {
                /** @var ResultRedirect $resultRedirect */
                $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
                $resultRedirect->setPath('*/*/');
        Severity: Minor
        Found in Controller/Adminhtml/ProductLabel/Save.php - About 1 hr to fix

          Method _renderFiltersBefore has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _renderFiltersBefore()
              {
                  parent::_renderFiltersBefore();
                  $storeCondition = Store::DEFAULT_STORE_ID;
          
          
          Severity: Minor
          Found in Model/ResourceModel/ProductLabel/Grid/Collection.php - About 1 hr to fix

            Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    EntityFactory          $entityFactory,
                    LoggerInterface        $logger,
                    FetchStrategyInterface $fetchStrategy,
                    ManagerInterface       $eventManager,
                    Config                 $eavConfig,
            Severity: Major
            Found in Model/ResourceModel/ProductLabel/Attributes/Collection.php - About 1 hr to fix

              Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      string $name,
                      string $primaryFieldName,
                      string $requestFieldName,
                      CollectionFactory $collectionFactory,
                      RequestInterface $request,
              Severity: Major
              Found in Ui/Component/ProductLabel/Form/DataProvider.php - About 1 hr to fix

                Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        Context                         $context,
                        PageFactory                     $resultPageFactory,
                        Registry                        $coreRegistry,
                        DataPersistorInterface          $dataPersistor,
                        Filter                          $filter,
                Severity: Major
                Found in Controller/Adminhtml/ProductLabel/Reload.php - About 1 hr to fix

                  Method prepareDataSource has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function prepareDataSource(array $dataSource): array
                      {
                          if (isset($dataSource['data']['items'])) {
                              foreach ($dataSource['data']['items'] as & $item) {
                                  if (isset($item['product_label_id'])) {
                  Severity: Minor
                  Found in Ui/Component/Listing/Column/AttributeActions.php - About 1 hr to fix

                    Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            Context               $context,
                            Registry              $registry,
                            StoreManagerInterface $storeManager,
                            Filesystem            $filesystem,
                            ImageUploader         $imageUploader,
                    Severity: Major
                    Found in Model/ProductLabel.php - About 1 hr to fix

                      Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              Context $context,
                              Registry $coreRegistry,
                              ProductLabelFactory $modelFactory,
                              ProductLabelRepository $modelRepository,
                              DataPersistorInterface $dataPersistor,
                      Severity: Major
                      Found in Controller/Adminhtml/ProductLabel/Save.php - About 50 mins to fix

                        Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                Context $context,
                                Registry $registry,
                                Image $imageHelper,
                                ProductLabelCollectionFactory $productLabelCollectionFactory,
                                CacheInterface $cache,
                        Severity: Major
                        Found in Block/ProductLabel/ProductLabel.php - About 50 mins to fix

                          Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  CollectionProcessor $collectionProcessor,
                                  $objectFactory,
                                  AbstractResourceModel $objectResource,
                                  $objectCollectionFactory,
                                  $objectSearchResultsFactory,
                          Severity: Minor
                          Found in Model/Repository/Manager.php - About 45 mins to fix

                            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    ContextInterface $context,
                                    UiComponentFactory $uiComponentFactory,
                                    UrlInterface $urlBuilder,
                                    Escaper $escaper,
                                    array $components = [],
                            Severity: Minor
                            Found in Ui/Component/Listing/Column/AttributeActions.php - About 45 mins to fix

                              Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      Context $context,
                                      EntityManager $entityManager,
                                      MetadataPool $metadataPool,
                                      StoreManagerInterface $storeManager,
                                      Json $jsonSerializer,
                              Severity: Minor
                              Found in Model/ResourceModel/ProductLabel.php - About 45 mins to fix

                                Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        Context $context,
                                        Registry $coreRegistry,
                                        ProductLabelFactory $modelFactory,
                                        ProductLabelRepository $modelRepository,
                                        Filter $filter,
                                Severity: Minor
                                Found in Controller/Adminhtml/ProductLabel/AbstractAction.php - About 45 mins to fix

                                  Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          ContextInterface $context,
                                          UiComponentFactory $uiComponentFactory,
                                          Image $imageHelper,
                                          UrlInterface $urlBuilder,
                                          array $components = [],
                                  Severity: Minor
                                  Found in Ui/Component/Listing/Column/Thumbnail.php - About 45 mins to fix

                                    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            ObjectManagerInterface $objectManager,
                                            ConfigInterface $presentationConfig,
                                            AssetImageFactory $viewAssetImageFactory,
                                            PlaceholderFactory $viewAssetPlaceholderFactory,
                                            ParamsBuilder $imageParamsBuilder
                                    Severity: Minor
                                    Found in Block/Product/ImageFactory.php - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language