flextype/flextype

View on GitHub

Showing 67 of 117 total issues

Function getValidPluginsDependencies has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

    public function getValidPluginsDependencies(array $plugins): array
    {
        // Set verified plugins array
        $verifiedPlugins = [];

Severity: Minor
Found in src/flextype/core/Plugins.php - About 1 day 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

File Entries.php has 462 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/**
Severity: Minor
Found in src/flextype/core/Entries/Entries.php - About 7 hrs to fix

    Function fetch has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fetch(string $id, array $options = [])
        {
            // Setup registry.
            $this->registry()->set('methods.fetch', [
                    'collection' => $this->getCollectionOptions($id),
    Severity: Minor
    Found in src/flextype/core/Entries/Entries.php - About 6 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 filterCollection has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        function filterCollection($items = [], array $options = []): array
        {
            $collection = arrays($items);
    
            ! isset($options['return']) and $options['return'] = 'all';
    Severity: Minor
    Found in src/flextype/helpers/arrays.php - About 5 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 imageFile has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        function imageFile(string $file, array $options = [])
        {
            $image = Image::make($file);
    
            if (count($options) === 0) {
    Severity: Minor
    Found in src/flextype/helpers/image.php - About 5 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 fetch has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function fetch(string $id, array $options = [])
        {
            // Setup registry.
            $this->registry()->set('methods.fetch', [
                    'collection' => $this->getCollectionOptions($id),
    Severity: Major
    Found in src/flextype/core/Entries/Entries.php - About 5 hrs to fix

      Method imageFile has 115 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function imageFile(string $file, array $options = [])
          {
              $image = Image::make($file);
      
              if (count($options) === 0) {
      Severity: Major
      Found in src/flextype/helpers/image.php - About 4 hrs to fix

        Function execute has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output): int
            {
                $io = new SymfonyStyle($input, $output);
        
                $result = Command::SUCCESS;
        Severity: Minor
        Found in src/flextype/core/Console/Commands/Cache/CacheClearCommand.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

        Function execute has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output): int
            {
                $io = new SymfonyStyle($input, $output);
        
                $id      = $input->getArgument('id') ? $input->getArgument('id') : '';
        Severity: Minor
        Found in src/flextype/core/Console/Commands/Entries/EntrieFetchCommand.php - About 3 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 init has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function init(): void
            {
                // Set empty plugins item
                registry()->set('plugins', []);
        
        
        Severity: Minor
        Found in src/flextype/core/Plugins.php - About 3 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

        File flextype.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        /**
        Severity: Minor
        Found in src/flextype/flextype.php - About 3 hrs to fix

          Function validateApiRequest has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function validateApiRequest(array $options)
              {
                  if (! isset($options['api']) && ! is_string($options['api'])) {
                      return $this->getStatusCodeMessage(400);
                  }
          Severity: Minor
          Found in src/flextype/core/Endpoints/Api.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 getBaseUrl has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              function getBaseUrl(): string
              {
                  $baseUrl  = registry()->get('flextype.settings.base_url') ?? '';
                  $basePath = registry()->get('flextype.settings.base_path') ?? '';
          
          
          Severity: Minor
          Found in src/flextype/helpers/urls.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 init has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function init(): void
              {
                  // Set empty plugins item
                  registry()->set('plugins', []);
          
          
          Severity: Major
          Found in src/flextype/core/Plugins.php - About 2 hrs to fix

            Method getValidPluginsDependencies has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getValidPluginsDependencies(array $plugins): array
                {
                    // Set verified plugins array
                    $verifiedPlugins = [];
            
            
            Severity: Major
            Found in src/flextype/core/Plugins.php - About 2 hrs to fix

              Method filterCollection has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function filterCollection($items = [], array $options = []): array
                  {
                      $collection = arrays($items);
              
                      ! isset($options['return']) and $options['return'] = 'all';
              Severity: Major
              Found in src/flextype/helpers/arrays.php - About 2 hrs to fix

                Method install has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function install(): ?WhoopsRun 
                    {
                        if ($this->settings['enable'] === false) {
                            return null;
                        }
                Severity: Major
                Found in src/flextype/core/Whoops.php - About 2 hrs to fix

                  Method execute has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function execute(InputInterface $input, OutputInterface $output): int
                      {
                          $io = new SymfonyStyle($input, $output);
                  
                          $id      = $input->getArgument('id') ? $input->getArgument('id') : '';
                  Severity: Major
                  Found in src/flextype/core/Console/Commands/Entries/EntrieFetchCommand.php - About 2 hrs to fix

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

                        private function loadCollectionsEvents(): void
                        {
                            $events = [];
                    
                            if (! isset($this->options['collections']) ||
                    Severity: Minor
                    Found in src/flextype/core/Entries/Entries.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 validateApiRequest has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function validateApiRequest(array $options)
                        {
                            if (! isset($options['api']) && ! is_string($options['api'])) {
                                return $this->getStatusCodeMessage(400);
                            }
                    Severity: Major
                    Found in src/flextype/core/Endpoints/Api.php - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language