Dwarfex/WordpressApiWrapper

View on GitHub

Showing 8 of 8 total issues

Post has 46 functions (exceeds 20 allowed). Consider refactoring.
Open

class Post extends HydratableModel
{
    /**
     * @var int
     */
Severity: Minor
Found in src/Model/Post.php - About 6 hrs to fix

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

    class ImageMeta extends HydratableModel
    {
        /**
         * @var string
         */
    Severity: Minor
    Found in src/Model/Media/ImageMeta.php - About 2 hrs to fix

      Method getPosts has 20 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              int $page = 1,
              int $perPage = 10,
              string $search = null,
              string $context = null,
              string $after = null,
      Severity: Major
      Found in src/Service/Main/PostService.php - About 2 hrs to fix

        File Post.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        declare(strict_types=1);
        
        namespace Somecoding\WordpressApiWrapper\Model;
        
        
        Severity: Minor
        Found in src/Model/Post.php - About 2 hrs to fix

          Method getPosts has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getPosts(
                  int $page = 1,
                  int $perPage = 10,
                  string $search = null,
                  string $context = null,
          Severity: Minor
          Found in src/Service/Main/PostService.php - About 1 hr to fix

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

                public function getHydratedApiPage(string $page, array $parameters = [])
                {
                    $offset = 0;
            
            
            
            Severity: Minor
            Found in src/Service/ApiService.php - About 1 hr to fix

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

                  public function getHydratedApiPage(string $page, array $parameters = [])
                  {
                      $offset = 0;
              
              
              
              Severity: Minor
              Found in src/Service/ApiService.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

                      Client $client,
                      HydratorInterface $hydrator,
                      Config $wordpressWrapperConfig,
                      string $siteUrl = null,
                      CacheInterface $simpleCacheAdapter = null
              Severity: Minor
              Found in src/Service/ApiService.php - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language