AJenbo/agcms

View on GitHub

Showing 1,189 of 1,190 total issues

Function getInvalid has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function getInvalid(): array
    {
        $invalid = [];

        if (!$this->hasValidEmail()) {
Severity: Minor
Found in application/inc/Models/Invoice.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

Method address has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function address(Request $request, string $phoneNumber): JsonResponse
    {
        $db = app(DbService::class);

        $db->addLoadedTable('fakturas', 'email', 'post');
Severity: Major
Found in application/inc/Http/Controllers/Ajax.php - About 3 hrs to fix

    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

      The class ExplorerController has 20 public methods. Consider refactoring ExplorerController to keep number of public methods under 10.
      Open

      class ExplorerController extends AbstractAdminController
      {
          private FileService $fileService;
      
          public function __construct()

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class InvoiceService has an overall complexity of 94 which is very high. The configured complexity threshold is 50.
      Open

      class InvoiceService
      {
          /**
           * Create an invoice from the client cart array.
           *

      The class Category has an overall complexity of 62 which is very high. The configured complexity threshold is 50.
      Open

      class Category extends AbstractRenderable
      {
          use HasIcon;
      
          /** Table name in database. */
      Severity: Minor
      Found in application/inc/Models/Category.php by phpmd

      The class MaintenanceController has 12 public methods. Consider refactoring MaintenanceController to keep number of public methods under 10.
      Open

      class MaintenanceController extends AbstractAdminController
      {
          /**
           * Create or edit category.
           *

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class ExportController has an overall complexity of 60 which is very high. The configured complexity threshold is 50.
      Open

      class ExportController extends AbstractAdminController
      {
          /** @var array<int, string> */
          private array $header = [
              'ID',

      The class Page has an overall complexity of 60 which is very high. The configured complexity threshold is 50.
      Open

      class Page extends AbstractRenderable implements InterfaceRichText
      {
          use HasIcon;
      
          /** Table name in database. */
      Severity: Minor
      Found in application/inc/Models/Page.php by phpmd

      The class Payment has an overall complexity of 61 which is very high. The configured complexity threshold is 50.
      Open

      class Payment extends Base
      {
          private InvoiceService $invoiceService;
      
          /**

      The class InvoiceController has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
      Open

      class InvoiceController extends AbstractAdminController
      {
          /**
           * List of invoices.
           *

      The class Invoice has an overall complexity of 138 which is very high. The configured complexity threshold is 50.
      Open

      class Invoice extends AbstractEntity
      {
          /** Table name in database. */
          public const TABLE_NAME = 'fakturas';
      
      
      Severity: Minor
      Found in application/inc/Models/Invoice.php by phpmd

      The class InvoiceController has 11 public methods. Consider refactoring InvoiceController to keep number of public methods under 10.
      Open

      class InvoiceController extends AbstractAdminController
      {
          /**
           * List of invoices.
           *

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class ExplorerController has an overall complexity of 127 which is very high. The configured complexity threshold is 50.
      Open

      class ExplorerController extends AbstractAdminController
      {
          private FileService $fileService;
      
          public function __construct()

      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
                Severity
                Category
                Status
                Source
                Language