Skip to content

Commit

Permalink
(Host|Service)Controller: Add return type to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Dec 18, 2024
1 parent 2762f6f commit 415ea24
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
16 changes: 8 additions & 8 deletions application/controllers/HostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class HostController extends Controller
/** @var Host The host object */
protected $host;

public function init()
public function init(): void
{
$name = $this->params->shiftRequired('name');

Expand Down Expand Up @@ -76,7 +76,7 @@ public function init()
$this->setTitle($host->display_name);
}

public function indexAction()
public function indexAction(): void
{
$serviceSummary = ServicestateSummary::on($this->getDb());
$serviceSummary->filter(Filter::equal('service.host_id', $this->host->id));
Expand All @@ -95,7 +95,7 @@ public function indexAction()
$this->setAutorefreshInterval(10);
}

public function sourceAction()
public function sourceAction(): void
{
$this->assertPermission('icingadb/object/show-source');

Expand All @@ -114,7 +114,7 @@ public function sourceAction()
));
}

public function historyAction()
public function historyAction(): \Generator
{
$compact = $this->view->compact; // TODO: Find a less-legacy way..

Expand Down Expand Up @@ -185,7 +185,7 @@ public function historyAction()
}
}

public function servicesAction()
public function servicesAction(): \Generator
{
if ($this->host->state->is_overdue) {
$this->controls->addAttributes(['class' => 'overdue']);
Expand Down Expand Up @@ -234,7 +234,7 @@ public function servicesAction()
$this->setAutorefreshInterval(10);
}

public function parentsAction()
public function parentsAction(): void
{
$nodesQuery = $this->fetchNodes(true);

Expand Down Expand Up @@ -293,7 +293,7 @@ public function parentsAction()
$this->setAutorefreshInterval(10);
}

public function childrenAction()
public function childrenAction(): void
{
$nodesQuery = $this->fetchNodes();

Expand Down Expand Up @@ -473,7 +473,7 @@ protected function createTabs(): Tabs
return $tabs;
}

protected function setTitleTab(string $name)
protected function setTitleTab(string $name): void
{
$tab = $this->createTabs()->get($name);

Expand Down
17 changes: 9 additions & 8 deletions application/controllers/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use ipl\Web\Control\LimitControl;
use ipl\Web\Control\SortControl;
use ipl\Web\Url;
use ipl\Web\Widget\Tabs;

class ServiceController extends Controller
{
Expand All @@ -40,7 +41,7 @@ class ServiceController extends Controller
/** @var Service The service object */
protected $service;

public function init()
public function init(): void
{
$name = $this->params->shiftRequired('name');
$hostName = $this->params->shiftRequired('host.name');
Expand Down Expand Up @@ -85,7 +86,7 @@ public function init()
);
}

public function indexAction()
public function indexAction(): void
{
if ($this->service->state->is_overdue) {
$this->controls->addAttributes(['class' => 'overdue']);
Expand All @@ -99,7 +100,7 @@ public function indexAction()
$this->setAutorefreshInterval(10);
}

public function parentsAction()
public function parentsAction(): void
{
$nodesQuery = $this->fetchNodes(true);

Expand Down Expand Up @@ -159,7 +160,7 @@ public function parentsAction()
$this->setAutorefreshInterval(10);
}

public function childrenAction()
public function childrenAction(): void
{
$nodesQuery = $this->fetchNodes();

Expand Down Expand Up @@ -222,7 +223,7 @@ public function childrenAction()
$this->setAutorefreshInterval(10);
}

public function sourceAction()
public function sourceAction(): void
{
$this->assertPermission('icingadb/object/show-source');

Expand All @@ -241,7 +242,7 @@ public function sourceAction()
));
}

public function historyAction()
public function historyAction(): \Generator
{
$compact = $this->view->compact; // TODO: Find a less-legacy way..

Expand Down Expand Up @@ -392,7 +393,7 @@ protected function fetchNodes(bool $fetchParents = false): Query
return $query;
}

protected function createTabs()
protected function createTabs(): Tabs
{
$hasDependecyNode = DependencyNode::on($this->getDb())
->columns('1')
Expand Down Expand Up @@ -445,7 +446,7 @@ protected function createTabs()
return $tabs;
}

protected function setTitleTab(string $name)
protected function setTitleTab(string $name): void
{
$tab = $this->createTabs()->get($name);

Expand Down

0 comments on commit 415ea24

Please sign in to comment.