AsgardCms/Core

View on GitHub

Showing 11 of 14 total issues

File available-locales.php has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

return [
    'ace' => ['name' => 'Achinese', 'script' => 'Latn', 'native' => 'Aceh'],
    'af' => ['name' => 'Afrikaans', 'script' => 'Latn', 'native' => 'Afrikaans'],
Severity: Minor
Found in Config/available-locales.php - About 3 hrs to fix

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

        public function save(array $options = array())
        {
            $tempTranslations = $this->translations;
            if ($this->exists) {
                if (count($this->getDirty()) > 0) {
    Severity: Minor
    Found in Internationalisation/Translatable.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct(Authentication $auth, Store $session, Request $request, Redirector $redirect, Application $application)
    Severity: Minor
    Found in Http/Middleware/AdminMiddleware.php - About 35 mins to fix

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

          public static function separateLanguages($data)
          {
              $cleanedData = [];
              foreach ($data as $key => $value) {
                  if (is_array($value)) {
      Severity: Minor
      Found in Internationalisation/Helper.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 allPublicThemes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function allPublicThemes()
          {
              $themes = [];
              if (!$this->getFinder()->isDirectory($this->path)) {
                  return $themes;
      Severity: Minor
      Found in Foundation/Theme/ThemeManager.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

      Avoid too many return statements within this method.
      Open

              return false;
      Severity: Major
      Found in Internationalisation/Translatable.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $this->loadTranslationsFrom($module->getPath() . '/Resources/lang', $moduleName);
        Severity: Major
        Found in Providers/CoreServiceProvider.php - About 30 mins to fix

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

              private function setLocalesConfigurations()
              {
                  if (! $this->app['asgard.isInstalled']) {
                      return;
                  }
          Severity: Minor
          Found in Providers/CoreServiceProvider.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

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

              protected function getValidatorInstance()
              {
                  $factory = $this->container->make('Illuminate\Validation\Factory');
                  if (method_exists($this, 'validator')) {
                      return $this->container->call([$this, 'validator'], compact('factory'));
          Severity: Minor
          Found in Internationalisation/BaseFormRequest.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

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

              protected function registerLanguageNamespace(Module $module)
              {
                  $moduleName = $module->getName();
          
                  $langPath = base_path("resources/lang/$moduleName");
          Severity: Minor
          Found in Providers/CoreServiceProvider.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

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

              private static function saveTranslatedProperties($model, $data)
              {
                  foreach ($data as $lang => $value) {
                      if (is_array($value)) {
                          foreach ($value as $key => $input) {
          Severity: Minor
          Found in Internationalisation/Helper.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

          Severity
          Category
          Status
          Source
          Language