intraxia/wp-gistpen

View on GitHub
app/Jobs/AbstractJob.php

Summary

Maintainability
C
1 day
Test Coverage

AbstractJob has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractJob implements Job {
    /**
     * EntityManager service.
     *
     * @var EntityManager
Severity: Minor
Found in app/Jobs/AbstractJob.php - About 4 hrs to fix

    File AbstractJob.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Intraxia\Gistpen\Jobs;
    
    use Intraxia\Gistpen\Contract\Job;
    Severity: Minor
    Found in app/Jobs/AbstractJob.php - About 2 hrs to fix

      Function process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function process() {
              if ( $this->is_running() ) {
                  return new WP_Error(
                      'job_running',
                      sprintf(
      Severity: Minor
      Found in app/Jobs/AbstractJob.php - About 1 hr 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 process has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function process() {
              if ( $this->is_running() ) {
                  return new WP_Error(
                      'job_running',
                      sprintf(
      Severity: Minor
      Found in app/Jobs/AbstractJob.php - About 1 hr to fix

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

            public function dispatch( Collection $items = null ) {
                if ( null === $items ) {
                    $items = $this->fetch_items();
                }
        
        
        Severity: Minor
        Found in app/Jobs/AbstractJob.php - About 1 hr to fix

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

              protected function log_response_error_impl( $error_message, $auth_message, $client_message, $id, WP_Error $response ) {
                  $this->log(
                      sprintf(
                          $error_message,
                          $id,
          Severity: Minor
          Found in app/Jobs/AbstractJob.php - About 1 hr to fix

            Method log_response_error_impl has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected function log_response_error_impl( $error_message, $auth_message, $client_message, $id, WP_Error $response ) {
            Severity: Minor
            Found in app/Jobs/AbstractJob.php - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status