gloireTR/Anidb

View on GitHub
src/anime/Anime.php

Summary

Maintainability
F
4 days
Test Coverage

Showing 10 of 10 total issues

File Anime.php has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
* Class AnidbAnime
* @brief Anime Setup
* @author gloire
Severity: Minor
Found in src/anime/Anime.php - About 4 hrs to fix

    Function getStaff has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    public function getStaff()
    {
    preg_match_all(parent::PATTERN_STAFF, $this->html, $exArray);
    if (isset($exArray[1][0]) && isset($exArray[2][0])) {
    $firstId = $exArray[1][0];
    Severity: Minor
    Found in src/anime/Anime.php - About 2 hrs to fix

    Method getStaff has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    public function getStaff()
    {
    preg_match_all(parent::PATTERN_STAFF, $this->html, $exArray);
    if (isset($exArray[1][0]) && isset($exArray[2][0])) {
    $firstId = $exArray[1][0];
    Severity: Major
    Found in src/anime/Anime.php - About 2 hrs to fix

      Anime has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      final class Anime extends Options
      {
      /**
      * @param $cloud_name
      * @param $key
      Severity: Minor
      Found in src/anime/Anime.php - About 2 hrs to fix

        Method getCharacters has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        public function getCharacters()
        {
        preg_match_all(parent::PATTERN_CHARACTERS, $this->html, $mainCharArray);
        if (!empty($mainCharArray[0])) {
        $firstCharId = $mainCharArray[7][0];
        Severity: Minor
        Found in src/anime/Anime.php - About 1 hr to fix

          Method getCast has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          public function getCast()
          {
          preg_match_all(parent::PATTERN_CAST, $this->html, $castArray);
          if (!empty($castArray[0])) {
          $firstCastId = $castArray[2][0];
          Severity: Minor
          Found in src/anime/Anime.php - About 1 hr to fix

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

            public function getDirectlyRelatedAnimes()
            {
            preg_match_all(parent::PATTERN_DIRECTLY_RELATED, $this->html, $directArr);
            if (empty($directArr[0])) {
            preg_match_all(parent::PATTERN_CONTROL_DIRECTLY_RELATED, $this->html, $directArr);
            Severity: Minor
            Found in src/anime/Anime.php - About 1 hr to fix

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

              public function getCast()
              {
              preg_match_all(parent::PATTERN_CAST, $this->html, $castArray);
              if (!empty($castArray[0])) {
              $firstCastId = $castArray[2][0];
              Severity: Minor
              Found in src/anime/Anime.php - About 25 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if (!empty($directArr[0])) {
              $del = explode('/', $directArr[3][0]);
              $firstKey = end($del);
              $firstValue = $directArr[4][0];
               
              Severity: Major
              Found in src/anime/Anime.php and 1 other location - About 1 day to fix
              src/anime/Anime.php on lines 206..230

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if (!empty($similarArray[0])) {
              $del = explode('/', $similarArray[3][0]);
              $firstKey = end($del);
              $firstValue = $similarArray[4][0];
               
              Severity: Major
              Found in src/anime/Anime.php and 1 other location - About 1 day to fix
              src/anime/Anime.php on lines 176..200
              Category
              Status