projek-xyz/slim-framework

View on GitHub

Showing 33 of 33 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

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

    abstract class Models implements \Countable
    {
        const UPDATED = 'updated_at';
        const CREATED = 'created_at';
        const DELETED = 'deleted_at';
    Severity: Minor
    Found in src/Database/Models.php - About 2 hrs to fix

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

          protected function migratePhp($filepath, $action = 'up')
          {
              $migration = require $filepath;
              $callable = null;
              $schema = $this->newBlueprint();
      Severity: Minor
      Found in src/Database/Migrator.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

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

          protected function normalizeTerms(StatementContainer $stmt, $terms)
          {
              if ($terms instanceof Models) {
                  $terms = $terms->key();
              }
      Severity: Minor
      Found in src/Database/Models.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 array_get has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          function array_get($array, $key, $default = null)
          {
              if ($array instanceof \Slim\Collection) {
                  $array = $array->all();
              }
      Severity: Minor
      Found in src/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 migrate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function migrate($action = 'up')
          {
              $migrated = 0;
      
              try {
      Severity: Minor
      Found in src/Database/Migrator.php - About 1 hr to fix

        Method listen has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function listen(array $argv = [])
            {
                $this->climate->description(config('app.description'));
                $this->climate->arguments->add([
                    'help' => [
        Severity: Minor
        Found in src/Console.php - About 1 hr to fix

          Function normalizeDefinition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              private function normalizeDefinition($key, $value)
              {
                  if (is_numeric($key) && in_array($value, ['null', null])) {
                      $key = $value;
                      $value = true;
          Severity: Minor
          Found in src/Database/Schema/DefinitionsTrait.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 execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function execute(Console\Commands $command, $args)
              {
                  $this->climate->arguments->description($command->description());
          
                  foreach ($command->arguments() as $name => $options) {
          Severity: Minor
          Found in src/Console.php - About 1 hr to fix

            Method migratePhp has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function migratePhp($filepath, $action = 'up')
                {
                    $migration = require $filepath;
                    $callable = null;
                    $schema = $this->newBlueprint();
            Severity: Minor
            Found in src/Database/Migrator.php - About 1 hr to fix

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

                  public function migrate($action = 'up')
                  {
                      $migrated = 0;
              
                      try {
              Severity: Minor
              Found in src/Database/Migrator.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 renderExeption has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function renderExeption(\Exception $exception)
                  {
                      $message = $exception->getMessage();
                      if ($code = $exception->getCode()) {
                          $message = sprintf('[%s] %s', $code, $message);
              Severity: Minor
              Found in src/Handlers/ConsoleErrorHandler.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

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

                  public function __construct($name = 'slim-config', array $settings = [])
                  {
                      $this->name = $name;
                      $this->monolog = new Monolog($this->name);
                      $this->settings = array_merge($this->settings, $settings);
              Severity: Minor
              Found in src/Logger.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 attaches has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function attaches($filepath, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
              Severity: Minor
              Found in src/Mailer/SmtpDriver.php - About 35 mins to fix

                Method attaches has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function attaches($filepath, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment');
                Severity: Minor
                Found in src/Mailer/MailDriverInterface.php - About 35 mins to fix

                  Method join has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      protected function join($model, $first = null, $operator = '=', $second = null, $joinType = 'INNER')
                  Severity: Minor
                  Found in src/Database/Models.php - About 35 mins to fix

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

                        protected function normalizeColumns($columns)
                        {
                            foreach ($columns as $column => $definition) {
                                if (!is_numeric($column) && is_array($definition)) {
                                    continue;
                    Severity: Minor
                    Found in src/Database/Schema/CreateSchema.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 input has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function input($prompt, $default = '', $acceptable = null, $strict = false)
                        {
                            if ($this->hasSttyAvailable()) {
                                $input = $this->climate->input($prompt);
                    
                    
                    Severity: Minor
                    Found in src/Console/Input.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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function execute(Console\Commands $command, $args)
                        {
                            $this->climate->arguments->description($command->description());
                    
                            foreach ($command->arguments() as $name => $options) {
                    Severity: Minor
                    Found in src/Console.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 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
                      Severity
                      Category
                      Status
                      Source
                      Language