gloireTR/Anidb

View on GitHub

Showing 24 of 24 total issues

Function getAnimes has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
Open

public function getAnimes(){
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$control = '';
preg_match_all(parent::PATTERN_CREATOR_ANIMES . $this->creator_id . parent::PATTERN_SECOND_CREATOR_ANIMES, $this->html, $arr);
Severity: Minor
Found in src/creators/creators.php - About 1 day 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

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

foreach ($tr as $t){
$test = $t->childNodes;
foreach ($test as $ts){
if ($ts->nodeName == 'th'){
array_push($keys, strtolower($ts->nodeValue));
Severity: Major
Found in src/creators/creators.php and 1 other location - About 6 hrs to fix
src/characters/characters.php on lines 72..96

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

foreach ($tr as $t) {
$childTr = $t->childNodes;
foreach ($childTr as $ts) {
if ($ts->nodeName == 'th') {
array_push($keys, strtolower($ts->nodeValue));
Severity: Major
Found in src/characters/characters.php and 1 other location - About 6 hrs to fix
src/creators/creators.php on lines 80..103

Function getCreator has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

public function getCreator()
{
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($this->html);
Severity: Minor
Found in src/characters/characters.php - About 4 hrs to fix

Function getInfo has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

public function getInfo(){
preg_match_all(parent::PATTERN_CREATOR_INFO, $this->html, $arr);
if (!isset($arr[0][0]) || empty($arr[0][0])){
return 'null';
}else{
Severity: Minor
Found in src/creators/creators.php - About 4 hrs to fix

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 getRelatedAnimes has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    public function getRelatedAnimes(){
    $dom = new DOMDocument();
    libxml_use_internal_errors(true);
    preg_match_all(parent::PATTERN_CHAR_RELATED, $this->html, $arr);
    if (!isset($arr[2][0])){
    Severity: Minor
    Found in src/characters/characters.php - About 4 hrs to fix

    Function getInfo has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    public function getInfo()
    {
    preg_match_all(parent::PATTERN_CHAR_INFO, $this->html, $arr);
    $dom = new DOMDocument();
    libxml_use_internal_errors(true);
    Severity: Minor
    Found in src/characters/characters.php - About 3 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 getAnimes has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    public function getAnimes(){
    $dom = new DOMDocument();
    libxml_use_internal_errors(true);
    $control = '';
    preg_match_all(parent::PATTERN_CREATOR_ANIMES . $this->creator_id . parent::PATTERN_SECOND_CREATOR_ANIMES, $this->html, $arr);
    Severity: Major
    Found in src/creators/creators.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 getCreator has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          public function getCreator()
          {
          $dom = new DOMDocument();
          libxml_use_internal_errors(true);
          $dom->loadHTML($this->html);
          Severity: Major
          Found in src/characters/characters.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 getInfo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              public function getInfo(){
              preg_match_all(parent::PATTERN_CREATOR_INFO, $this->html, $arr);
              if (!isset($arr[0][0]) || empty($arr[0][0])){
              return 'null';
              }else{
              Severity: Minor
              Found in src/creators/creators.php - About 1 hr to fix

                Method getRelatedAnimes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                public function getRelatedAnimes(){
                $dom = new DOMDocument();
                libxml_use_internal_errors(true);
                preg_match_all(parent::PATTERN_CHAR_RELATED, $this->html, $arr);
                if (!isset($arr[2][0])){
                Severity: Minor
                Found in src/characters/characters.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 getInfo has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    public function getInfo()
                    {
                    preg_match_all(parent::PATTERN_CHAR_INFO, $this->html, $arr);
                    $dom = new DOMDocument();
                    libxml_use_internal_errors(true);
                    Severity: Minor
                    Found in src/characters/characters.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language