src/MalScraper/Model/User/UserModel.php
private function getFavList($favorite_area, $type)
    {
        $favorite = [];
        $favorite_area = $favorite_area->find('ul[class="favorites-list '.$type.'"]', 0);
        if ($favorite_area) {
            foreach ($favorite_area->find('li') as $each_fav) {
                $temp_fav = [];

                $temp_fav['image'] = $this->getFavImage($each_fav);
                $temp_fav['id'] = $this->getFavId($each_fav);

                if ($type == 'anime' || $type == 'manga') {
                    $temp_fav['title'] = $this->getFavTitle($each_fav);
                    $temp_fav['type'] = $this->getFavType($each_fav);
                    $temp_fav['year'] = $this->getFavYear($each_fav);
                } else {
                    $temp_fav['name'] = $this->getFavTitle($each_fav);

                    if ($type == 'characters') {
                        $temp_fav['media_id'] = $this->getFavMedia($each_fav, 2);
                        $temp_fav['media_title'] = $this->getFavMediaTitle($each_fav);
                        $temp_fav['media_type'] = $this->getFavMedia($each_fav, 1);
                    }
                }

                $favorite[] = $temp_fav;
            }
        }

        return $favorite;
    }
private function getFavList($favorite_area, $type)
    {
        $favorite = [];
        $favorite_area = $favorite_area->find('ul[class="favorites-list '.$type.'"]', 0);
        if ($favorite_area) {
            foreach ($favorite_area->find('li') as $each_fav) {
                $temp_fav = [];

                $temp_fav['image'] = $this->getFavImage($each_fav);
                $temp_fav['id'] = $this->getFavId($each_fav);

                if ($type == 'anime' || $type == 'manga') {
                    $temp_fav['title'] = $this->getFavTitle($each_fav);
                    $temp_fav['type'] = $this->getFavType($each_fav);
                    $temp_fav['year'] = $this->getFavYear($each_fav);
                } else {
                    $temp_fav['name'] = $this->getFavTitle($each_fav);

                    if ($type == 'characters') {
                        $temp_fav['media_id'] = $this->getFavMedia($each_fav, 2);
                        $temp_fav['media_title'] = $this->getFavMediaTitle($each_fav);
                        $temp_fav['media_type'] = $this->getFavMedia($each_fav, 1);
                    }
                }

                $favorite[] = $temp_fav;
            }
        }

        return $favorite;
    }
private function getFavList ( $ favorite_area , $ type ) { $ favorite = [ ] ; $ favorite_area = $ favorite_area -> find ( 'ul[class="favorites-list ' . $ type . '"]' , 0 ) ; if ( $ favorite_area ) { foreach ( $ favorite_area -> find ( 'li' ) as $ each_fav ) { $ temp_fav = [ ] ; $ temp_fav [ 'image' ] = $ this -> getFavImage ( $ each_fav ) ; $ temp_fav [ 'id' ] = $ this -> getFavId ( $ each_fav ) ; if ( $ type == 'anime' || $ type == 'manga' ) { $ temp_fav [ 'title' ] = $ this -> getFavTitle ( $ each_fav ) ; $ temp_fav [ 'type' ] = $ this -> getFavType ( $ each_fav ) ; $ temp_fav [ 'year' ] = $ this -> getFavYear ( $ each_fav ) ; } else { $ temp_fav [ 'name' ] = $ this -> getFavTitle ( $ each_fav ) ; if ( $ type == 'characters' ) { $ temp_fav [ 'media_id' ] = $ this -> getFavMedia ( $ each_fav , 2 ) ; $ temp_fav [ 'media_title' ] = $ this -> getFavMediaTitle ( $ each_fav ) ; $ temp_fav [ 'media_type' ] = $ this -> getFavMedia ( $ each_fav , 1 ) ; } } $ favorite [ ] = $ temp_fav ; } } return $ favorite ; }
Get favorite list.

@param \simplehtmldom_1_5\simple_html_dom $favorite_area
@param string                             $type

@return array
Get favorite list .