boldbrush/bread

View on GitHub

Showing 20 of 29 total issues

File Bread.php has 504 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace BoldBrush\Bread;
Severity: Major
Found in src/Bread.php - About 1 day to fix

    Bread has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Bread
    {
        /** @var string|Model $model */
        protected $model = null;
    
    
    Severity: Minor
    Found in src/Bread.php - About 5 hrs to fix

      Field has 32 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Field implements FieldInterface
      {
          protected $name;
      
          protected $editable = true;
      Severity: Minor
      Found in src/Field/Field.php - About 4 hrs to fix

        Method search has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function search(?array $sortBy)
            {
                $fields = $this->getFields()
                    ->for(FieldContainer::BROWSE)
                    ->toArray();
        Severity: Major
        Found in src/Bread.php - About 2 hrs to fix

          Function search has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function search(?array $sortBy)
              {
                  $fields = $this->getFields()
                      ->for(FieldContainer::BROWSE)
                      ->toArray();
          Severity: Minor
          Found in src/Bread.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 boot has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function boot()
              {
                  $this->loadViewsFrom(
                      realpath(dirname(dirname(__DIR__))) . '/resources/views',
                      'bread'
          Severity: Major
          Found in src/Provider/BreadServiceProvider.php - About 2 hrs to fix

            Method toDBAL has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function toDBAL(array $config): array
                {
                    switch (true) {
                        case $config['driver'] === 'sqlite':
                            return [
            Severity: Minor
            Found in src/System/Database/ConfigTransformer.php - About 2 hrs to fix

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

                  public function save(?int $id = null, ?array $data = [])
                  {
                      $this->checkIfModelHasBeenSetup();
              
                      $model = $this->model;
              Severity: Minor
              Found in src/Bread.php - About 1 hr to fix

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

                    public function browse(): string
                    {
                        $this->checkIfModelHasBeenSetup();
                
                        $model = $this->model;
                Severity: Minor
                Found in src/Bread.php - About 1 hr to fix

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

                      public function browse(): string
                      {
                          $this->checkIfModelHasBeenSetup();
                  
                          $model = $this->model;
                  Severity: Minor
                  Found in src/Bread.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 save has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function save(?int $id = null, ?array $data = [])
                      {
                          $this->checkIfModelHasBeenSetup();
                  
                          $model = $this->model;
                  Severity: Minor
                  Found in src/Bread.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 create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function create(?array $data = [])
                      {
                          $this->checkIfModelHasBeenSetup();
                  
                          $model = $this->model;
                  Severity: Minor
                  Found in src/Bread.php - About 1 hr to fix

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

                        public function init(): void
                        {
                            if (is_array($this->config)) {
                                foreach ($this->config as $method => $value) {
                                    try {
                    Severity: Minor
                    Found in src/Config/Initializer.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 setupFields has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function setupFields(string $for = FieldContainer::GENERAL): self
                        {
                            $sm = $this->getConnectionConfigForModel()
                                ->createSchemaManager();
                    
                    
                    Severity: Minor
                    Found in src/Bread.php - About 1 hr to fix

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

                          public function setupFields(string $for = FieldContainer::GENERAL): self
                          {
                              $sm = $this->getConnectionConfigForModel()
                                  ->createSchemaManager();
                      
                      
                      Severity: Minor
                      Found in src/Bread.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 getColumns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getColumns()
                          {
                              if ($this->count() === 0) {
                                  return [];
                              }
                      Severity: Minor
                      Found in src/View/Browser.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

                              array $general = [],
                              array $browse = [],
                              array $read = [],
                              array $edit = [],
                              array $add = []
                      Severity: Minor
                      Found in src/Field/FieldContainer.php - About 35 mins to fix

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

                            public function create(?array $data = [])
                            {
                                $this->checkIfModelHasBeenSetup();
                        
                                $model = $this->model;
                        Severity: Minor
                        Found in src/Bread.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 resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function resolve(): bool
                            {
                                foreach ($this->data as $name => $data) {
                                    $field = $this->bread->configureFields()->field($name);
                                    foreach ($data as $method => $value) {
                        Severity: Minor
                        Found in src/Config/Resolver/FieldResolver.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function __construct(?array $routes = null, ?string $pkColumn = null)
                            {
                                if (isset($routes['browse'])) {
                                    $this->setBrowseRoute($routes['browse']);
                                }
                        Severity: Minor
                        Found in src/Helper/Route/Builder.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