Skip to content

Commit df83c9a

Browse files
committed
ipl: no more Html::__callStatic, add phpdocs
1 parent cbd0d03 commit df83c9a

17 files changed

+493
-80
lines changed

application/controllers/ConfigController.php

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ protected function checkDirectorPermissions()
3737
{
3838
}
3939

40+
/**
41+
* @throws IcingaException
42+
* @throws \Icinga\Exception\ConfigurationError
43+
* @throws \Icinga\Exception\Http\HttpNotFoundException
44+
* @throws \Icinga\Exception\ProgrammingError
45+
*/
4046
public function deploymentsAction()
4147
{
4248
if ($this->sendNotFoundForRestApi()) {
@@ -77,6 +83,11 @@ public function deploymentsAction()
7783
$table->renderTo($this);
7884
}
7985

86+
/**
87+
* @throws IcingaException
88+
* @throws NotFoundError
89+
* @throws \Icinga\Exception\ConfigurationError
90+
*/
8091
public function deployAction()
8192
{
8293
$request = $this->getRequest();
@@ -114,6 +125,12 @@ public function deployAction()
114125
}
115126
}
116127

128+
/**
129+
* @throws IcingaException
130+
* @throws \Icinga\Exception\ConfigurationError
131+
* @throws \Icinga\Exception\Http\HttpNotFoundException
132+
* @throws \Icinga\Exception\ProgrammingError
133+
*/
117134
public function activitiesAction()
118135
{
119136
if ($this->sendNotFoundForRestApi()) {
@@ -161,6 +178,12 @@ public function activitiesAction()
161178
$table->renderTo($this);
162179
}
163180

181+
/**
182+
* @throws IcingaException
183+
* @throws \Icinga\Exception\ConfigurationError
184+
* @throws \Icinga\Exception\Http\HttpNotFoundException
185+
* @throws \Icinga\Exception\ProgrammingError
186+
*/
164187
public function activityAction()
165188
{
166189
if ($this->sendNotFoundForRestApi()) {
@@ -185,6 +208,10 @@ public function activityAction()
185208
$this->content()->add($info);
186209
}
187210

211+
/**
212+
* @throws IcingaException
213+
* @throws \Icinga\Exception\ConfigurationError
214+
*/
188215
public function settingsAction()
189216
{
190217
if ($this->sendNotFoundForRestApi()) {
@@ -203,6 +230,12 @@ public function settingsAction()
203230

204231
/**
205232
* Show all files for a given config
233+
*
234+
* @throws IcingaException
235+
* @throws \Icinga\Exception\ConfigurationError
236+
* @throws \Icinga\Exception\Http\HttpNotFoundException
237+
* @throws \Icinga\Exception\MissingParameterException
238+
* @throws \Icinga\Exception\ProgrammingError
206239
*/
207240
public function filesAction()
208241
{
@@ -246,6 +279,12 @@ public function filesAction()
246279

247280
/**
248281
* Show a single file
282+
*
283+
* @throws IcingaException
284+
* @throws \Icinga\Exception\ConfigurationError
285+
* @throws \Icinga\Exception\Http\HttpNotFoundException
286+
* @throws \Icinga\Exception\MissingParameterException
287+
* @throws \Icinga\Exception\ProgrammingError
249288
*/
250289
public function fileAction()
251290
{
@@ -276,7 +315,12 @@ public function fileAction()
276315
));
277316
}
278317

279-
// TODO: Check if this can be removed
318+
/**
319+
* TODO: Check if this can be removed
320+
*
321+
* @throws \Icinga\Exception\ConfigurationError
322+
* @throws \Icinga\Exception\ProgrammingError
323+
*/
280324
public function storeAction()
281325
{
282326
$this->assertPermission('director/deploy');
@@ -289,6 +333,11 @@ public function storeAction()
289333
);
290334
}
291335

336+
/**
337+
* @throws IcingaException
338+
* @throws \Icinga\Exception\ConfigurationError
339+
* @throws \Icinga\Exception\ProgrammingError
340+
*/
292341
public function diffAction()
293342
{
294343
if ($this->sendNotFoundForRestApi()) {
@@ -310,7 +359,7 @@ public function diffAction()
310359
}
311360
}
312361

313-
$this->content()->add(Html::form(['action' => $this->url(), 'method' => 'GET'], [
362+
$this->content()->add(Html::tag('form', ['action' => $this->url(), 'method' => 'GET'], [
314363
new HtmlString($this->view->formSelect(
315364
'left',
316365
$leftSum,
@@ -336,6 +385,11 @@ public function diffAction()
336385
ConfigFileDiffTable::load($leftSum, $rightSum, $this->db())->renderTo($this);
337386
}
338387

388+
/**
389+
* @throws IcingaException
390+
* @throws \Icinga\Exception\ConfigurationError
391+
* @throws \Icinga\Exception\MissingParameterException
392+
*/
339393
public function filediffAction()
340394
{
341395
if ($this->sendNotFoundForRestApi()) {
@@ -361,6 +415,10 @@ public function filediffAction()
361415
));
362416
}
363417

418+
/**
419+
* @param $checksum
420+
* @throws \Icinga\Exception\ProgrammingError
421+
*/
364422
protected function deploymentSucceeded($checksum)
365423
{
366424
if ($this->getRequest()->isApiRequest()) {
@@ -375,6 +433,11 @@ protected function deploymentSucceeded($checksum)
375433
}
376434
}
377435

436+
/**
437+
* @param $checksum
438+
* @param null $error
439+
* @throws \Icinga\Exception\ProgrammingError
440+
*/
378441
protected function deploymentFailed($checksum, $error = null)
379442
{
380443
$extra = $error ? ': ' . $error: '';
@@ -391,6 +454,10 @@ protected function deploymentFailed($checksum, $error = null)
391454
}
392455
}
393456

457+
/**
458+
* @return \dipl\Web\Widget\Tabs
459+
* @throws \Icinga\Exception\ProgrammingError
460+
*/
394461
protected function configTabs()
395462
{
396463
$tabs = $this->tabs();

application/controllers/InspectController.php

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ protected function checkDirectorPermissions()
2323
$this->assertPermission('director/inspect');
2424
}
2525

26+
/**
27+
* @throws \Icinga\Exception\Http\HttpNotFoundException
28+
* @throws \Icinga\Exception\IcingaException
29+
* @throws \Icinga\Exception\ProgrammingError
30+
*/
2631
public function typesAction()
2732
{
2833
$object = $this->endpoint();
@@ -49,6 +54,10 @@ public function typesAction()
4954
);
5055
}
5156

57+
/**
58+
* @throws \Icinga\Exception\IcingaException
59+
* @throws \Icinga\Exception\ProgrammingError
60+
*/
5261
public function typeAction()
5362
{
5463
$api = $this->endpoint()->api();
@@ -66,25 +75,30 @@ public function typeAction()
6675

6776
if (! $type->abstract) {
6877
$objects = $api->listObjects($typeName, $type->plural_name);
69-
$c->add(Html::p(sprintf($this->translate('%d objects found'), count($objects))));
78+
$c->add(Html::tag('p', null, sprintf($this->translate('%d objects found'), count($objects))));
7079
$c->add(new CoreApiObjectsTable($objects, $this->endpoint(), $type));
7180
}
7281

7382
if (count((array) $type->fields)) {
7483
$c->add([
75-
Html::h2($this->translate('Type attributes')),
84+
Html::tag('h2', null, $this->translate('Type attributes')),
7685
new CoreApiFieldsTable($type->fields, $this->url())
7786
]);
7887
}
7988

8089
if (count($type->prototype_keys)) {
8190
$c->add([
82-
Html::h2($this->translate('Prototypes (methods)')),
91+
Html::tag('h2', null, $this->translate('Prototypes (methods)')),
8392
new CoreApiPrototypesTable($type->prototype_keys, $type->name)
8493
]);
8594
}
8695
}
8796

97+
/**
98+
* @throws \Icinga\Exception\ConfigurationError
99+
* @throws \Icinga\Exception\IcingaException
100+
* @throws \Icinga\Exception\ProgrammingError
101+
*/
88102
public function objectAction()
89103
{
90104
$name = $this->params->get('name');
@@ -100,6 +114,10 @@ public function objectAction()
100114
);
101115
}
102116

117+
/**
118+
* @param IcingaEndpoint $endpoint
119+
* @throws \Icinga\Exception\IcingaException
120+
*/
103121
protected function showEndpointInformation(IcingaEndpoint $endpoint)
104122
{
105123
$this->content()->add(
@@ -111,22 +129,40 @@ protected function showEndpointInformation(IcingaEndpoint $endpoint)
111129
);
112130
}
113131

132+
/**
133+
* @param IcingaEndpoint $endpoint
134+
* @return Link
135+
* @throws \Icinga\Exception\ProgrammingError
136+
* @throws \Icinga\Exception\IcingaException
137+
*/
114138
protected function linkToEndpoint(IcingaEndpoint $endpoint)
115139
{
116140
return Link::create($endpoint->getObjectName(), 'director/endpoint', [
117141
'name' => $endpoint->getObjectName()
118142
]);
119143
}
120144

145+
/**
146+
* @throws \Icinga\Exception\IcingaException
147+
* @throws \Icinga\Exception\ProgrammingError
148+
*/
121149
public function statusAction()
122150
{
123151
$this->addSingleTab($this->translate('Status'));
124152
$this->addTitle($this->translate('Icinga 2 API - Status'));
125-
$this->content()->add(
126-
Html::pre(PlainObjectRenderer::render($this->endpoint()->api()->getStatus()))
127-
);
153+
$this->content()->add(Html::tag(
154+
'pre',
155+
null,
156+
PlainObjectRenderer::render($this->endpoint()->api()->getStatus())
157+
));
128158
}
129159

160+
/**
161+
* @return IcingaEndpoint
162+
* @throws \Icinga\Exception\ConfigurationError
163+
* @throws \Icinga\Exception\IcingaException
164+
* @throws \Icinga\Exception\NotFoundError
165+
*/
130166
protected function endpoint()
131167
{
132168
if ($this->endpoint === null) {

application/controllers/SchemaController.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,26 @@ public function init()
1818
];
1919
}
2020

21+
/**
22+
* @throws \Icinga\Exception\IcingaException
23+
*/
2124
public function mysqlAction()
2225
{
2326
$this->serveSchema('mysql');
2427
}
2528

29+
/**
30+
* @throws \Icinga\Exception\IcingaException
31+
*/
2632
public function pgsqlAction()
2733
{
2834
$this->serveSchema('pgsql');
2935
}
3036

37+
/**
38+
* @param $type
39+
* @throws \Icinga\Exception\IcingaException
40+
*/
3141
protected function serveSchema($type)
3242
{
3343
$schema = $this->loadSchema($type);
@@ -44,7 +54,7 @@ protected function serveSchema($type)
4454
->addSchemaTabs($type)
4555
->addTitle($this->schemas[$type])
4656
->addDownloadAction()
47-
->content()->add(Html::pre($schema));
57+
->content()->add(Html::tag('pre', null, $schema));
4858
}
4959

5060
protected function loadSchema($type)
@@ -58,6 +68,11 @@ protected function loadSchema($type)
5868
);
5969
}
6070

71+
/**
72+
* @return $this
73+
* @throws \Icinga\Exception\IcingaException
74+
* @throws \Icinga\Exception\ProgrammingError
75+
*/
6176
protected function addDownloadAction()
6277
{
6378
$this->actions()->add(
@@ -75,6 +90,12 @@ protected function addDownloadAction()
7590
return $this;
7691
}
7792

93+
/**
94+
* @param $active
95+
* @return $this
96+
* @throws \Icinga\Exception\Http\HttpNotFoundException
97+
* @throws \Icinga\Exception\ProgrammingError
98+
*/
7899
protected function addSchemaTabs($active)
79100
{
80101
$tabs = $this->tabs();

0 commit comments

Comments
 (0)