mrcnpdlk/xmdb-api

View on GitHub

Showing 23 of 93 total issues

Consider simplifying this complex logical expression.
Open

            if (!empty($find['movie_results']) && \count($find['movie_results']) === 1) {
                $item = $find['movie_results'][0];

                $oTitle->isAdult      = isset($item['adult']) ? (bool)$item['adult'] : false;
                $oTitle->title        = $item['title'];
Severity: Major
Found in src/Tmdb.php - About 40 mins to fix

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

        public function __construct(int $id, int $seasonNumber, int $episodeCount = null, string $airDate = null, string $poster = null)
    Severity: Minor
    Found in src/Model/Tmdb/TvShow/Season.php - About 35 mins to fix

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

          public function searchByTitle(string $title)
          {
              try {
                  /**
                   * @var Title[] $answer
      Severity: Minor
      Found in src/Tmdb.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