projek-xyz/slim-framework

View on GitHub
src/DefaultServicesProvider.php

Summary

Maintainability
C
1 day
Test Coverage

Showing 13 of 13 total issues

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

public function register(PimpleContainer $container)
{
/** @var Collection $settings */
$settings = $container->get('settings');
 
 
Severity: Major
Found in src/DefaultServicesProvider.php - About 4 hrs to fix

    Avoid too many return statements within this method.
    Open

    return $driver;
    Severity: Major
    Found in src/DefaultServicesProvider.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

      return new SlimDatabase($db['dsn'], $db['user'], $db['pass'], [
      \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_CLASS
      ]);
      Severity: Major
      Found in src/DefaultServicesProvider.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

        return $view;
        Severity: Major
        Found in src/DefaultServicesProvider.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

          return new Uploader($settings['upload']);
          Severity: Major
          Found in src/DefaultServicesProvider.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

            return new Database\Migrator($container->get('db'), $directory);
            Severity: Major
            Found in src/DefaultServicesProvider.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

              return array_merge($commands, $settings->get('commands', []));
              Severity: Major
              Found in src/DefaultServicesProvider.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                return function ($class) use ($container) {
                if (!class_exists($class)) {
                throw new \LogicException("Data model class {$class} not exists ");
                }
                 
                 
                Severity: Major
                Found in src/DefaultServicesProvider.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                  return function ($data, array $rules) use ($container) {
                  if ($data instanceof ServerRequestInterface) {
                  $data = $data->getParsedBody();
                  }
                   
                   
                  Severity: Major
                  Found in src/DefaultServicesProvider.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                    return new Logger($settings['basename'], $settings['logger'] ?: []);
                    Severity: Major
                    Found in src/DefaultServicesProvider.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                      return new Mailer(
                      $container->get(Mailer\MailDriverInterface::class)
                      );
                      Severity: Major
                      Found in src/DefaultServicesProvider.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                        return new FileSystem($settings->get('filesystem', []));
                        Severity: Major
                        Found in src/DefaultServicesProvider.php - About 30 mins to fix

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

                          public function register(PimpleContainer $container)
                          {
                          /** @var Collection $settings */
                          $settings = $container->get('settings');
                           
                           
                          Severity: Minor
                          Found in src/DefaultServicesProvider.php - About 25 mins to fix
                          Category
                          Status