mundipagg/magento2

View on GitHub
Ui/DataProvider/Product/Form/Modifier/Plan.php

Summary

Maintainability
D
2 days
Test Coverage

File Plan.php has 469 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
Severity: Minor
Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 7 hrs to fix

    Method fillMeta has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function fillMeta()
        {
            return [
                'id' => $this->getTextColumn('id', true, __('ID'), 10),
                'thumbnail' => [
    Severity: Major
    Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 2 hrs to fix

      Method getButtonSet has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getButtonSet()
          {
              return [
                  'arguments' => [
                      'data' => [
      Severity: Major
      Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 2 hrs to fix

        Method modifyQtyAndStockStatus has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function modifyQtyAndStockStatus(array $meta)
            {
                if ($groupCode = $this->getGroupCodeByField($meta, 'container_' . self::$codeQuantityAndStockStatus)) {
                    $parentChildren = &$meta[$groupCode]['children'];
                    if (!empty($parentChildren['container_' . self::$codeQuantityAndStockStatus])) {
        Severity: Minor
        Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 1 hr to fix

          Method getListing has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function getListing()
              {
                  return [
                      'arguments' => [
                          'data' => [
          Severity: Minor
          Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 1 hr to fix

            Method getModal has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function getModal()
                {
                    return [
                        'arguments' => [
                            'data' => [
            Severity: Minor
            Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 1 hr to fix

              Method getGrid has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getGrid()
                  {
                      $grid = [
                          'arguments' => [
                              'data' => [
              Severity: Minor
              Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 1 hr to fix

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

                        LocatorInterface $locator,
                        UrlInterface $urlBuilder,
                        ProductLinkRepositoryInterface $productLinkRepository,
                        ProductRepositoryInterface $productRepository,
                        ImageHelper $imageHelper,
                Severity: Major
                Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 1 hr to fix

                  Method modifyMeta has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function modifyMeta(array $meta)
                      {
                          if ($this->locator->getProduct()->getTypeId() === GroupedProductType::TYPE_CODE) {
                              $meta = array_replace_recursive(
                                  $meta,
                  Severity: Minor
                  Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 1 hr to fix

                    Function modifyData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function modifyData(array $data)
                        {
                            /** @var \Magento\Catalog\Model\Product $product */
                            $product = $this->locator->getProduct();
                            $modelId = $product->getId();
                    Severity: Minor
                    Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 35 mins 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 modifyQtyAndStockStatus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function modifyQtyAndStockStatus(array $meta)
                        {
                            if ($groupCode = $this->getGroupCodeByField($meta, 'container_' . self::$codeQuantityAndStockStatus)) {
                                $parentChildren = &$meta[$groupCode]['children'];
                                if (!empty($parentChildren['container_' . self::$codeQuantityAndStockStatus])) {
                    Severity: Minor
                    Found in Ui/DataProvider/Product/Form/Modifier/Plan.php - About 25 mins 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

                    There are no issues that match your filters.

                    Category
                    Status