src/WebServiceProvider.php

Summary

Maintainability
C
1 day
Test Coverage

WebServiceProvider has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class WebServiceProvider extends AbstractSeatPlugin
{
    /**
     * Bootstrap the application services.
     *
Severity: Minor
Found in src/WebServiceProvider.php - About 2 hrs to fix

    File WebServiceProvider.php has 277 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /*
     * This file is part of SeAT
     *
    Severity: Minor
    Found in src/WebServiceProvider.php - About 2 hrs to fix

      Function register_policies has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          private function register_policies()
          {
              $permissions = config('seat.permissions', []);
      
              Gate::define('global.superuser', 'Seat\Web\Acl\Policies\GlobalPolicy@superuser');
      Severity: Minor
      Found in src/WebServiceProvider.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 add_view_composers has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function add_view_composers()
          {
      
              // User information view composer
              $this->app['view']->composer([
      Severity: Minor
      Found in src/WebServiceProvider.php - About 1 hr to fix

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

            private function register_policies()
            {
                $permissions = config('seat.permissions', []);
        
                Gate::define('global.superuser', 'Seat\Web\Acl\Policies\GlobalPolicy@superuser');
        Severity: Minor
        Found in src/WebServiceProvider.php - About 1 hr to fix

          The class WebServiceProvider has a coupling between objects value of 42. Consider to reduce the number of dependencies under 13.
          Open

          class WebServiceProvider extends AbstractSeatPlugin
          {
              /**
               * Bootstrap the application services.
               *
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CouplingBetweenObjects

          Since: 1.1.0

          A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

          Example

          class Foo {
              /**
               * @var \foo\bar\X
               */
              private $x = null;
          
              /**
               * @var \foo\bar\Y
               */
              private $y = null;
          
              /**
               * @var \foo\bar\Z
               */
              private $z = null;
          
              public function setFoo(\Foo $foo) {}
              public function setBar(\Bar $bar) {}
              public function setBaz(\Baz $baz) {}
          
              /**
               * @return \SplObjectStorage
               * @throws \OutOfRangeException
               * @throws \InvalidArgumentException
               * @throws \ErrorException
               */
              public function process(\Iterator $it) {}
          
              // ...
          }

          Source https://phpmd.org/rules/design.html#couplingbetweenobjects

          The method register_services is not named in camelCase.
          Open

              private function register_services()
              {
                  // Register the datatables package!
                  //  https://laracasts.com/discuss/channels/laravel/register-service-provider-and-facade-within-service-provider
                  $this->app->register('Yajra\DataTables\DataTablesServiceProvider');
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_migrations is not named in camelCase.
          Open

              private function add_migrations()
              {
                  $this->loadMigrationsFrom(__DIR__ . '/database/migrations/');
              }
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_publications is not named in camelCase.
          Open

              private function add_publications()
              {
          
                  $this->publishes([
                      __DIR__ . '/resources/css' => public_path('web/css'),
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_routes is not named in camelCase.
          Open

              private function add_routes()
              {
                  $this->loadRoutesFrom(__DIR__ . '/Http/routes.php');
              }
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_view_composers is not named in camelCase.
          Open

              private function add_view_composers()
              {
          
                  // User information view composer
                  $this->app['view']->composer([
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_custom_validators is not named in camelCase.
          Open

              private function add_custom_validators()
              {
          
                  Validator::extend('cron', 'Seat\Web\Http\Validation\Custom\Cron@validate');
              }
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method override_horizon is not named in camelCase.
          Open

              private function override_horizon()
              {
                  $pool_key = sprintf('horizon.environments.%s', config('app.env', 'local'));
                  config([$pool_key => config('seat-queues')]);
              }
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method register_policies is not named in camelCase.
          Open

              private function register_policies()
              {
                  $permissions = config('seat.permissions', []);
          
                  Gate::define('global.superuser', 'Seat\Web\Acl\Policies\GlobalPolicy@superuser');
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_translations is not named in camelCase.
          Open

              private function add_translations()
              {
          
                  $this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'web');
              }
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method configure_horizon is not named in camelCase.
          Open

              private function configure_horizon()
              {
          
                  // Require the queue_manager role to view the dashboard
                  Horizon::auth(function () {
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_events is not named in camelCase.
          Open

              private function add_events()
              {
          
                  // Internal Authentication Events
                  $this->app->events->listen(LoginEvent::class, Login::class);
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_views is not named in camelCase.
          Open

              private function add_views()
              {
          
                  $this->loadViewsFrom(__DIR__ . '/resources/views', 'web');
              }
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method add_middleware is not named in camelCase.
          Open

              private function add_middleware(Router $router)
              {
          
                  // Authenticate checks that the session is
                  // simply authenticated
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          The method configure_api is not named in camelCase.
          Open

              private function configure_api()
              {
          
                  // ensure current annotations setting is an array of path or transform into it
                  $current_annotations = config('l5-swagger.paths.annotations');
          Severity: Minor
          Found in src/WebServiceProvider.php by phpmd

          CamelCaseMethodName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name methods.

          Example

          class ClassName {
              public function get_name() {
              }
          }

          Source

          There are no issues that match your filters.

          Category
          Status