SitemapController::board()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 9
Ratio 90 %

Importance

Changes 0
Metric Value
dl 9
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Http\Controllers;
9
10
use Sitemap;
11
use App\Models\Game;
12
use App\Models\News;
13
use App\Models\User;
14
use App\Models\Developer;
15
use App\Models\BoardThread;
16
17
class SitemapController extends Controller
18
{
19
    public function index()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
20
    {
21
        Sitemap::addSitemap(route('sitemap.users'));
22
        Sitemap::addSitemap(route('sitemap.games'));
23
        Sitemap::addSitemap(route('sitemap.developer'));
24
        Sitemap::addSitemap(route('sitemap.board'));
25
        Sitemap::addSitemap(route('sitemap.news'));
26
27
        return Sitemap::index();
28
    }
29
30 View Code Duplication
    public function users()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $users = User::all();
33
34
        foreach ($users as $user) {
35
            Sitemap::addTag(route('users.show', $user->id), $user->created_at, 'monthly', '0.8');
36
        }
37
38
        return Sitemap::render();
39
    }
40
41
    public function games()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
42
    {
43
        $games = Game::all();
44
45
        foreach ($games as $game) {
46
            $tag = Sitemap::addTag(url('games', $game->id), $game->created_at, 'monthly', '0.8');
47
            $tag->addImage(route('screenshot.show', [$game->id, 1]), 'Titlescreen');
48
        }
49
50
        return Sitemap::render();
51
    }
52
53 View Code Duplication
    public function developer()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        $dev = Developer::all();
56
57
        foreach ($dev as $d) {
58
            Sitemap::addTag(url('developer', $d->id), $d->created_at, 'monthly', '0.8');
59
        }
60
61
        return Sitemap::render();
62
    }
63
64 View Code Duplication
    public function board()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
    {
66
        $threads = BoardThread::all();
67
68
        foreach ($threads as $thread) {
69
            Sitemap::addTag(route('board.thread.show', $thread->id), $thread->last_created_at, 'daily', '0.8');
70
        }
71
72
        return Sitemap::render();
73
    }
74
75
    public function news()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
76
    {
77
        $news = News::all()->where('approved', '=', 1);
78
79
        foreach ($news as $new) {
80
            Sitemap::addTag(url('news', $new->id), $new->created_at, 'monthly', '0.8');
81
        }
82
83
        return Sitemap::render();
84
    }
85
}
86