EaDesgin/magento2-pdf-generator2

View on GitHub

Showing 30 of 34 total issues

Method install has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;

        $installer->startSetup();
Severity: Major
Found in Setup/InstallSchema.php - About 6 hrs to fix

    Method install has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
        {
    
            $storeId = $this->storeManager->getStore()->getId();
    
    
    Severity: Major
    Found in Setup/InstallData.php - About 4 hrs to fix

      Method setUp has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setUp()
          {
              $this->context = $this->getMockBuilder(Context::class)
                  ->disableOriginalConstructor()
                  ->getMock();
      Severity: Major
      Found in Test/Unit/Helper/PdfTest.php - About 3 hrs to fix

        Function performAfterLoad has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function performAfterLoad($tableName, $linkField)
            {
                $linkedIds = $this->getColumnValues($linkField);
        
                if (!empty($linkedIds)) {
        Severity: Minor
        Found in Model/ResourceModel/Pdfgenerator/AbstractCollection.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 execute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute()
            {
                $data = $this->getRequest()->getPostValue();
                /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
                $resultRedirect = $this->resultRedirectFactory->create();
        Severity: Minor
        Found in Controller/Adminhtml/Templates/Save.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

        Method config has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function config($templateModel)
            {
                $ori = $templateModel->getTemplatePaperOri();
                $orientation = $this->templatePaperOrientation->getAvailable();
                $finalOri = $orientation[$ori][0];
        Severity: Minor
        Found in Helper/Pdf.php - About 1 hr to fix

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

              public function execute()
              {
                  $data = $this->getRequest()->getPostValue();
                  /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
                  $resultRedirect = $this->resultRedirectFactory->create();
          Severity: Minor
          Found in Controller/Adminhtml/Templates/Save.php - About 1 hr to fix

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

                    EntityFactoryInterface $entityFactory,
                    LoggerInterface $logger,
                    FetchStrategyInterface $fetchStrategy,
                    ManagerInterface $eventManager,
                    StoreManagerInterface $storeManager,
            Severity: Major
            Found in Model/ResourceModel/Pdfgenerator/Grid/Collection.php - About 1 hr to fix

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

                  public function execute()
                  {
              
                      $template = $this->_initTemplate();
              
              
              Severity: Minor
              Found in Controller/Adminhtml/Variable/Template.php - About 1 hr to fix

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

                    public function testTemplate2Pdf()
                    {
                
                        $this->pdfGeneratorMock = $this->getMockBuilder(Pdfgenerator::class)
                            ->setMethods(['getTemplateCustomForm'])
                Severity: Minor
                Found in Test/Unit/Helper/PdfTest.php - About 1 hr to fix

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

                          Context $context,
                          Registry $coreRegistry,
                          Config $emailConfig,
                          JsonFactory $resultJsonFactory,
                          Pdf $helper,
                  Severity: Major
                  Found in Controller/Adminhtml/Order/Invoice/Printpdf.php - About 1 hr to fix

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

                        public function performAfterLoad($tableName, $linkField)
                        {
                            $linkedIds = $this->getColumnValues($linkField);
                    
                            if (!empty($linkedIds)) {
                    Severity: Minor
                    Found in Model/ResourceModel/Pdfgenerator/AbstractCollection.php - About 1 hr to fix

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

                          public function execute()
                          {
                      
                              $templateId = $this->getRequest()->getParam('template_id');
                      
                      
                      Severity: Minor
                      Found in Controller/Adminhtml/Order/Invoice/Printpdf.php - About 1 hr to fix

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

                                Context $context,
                                Renderer $addressRenderer,
                                PaymentHelper $paymentHelper,
                                InvoiceIdentity $identityContainer,
                                Processor $templateFactory,
                        Severity: Major
                        Found in Helper/Pdf.php - About 1 hr to fix

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

                              public function testGetTemplateStatus()
                              {
                          
                                  $invoiceMock = $this->getMockBuilder(Invoice::class)
                                      ->disableOriginalConstructor()
                          Severity: Minor
                          Found in Test/Unit/Helper/DataTest.php - About 1 hr to fix

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

                                public function setUp()
                                {
                                    $this->context = $this->getMockBuilder(Context::class)
                                        ->setMethods(['getScopeConfig'])
                                        ->disableOriginalConstructor()
                            Severity: Minor
                            Found in Test/Unit/Helper/DataTest.php - About 1 hr to fix

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

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

                                Method saveStoreRelation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function saveStoreRelation(AbstractModel $template)
                                    {
                                        $oldStores = $this->lookupStoreIds($template->getId());
                                        $newStores = (array)$template->getStoreId();
                                        if (empty($newStores)) {
                                Severity: Minor
                                Found in Model/ResourceModel/Pdfgenerator.php - About 1 hr to fix

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

                                      public function execute()
                                      {
                                          $id = $this->getRequest()->getParam('template_id');
                                  
                                          if ($id) {
                                  Severity: Minor
                                  Found in Controller/Adminhtml/Templates/Edit.php - About 1 hr to fix

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

                                            EntityFactoryInterface $entityFactory,
                                            LoggerInterface $logger,
                                            FetchStrategyInterface $fetchStrategy,
                                            ManagerInterface $eventManager,
                                            StoreManagerInterface $storeManager,
                                    Severity: Major
                                    Found in Model/ResourceModel/Pdfgenerator/AbstractCollection.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language