AJenbo/agcms

View on GitHub

Showing 151 of 1,190 total issues

Function findPages has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function findPages(
        string $searchString,
        int $brandId,
        string $varenr = '',
        int $minpris = 0,
Severity: Minor
Found in application/inc/Http/Controllers/Search.php - About 55 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

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

        array $query = [],
        array $request = [],
        array $attributes = [],
        array $cookies = [],
        array $files = [],
Severity: Major
Found in application/inc/Http/Request.php - About 50 mins to fix

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

            string $searchString,
            int $brandId,
            string $varenr = '',
            int $minpris = 0,
            int $maxpris = 0,
    Severity: Minor
    Found in application/inc/Http/Controllers/Search.php - About 45 mins to fix

      Function circularLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function circularLinks(): JsonResponse
          {
              $html = '';
      
              $categories = app(OrmService::class)->getByQuery(Category::class, 'SELECT * FROM `kat` WHERE bind != 0 AND bind != -1');
      Severity: Minor
      Found in application/inc/Http/Controllers/Admin/MaintenanceController.php - About 45 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 isNoOp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function isNoOp(): bool
          {
              if ($this->cropW !== $this->image->getWidth() || $this->cropH !== $this->image->getHeight()) {
                  return false;
              }
      Severity: Minor
      Found in application/inc/Services/ImageService.php - About 45 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 removeFromCategory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function removeFromCategory(Request $request, int $id, int $categoryId): JsonResponse
          {
              $orm = app(OrmService::class);
      
              $page = $orm->getOne(Page::class, $id);
      Severity: Minor
      Found in application/inc/Http/Controllers/Admin/PageController.php - About 45 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 status has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function status(Request $request, int $id, string $checkId): Response
          {
              $invoice = app(OrmService::class)->getOne(Invoice::class, $id);
              if (!$invoice || $checkId !== $invoice->getCheckId()) {
                  return redirect('/betaling/?id=' . $id . '&checkid=' . rawurlencode($checkId), Response::HTTP_SEE_OTHER);
      Severity: Minor
      Found in application/inc/Http/Controllers/Payment.php - About 45 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 search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function search(Request $request): JsonResponse
          {
              $returnType = $request->query->get('return');
              if (!is_string($returnType)) {
                  $returnType = '';
      Severity: Minor
      Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 45 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 report has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function report(Throwable $exception): void
          {
              $this->lastLogId = null;
              if (!$this->shouldLog($exception)) {
                  return;
      Severity: Minor
      Found in application/inc/Exceptions/Handler.php - About 45 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

      Avoid deeply nested control flow statements.
      Open

                                  if ($data instanceof stdClass) {
                                      return $data;
                                  }
      Severity: Major
      Found in application/inc/Services/EpaymentService.php - About 45 mins to fix

        Function image has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function image(Request $request, int $id): Response
            {
                $file = app(OrmService::class)->getOne(File::class, $id);
                if (!$file) {
                    throw new InvalidInput(_('File not found.'), Response::HTTP_NOT_FOUND);
        Severity: Minor
        Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 45 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 getOneByQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getOneByQuery(string $class, string $query): ?AbstractEntity
            {
                $query = preg_replace('/\s+/u', ' ', $query);
                if (null === $query) {
                    throw new Exception('preg_replace failed');
        Severity: Minor
        Found in application/inc/Services/OrmService.php - About 45 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 request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            "request": function(uri, callback, method, data) {
                const id = xHttp.requests.length;
        
                const x = new window.XMLHttpRequest();
                x.responseType = "json";
        Severity: Minor
        Found in source/javascript/xHttp.js - About 45 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

        Consider simplifying this complex logical expression.
        Open

                    if (x.status < 200 || x.status > 299 || x.response.error) {
                        const message = (x.response && x.response.error && x.response.error.message) || x.statusText;
                        alert("Error: " + message);
                    }
        Severity: Major
        Found in source/javascript/xHttp.js - About 40 mins to fix

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

          function getAddressCallback1(responce) {
              if (responce.error) {
                  return;
              }
              if (responce.name) {
          Severity: Minor
          Found in source/javascript/site.js - 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 sendInvoice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function sendInvoice(Invoice $invoice): void
              {
                  if (!$invoice->hasValidEmail()) {
                      throw new InvalidInput(_('Email is not valid.'));
                  }
          Severity: Minor
          Found in application/inc/Services/InvoiceService.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 getByQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getByQuery(string $class, string $query): array
              {
                  $query = preg_replace('/\s+/u', ' ', $query);
                  if (null === $query) {
                      throw new Exception('preg_replace failed');
          Severity: Minor
          Found in application/inc/Services/OrmService.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 removeNoneExistingFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function removeNoneExistingFiles(): JsonResponse
              {
                  $files = app(OrmService::class)->getByQuery(File::class, 'SELECT * FROM `files`');
          
                  $app = app();
          Severity: Minor
          Found in application/inc/Http/Controllers/Admin/MaintenanceController.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 getAddressCallback2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function getAddressCallback2(responce) {
              if (responce.error) {
                  return;
              }
              if (responce.name) {
          Severity: Minor
          Found in source/javascript/site.js - 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 folderRename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function folderRename(Request $request): JsonResponse
              {
                  $path = $request->getRequestString('path') ?? '';
                  $name = $request->getRequestString('name') ?? '';
                  $name = $this->fileService->cleanFileName($name);
          Severity: Minor
          Found in application/inc/Http/Controllers/Admin/ExplorerController.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

          Severity
          Category
          Status
          Source
          Language