EscolaLMS/API

View on GitHub

Showing 24 of 46 total issues

File curriculum.php has 1295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
return array(
"norecord"            => "No Record Found",
 "create"            => "Create New",
 "home"            => "Home",
Severity: Major
Found in resources/lang/en/curriculum.php - About 3 days to fix

    File texts.php has 524 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    //     INSERT INTO "topic_richtexts" ("id", "created_at", "updated_at", "value") VALUES
    
    return  [
        59 => ['2021-08-10 10:20:49',    '2021-08-10 10:20:49',    'Kiedy pracujemy (lub uczymy się) online jesteśmy wystawieni na wiele drobnych dystrakcji, od powiadomień z apek, które zachęcają by sprawdzić co nowego po zwykłą pokusę by uruchomić nową kartę i obejrzeć coś na YouTube. Jeśli masz problem ze skupieniem się i chcesz pomóc sobie w dokończeniu zadania lub pracy, ogranicz te dystrakcje za pomocą prostych rozwiązań takich jak blokowanie nieporządanych stron WWW czy aplikacji.
    Severity: Major
    Found in database/seeds/cyfrowy_dobrostan/texts.php - About 1 day to fix

      File ScormHelper.php has 508 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      
      namespace App\Library;
      
      
      Severity: Major
      Found in app/Library/ScormHelper.php - About 1 day to fix

        Method run has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function run(HeadlessH5PServiceContract $hh5pService)
            {
        
                $this->hh5pService = $hh5pService;
        
        
        Severity: Major
        Found in database/seeds/CyfrowyDobrostanSeeder.php - About 5 hrs to fix

          Method updateScoTracking has 136 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function updateScoTracking($scoUuid, $userId, $data)
              {
                  $tracking = $this->createScoTracking($scoUuid, $userId);
                  $tracking->setLatestDate(Carbon::now());
                  $sco    =   $tracking->getSco();
          Severity: Major
          Found in app/Library/ScormHelper.php - About 5 hrs to fix

            Function updateScoTracking has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

                public function updateScoTracking($scoUuid, $userId, $data)
                {
                    $tracking = $this->createScoTracking($scoUuid, $userId);
                    $tracking->setLatestDate(Carbon::now());
                    $sco    =   $tracking->getSco();
            Severity: Minor
            Found in app/Library/ScormHelper.php - About 4 hrs 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 createScoTracking has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createScoTracking($scoUuid, $userId = null)
                {
                    $sco    =   ScormScoModel::where('uuid', $scoUuid)->firstOrFail();
            
                    $version = $sco->scorm->version;
            Severity: Major
            Found in app/Library/ScormHelper.php - About 3 hrs to fix

              Method register has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function register()
                  {
                      $this->productServiceContract = app(ProductServiceContract::class);
              
                      Shop::registerProductableClass(Consultation::class);
              Severity: Major
              Found in app/Providers/ShopServiceProvider.php - About 2 hrs to fix

                Function uploadScormArchive has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function uploadScormArchive(UploadedFile $file)
                    {
                        // Checks if it is a valid scorm archive
                        $scormData  =   null;
                        $zip = new ZipArchive();
                Severity: Minor
                Found in app/Library/ScormHelper.php - About 2 hrs 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 uploadScormArchive has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function uploadScormArchive(UploadedFile $file)
                    {
                        // Checks if it is a valid scorm archive
                        $scormData  =   null;
                        $zip = new ZipArchive();
                Severity: Minor
                Found in app/Library/ScormHelper.php - About 2 hrs to fix

                  Method run has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function run()
                      {
                          $admin = Role::findOrCreate('admin', 'api');
                          $tutor = Role::findOrCreate('tutor', 'api');
                          $student = Role::findOrCreate('student', 'api');
                  Severity: Minor
                  Found in database/seeds/UserTableSeeder.php - About 1 hr to fix

                    Method run has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function run()
                        {
                            // first populate roles & permissions
                            $this->call(RoleTableSeeder::class);
                            $this->call(AuthPermissionSeeder::class);
                    Severity: Minor
                    Found in database/seeds/PermissionsSeeder.php - About 1 hr to fix

                      Function run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function run(HeadlessH5PServiceContract $hh5pService)
                          {
                      
                              $this->hh5pService = $hh5pService;
                      
                      
                      Severity: Minor
                      Found in database/seeds/CyfrowyDobrostanSeeder.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 parseScormArchive has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function parseScormArchive(UploadedFile $file)
                          {
                              $data = [];
                              $contents = '';
                              $zip = new \ZipArchive();
                      Severity: Minor
                      Found in app/Library/ScormHelper.php - About 1 hr to fix

                        Method run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function run()
                            {
                                $courses = Course::with('lessons')->get();
                                $contents = H5PContent::with('library')->get();
                                $scormScos = ScormScoModel::all();
                        Severity: Minor
                        Found in database/seeds/PostCoursesSeeder.php - About 1 hr to fix

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

                              public function return_output($type, $status_title, $message, $redirect_url, $status_code = ''): RedirectResponse
                              {
                                  //$type = error/flash - error on form validations, flash to show session values
                                  //$status_title = success/error/info - change colors in toastr as per the status
                          
                          
                          Severity: Minor
                          Found in app/Http/Controllers/Controller.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 HumanFileSize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function HumanFileSize($size, $unit="")
                              {
                                  if ((!$unit && $size >= 1<<30) || $unit == "GB") {
                                      return number_format($size/(1<<30), 2)." GB";
                                  }
                          Severity: Minor
                          Found in app/Library/EscolaHelpers.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 parseScormArchive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function parseScormArchive(UploadedFile $file)
                              {
                                  $data = [];
                                  $contents = '';
                                  $zip = new \ZipArchive();
                          Severity: Minor
                          Found in app/Library/ScormHelper.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 return_output has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function return_output($type, $status_title, $message, $redirect_url, $status_code = ''): RedirectResponse
                          Severity: Minor
                          Found in app/Http/Controllers/Controller.php - About 35 mins to fix

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

                                public function checkUserIsCompletedScorm($scormId, $userId)
                                {
                                    $completedSco    =   [];
                                    $scos   =   ScormScoModel::where('scorm_id', $scormId)->get();
                            
                            
                            Severity: Minor
                            Found in app/Library/ScormHelper.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