eveseat/services

View on GitHub

Showing 100 of 100 total issues

Missing class import via use statement (line '75', column '23').
Open

        $image = (new \Seat\Services\Image\Eve($type, $variation, $id, $size, $attr, $lazy))
Severity: Minor
Found in src/Helpers/helpers.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '35', column '24').
Open

            return new \Carbon\Carbon($data);
Severity: Minor
Found in src/Helpers/helpers.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '270', column '27').
Open

                throw new \Seat\Services\Exceptions\SettingException(
Severity: Minor
Found in src/Helpers/helpers.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method __construct has a boolean flag argument $protected_header, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function __construct(array $supported_types, bool $protected_header = true)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid too many return statements within this method.
Open

        return 'characters';
Severity: Major
Found in src/Image/Eve.php - About 30 mins to fix

    The method setting has a boolean flag argument $global, which is a certain sign of a Single Responsibility Principle violation.
    Open

        function setting($name, bool $global = false)
    Severity: Minor
    Found in src/Helpers/helpers.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method __construct has a boolean flag argument $debug, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function __construct(AnalyticsContainer $hit, $debug = false)
    Severity: Minor
    Found in src/Jobs/Analytics.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Avoid too many return statements within this method.
    Open

            return $installed_version;
    Severity: Major
    Found in src/Traits/VersionsManagementTrait.php - About 30 mins to fix

      The method img has a boolean flag argument $lazy, which is a certain sign of a Single Responsibility Principle violation.
      Open

          function img(string $type, string $variation, ?int $id, int $size, array $attr = [], $lazy = true)
      Severity: Minor
      Found in src/Helpers/helpers.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      Function down has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function down()
          {
      
              $sso_scopes = DB::table('global_settings')
                  ->where('name', 'sso_scopes')
      Severity: Minor
      Found in src/database/migrations/2020_04_27_231132_convert_sso_scopes_to_list.php - About 25 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

      The method html uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  if ($this->lazy) {
                      // images are lazy loaded. prepare the the data-src attributes with the
                      // location for the image.
                      $html .= 'src="' . asset('web/img/bg.png') . '" ';
      Severity: Minor
      Found in src/Image/Eve.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method parse uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          array_push($this->elements, $element);
                      }
      Severity: Minor
      Found in src/ReportParser/ReportParser.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid using static access to class '\Seat\Services\Models\Note' in method 'addNote'.
      Open

              return Note::create([
                  'object_type' => __CLASS__,
                  'object_id'   => $object_id,
                  'title'       => $title,
                  'note'        => $note,
      Severity: Minor
      Found in src/Traits/NotableTrait.php by phpmd

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class 'Schema' in method 'down'.
      Open

              Schema::drop('eve_notification_types');

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class 'Schema' in method 'down'.
      Open

              Schema::drop('schedules');

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'down'.
      Open

              Schema::dropIfExists('historical_prices');

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'down'.
      Open

              Schema::table('historical_prices', function (Blueprint $table) {
      
                  $table->decimal('average_price')->change();
                  $table->decimal('adjusted_price')->change();
              });

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class 'Coduo\PHPHumanizer\NumberHumanizer' in method 'number_metric'.
      Open

              return Coduo\PHPHumanizer\NumberHumanizer::metricSuffix($number);
      Severity: Minor
      Found in src/Helpers/helpers.php by phpmd

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      The method __construct() has an NPath complexity of 336. The configured NPath complexity threshold is 200.
      Open

          public function __construct(string $type, string $variation, ?int $id, int $size, array $attr = [], bool $lazy = true)
          {
              // Validate the arguments
              if (! in_array($type, $this->known_types))
                  throw new EveImageException($type . ' is not a valid image type.');
      Severity: Minor
      Found in src/Image/Eve.php by phpmd

      NPathComplexity

      Since: 0.1

      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

      Example

      class Foo {
          function bar() {
              // lots of complicated code
          }
      }

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

      The method html uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
      
                      // no lazy loaded image
                      $html .= 'src="' . $this->url($this->size) . '" ';
                  }
      Severity: Minor
      Found in src/Image/Eve.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Severity
      Category
      Status
      Source
      Language