eveseat/services

View on GitHub

Showing 106 of 106 total issues

Avoid using short method names like ConvertSsoScopesToList::up(). The configured minimum method name length is 3.
Open

    public function up()
    {

        $sso_scopes = DB::table('global_settings')
            ->where('name', 'sso_scopes')

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Function __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
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 - 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

Function number_roman has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    function number_roman($number)
    {

        $map = [
            'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50,
Severity: Minor
Found in src/Helpers/helpers.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

Function setting has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    function setting($name, bool $global = false)
    {

        // If we received an array, it means we want to set.
        if (is_array($name)) {
Severity: Minor
Found in src/Helpers/helpers.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 getPackageLatestVersion has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getPackageLatestVersion(string $vendor, string $package): string
    {
        // construct the packagist uri to its API
        $packagist_url = sprintf('https://packagist.org/packages/%s/%s.json',
            $vendor, $package);
Severity: Minor
Found in src/Traits/VersionsManagementTrait.php - About 1 hr to fix

    Method parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parse(string $report)
        {
            $lines = explode($this->line_delimiter, $report);
    
            foreach ($lines as $line)
    Severity: Minor
    Found in src/ReportParser/ReportParser.php - About 1 hr to fix

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

          public function html()
          {
      
              // make new IMG tag
              $html = '<img ';
      Severity: Minor
      Found in src/Image/Eve.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

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

          public function detect_type($id)
          {
              if ($id === null)
                  return 'unknown';
      
      
      Severity: Minor
      Found in src/Image/Eve.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

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

              $id = Seat::get('analytics_id');
      Severity: Minor
      Found in src/Jobs/Analytics.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          public function __construct(string $type, string $variation, ?int $id, int $size, array $attr = [], bool $lazy = true)
      Severity: Minor
      Found in src/Image/Eve.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $db. Configured minimum length is 3.
      Open

              $db = (new static::$model);
      Severity: Minor
      Found in src/Settings/Settings.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          protected $id;
      Severity: Minor
      Found in src/Image/Eve.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          public function detect_type($id)
      Severity: Minor
      Found in src/Image/Eve.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $id. Configured minimum length is 3.
      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

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

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

          public function __construct(string $type, string $variation, ?int $id, int $size, array $attr = [], bool $lazy = true)
      Severity: Minor
      Found in src/Image/Eve.php - About 45 mins to fix

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

            public function __get($key)
            {
                // fetch injected relations
                $extension_registry = app()->make(InjectedRelationRegistry::class);
                $extension_class = $extension_registry->getExtensionClassFor($this::class, $key);
        Severity: Minor
        Found in src/Models/ExtensibleModel.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

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

            function img(string $type, string $variation, ?int $id, int $size, array $attr = [], $lazy = true)
        Severity: Minor
        Found in src/Helpers/helpers.php - About 45 mins to fix

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

              protected function getPluginsMetadataList(): stdClass
              {
                  app()->loadDeferredProviders();
                  $providers = array_keys(app()->getLoadedProviders());
          
          
          Severity: Minor
          Found in src/Traits/VersionsManagementTrait.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

          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

          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

          Severity
          Category
          Status
          Source
          Language