| Conditions | 30 | 
| Paths | > 20000 | 
| Total Lines | 114 | 
| Code Lines | 73 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 19 | * @throws \Throwable  | 
            ||
| 20 | */  | 
            ||
| 21 | public function MyMoviesRss(Request $request)  | 
            ||
| 22 |     { | 
            ||
| 23 | $this->setPrefs();  | 
            ||
| 24 | $rss = new RSS(['Settings' => $this->settings]);  | 
            ||
| 25 | $offset = 0;  | 
            ||
| 26 | |||
| 27 | $user = $this->userCheck($request->all());  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 28 | |||
| 29 |         $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); | 
            ||
| 30 | |||
| 31 |         $userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0); | 
            ||
| 32 | |||
| 33 | $relData = $rss->getMyMoviesRss($userNum, $user['user_id'], User::getCategoryExclusionById($user['user_id']));  | 
            ||
| 34 | |||
| 35 | $rss->output($relData, $user['params'], $outputXML, $offset, 'rss');  | 
            ||
| 36 | }  | 
            ||
| 37 | |||
| 38 | /**  | 
            ||
| 39 | * @param \Illuminate\Http\Request $request  | 
            ||
| 40 | * @throws \Exception  | 
            ||
| 41 | * @throws \Throwable  | 
            ||
| 42 | */  | 
            ||
| 43 | public function MyShowsRss(Request $request)  | 
            ||
| 44 |     { | 
            ||
| 45 | $this->setPrefs();  | 
            ||
| 46 | $rss = new RSS(['Settings' => $this->settings]);  | 
            ||
| 47 | $offset = 0;  | 
            ||
| 48 | $user = $this->userCheck($request->all());  | 
            ||
| 49 |         $userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1; | 
            ||
| 50 |         $userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0); | 
            ||
| 51 | $relData = $rss->getShowsRss($userNum, $user['user_id'], User::getCategoryExclusionById($user['user_id']), $userAirDate);  | 
            ||
| 52 |         $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); | 
            ||
| 53 | |||
| 54 | $rss->output($relData, $user['params'], $outputXML, $offset, 'rss');  | 
            ||
| 55 | }  | 
            ||
| 56 | |||
| 57 | /**  | 
            ||
| 58 | * @param \Illuminate\Http\Request $request  | 
            ||
| 59 | * @throws \Exception  | 
            ||
| 60 | * @throws \Throwable  | 
            ||
| 61 | */  | 
            ||
| 62 | public function fullFeedRss(Request $request)  | 
            ||
| 63 |     { | 
            ||
| 64 | $this->setPrefs();  | 
            ||
| 65 | $rss = new RSS(['Settings' => $this->settings]);  | 
            ||
| 66 | $offset = 0;  | 
            ||
| 67 | $user = $this->userCheck($request->all());  | 
            ||
| 68 |         $userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1; | 
            ||
| 69 |         $userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0); | 
            ||
| 70 |         $userLimit = $request->has('limit') && is_numeric($request->input('limit')) ? $request->input('limit') : 100; | 
            ||
| 71 | $userShow = $userAnidb = -1;  | 
            ||
| 72 |         if ($request->has('show')) { | 
            ||
| 73 |             $userShow = ((int) $request->input('show') === 0 ? -1 : $request->input('show') + 0); | 
            ||
| 74 |         } elseif ($request->has('anidb')) { | 
            ||
| 75 |             $userAnidb = ((int) $request->input('anidb') === 0 ? -1 : $request->input('anidb') + 0); | 
            ||
| 76 | }  | 
            ||
| 77 |         $outputXML = (! ($request->has('o') && $request->input('o') === 'json')); | 
            ||
| 78 | $relData = $rss->getRss([0], $userShow, $userAnidb, $user['user_id'], $userAirDate, $userLimit, $userNum);  | 
            ||
| 79 | $rss->output($relData, $user['params'], $outputXML, $offset, 'rss');  | 
            ||
| 80 | }  | 
            ||
| 81 | |||
| 82 | /**  | 
            ||
| 83 | * @throws \Exception  | 
            ||
| 84 | */  | 
            ||
| 85 | public function showRssDesc()  | 
            ||
| 86 |     { | 
            ||
| 87 | $this->setPrefs();  | 
            ||
| 88 | $rss = new RSS(['Settings' => $this->settings]);  | 
            ||
| 89 | |||
| 90 | $title = 'Rss Info';  | 
            ||
| 91 | $meta_title = 'Rss Nzb Info';  | 
            ||
| 92 | $meta_keywords = 'view,nzb,description,details,rss,atom';  | 
            ||
| 93 | $meta_description = 'View information about NNTmux RSS Feeds.';  | 
            ||
| 94 | |||
| 95 |         $firstShow = $rss->getFirstInstance('videos_id', 'releases', 'id'); | 
            ||
| 96 |         $firstAni = $rss->getFirstInstance('anidbid', 'releases', 'id'); | 
            ||
| 97 | |||
| 98 |         if ($firstShow !== null) { | 
            ||
| 99 |             $this->smarty->assign('show', $firstShow->videos_id); | 
            ||
| 100 |         } else { | 
            ||
| 101 |             $this->smarty->assign('show', 1); | 
            ||
| 102 | }  | 
            ||
| 103 | |||
| 104 |         if ($firstAni !== null) { | 
            ||
| 105 |             $this->smarty->assign('anidb', $firstAni->anidbid); | 
            ||
| 106 |         } else { | 
            ||
| 107 |             $this->smarty->assign('anidb', 1); | 
            ||
| 108 | }  | 
            ||
| 109 | |||
| 110 | $this->smarty->assign(  | 
            ||
| 111 | [  | 
            ||
| 112 | 'categorylist' => Category::getCategories(true, $this->userdata['categoryexclusions']),  | 
            ||
| 113 | 'parentcategorylist' => Category::getForMenu($this->userdata['categoryexclusions']),  | 
            ||
| 114 | ]  | 
            ||
| 115 | );  | 
            ||
| 116 | |||
| 117 |         $content = $this->smarty->fetch('rssdesc.tpl'); | 
            ||
| 118 | $this->smarty->assign(  | 
            ||
| 119 | [  | 
            ||
| 120 | 'content' => $content,  | 
            ||
| 121 | 'title' => $title,  | 
            ||
| 122 | 'meta_title' => $meta_title,  | 
            ||
| 123 | 'meta_keywords' => $meta_keywords,  | 
            ||
| 124 | 'meta_description' => $meta_description,  | 
            ||
| 125 | ]  | 
            ||
| 126 | );  | 
            ||
| 127 | $this->pagerender();  | 
            ||
| 128 | }  | 
            ||
| 129 | |||
| 130 | public function cartRss(Request $request)  | 
            ||
| 131 |     { | 
            ||
| 132 | $this->setPrefs();  | 
            ||
| 133 | $rss = new RSS(['Settings' => $this->settings]);  | 
            ||
| 231 |