AJenbo/agcms

View on GitHub

Showing 151 of 1,190 total issues

Contact has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class Contact extends AbstractEntity
{
    /**  Table name in database. */
    public const TABLE_NAME = 'email';

Severity: Minor
Found in application/inc/Models/Contact.php - About 3 hrs to fix

    Method createFromCart has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createFromCart(array $cart): Invoice
        {
            $db = app(DbService::class);
            $orm = app(OrmService::class);
            $amount = 0;
    Severity: Major
    Found in application/inc/Services/InvoiceService.php - About 3 hrs to fix

      Method getPageData has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getPageData(string $type, Page $page): array
          {
              $categories = $page->getCategories();
              $paths = [];
              $isVisible = false;
      Severity: Major
      Found in application/inc/Http/Controllers/Admin/ExportController.php - About 3 hrs to fix

        Function getTransactionData has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getTransactionData(string $orderId): stdClass
            {
                foreach (['PAYMENT_CAPTURED', 'PAYMENT_NEW', 'PAYMENT_DELETED'] as $status) {
                    $response = $this->getConnection()->gettransactionlist($this->getSearchData($orderId, $status));
                    if ($response instanceof stdClass) {
        Severity: Minor
        Found in application/inc/Services/EpaymentService.php - About 3 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

        Category has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Category extends AbstractRenderable
        {
            use HasIcon;
        
            /** Table name in database. */
        Severity: Minor
        Found in application/inc/Models/Category.php - About 3 hrs to fix

          File InvoiceController.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace App\Http\Controllers\Admin;
          
          use App\Countries;
          Severity: Minor
          Found in application/inc/Http/Controllers/Admin/InvoiceController.php - About 2 hrs to fix

            ExplorerController has 25 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class ExplorerController extends AbstractAdminController
            {
                private FileService $fileService;
            
                public function __construct()
            Severity: Minor
            Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 2 hrs to fix

              File ExportController.php has 282 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              namespace App\Http\Controllers\Admin;
              
              use App\Enums\ColumnType;
              Severity: Minor
              Found in application/inc/Http/Controllers/Admin/ExportController.php - About 2 hrs to fix

                Method rss has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function rss(Request $request): Response
                    {
                        $db = app(DbService::class);
                
                        $db->addLoadedTable('bind', 'files', 'kat', 'maerke', 'sider');
                Severity: Major
                Found in application/inc/Http/Controllers/Feed.php - About 2 hrs to fix

                  File invoice.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import xHttp from "../xHttp.js";
                  import {genericCallback, reloadCallback, getSelectValue} from "./javascript.js";
                  import {getAddress, changeZipCode} from "../getAddress.js";
                  
                  var invoiceLines = [];
                  Severity: Minor
                  Found in source/javascript/admin/invoice.js - About 2 hrs to fix

                    Method mismatchedBindings has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function mismatchedBindings(): JsonResponse
                        {
                            $html = '';
                    
                            // Map out active / inactive
                    Severity: Major
                    Found in application/inc/Http/Controllers/Admin/MaintenanceController.php - About 2 hrs to fix

                      File InvoicePdfService.php has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace App\Services;
                      
                      use App\Countries;
                      Severity: Minor
                      Found in application/inc/Services/InvoicePdfService.php - About 2 hrs to fix

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

                            public function update(Request $request, int $id): JsonResponse
                            {
                                $orm = app(OrmService::class);
                        
                                $category = $orm->getOne(Category::class, $id);
                        Severity: Minor
                        Found in application/inc/Http/Controllers/Admin/CategoryController.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 generateFilterInvoiceBySelection has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function generateFilterInvoiceBySelection(InvoiceFilter $selected, User $user): string
                            {
                                if ($selected->id) {
                                    return 'WHERE `id` = ' . $selected->id;
                                }
                        Severity: Minor
                        Found in application/inc/Http/Controllers/Admin/InvoiceController.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 findPages has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function findPages(
                                string $searchString,
                                int $brandId,
                                string $varenr = '',
                                int $minpris = 0,
                        Severity: Major
                        Found in application/inc/Http/Controllers/Search.php - About 2 hrs to fix

                          Method getDbArray has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getDbArray(): array
                              {
                                  $itemQuantities = [];
                                  $itemTitle = [];
                                  $itemValue = [];
                          Severity: Major
                          Found in application/inc/Models/Invoice.php - About 2 hrs to fix

                            Method buildSearchQuery has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function buildSearchQuery(string $qpath, string $qalt, string $qtype): string
                                {
                                    $db = app(DbService::class);
                                    $qpath = $db->escapeWildcards($qpath);
                                    $qalt = $db->escapeWildcards($qalt);
                            Severity: Major
                            Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 2 hrs to fix

                              File Category.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              
                              namespace App\Models;
                              
                              use App\Exceptions\InvalidInput;
                              Severity: Minor
                              Found in application/inc/Models/Category.php - About 2 hrs to fix

                                Function setItemData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function setItemData(string $itemData): self
                                    {
                                        $this->items = [];
                                
                                        $items = json_decode($itemData, true);
                                Severity: Minor
                                Found in application/inc/Models/Invoice.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 index has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function index(Request $request): Response
                                    {
                                        $momssats = strval($request->get('momssats'));
                                        if (!$momssats) {
                                            $momssats = null;
                                Severity: Major
                                Found in application/inc/Http/Controllers/Admin/InvoiceController.php - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language