added some doc comments

master
Ondřej Hruška 6 years ago
parent 796b2f23d6
commit 7969e9bbf4
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 14
      app/Http/Controllers/SitemapController.php

@ -8,8 +8,14 @@ use App\Models\Table;
use App\Models\User; use App\Models\User;
use XMLWriter; use XMLWriter;
/**
* This controller is responsible for producing a XML sitemap
*/
class SitemapController extends Controller class SitemapController extends Controller
{ {
/**
* Render a sitemap to the browser
*/
public function sitemap() public function sitemap()
{ {
ob_end_clean(); ob_end_clean();
@ -57,6 +63,12 @@ class SitemapController extends Controller
$xmlWriter->endDocument(); $xmlWriter->endDocument();
} }
/**
* Go through all tables and other links and return objects
* that can be turned into sitemap entries.
*
* @return \Generator|object[]
*/
private function iterateTables() private function iterateTables()
{ {
$prio_info = .9; $prio_info = .9;
@ -100,6 +112,7 @@ class SitemapController extends Controller
'priority' => $prio_misc, 'priority' => $prio_misc,
]; ];
// User profiles
foreach (User::all() as $user) { foreach (User::all() as $user) {
yield (object)[ yield (object)[
'url' => route('profile.view', $user->name), 'url' => route('profile.view', $user->name),
@ -108,6 +121,7 @@ class SitemapController extends Controller
]; ];
} }
// Tables
foreach (Table::all() as $table) { foreach (Table::all() as $table) {
yield (object)[ yield (object)[
'url' => $table->viewRoute, 'url' => $table->viewRoute,

Loading…
Cancel
Save