Skip to content

Commit 51fb44a

Browse files
TheSyscalllippserd
authored andcommitted
Docstring formating
1 parent b6053a8 commit 51fb44a

2 files changed

Lines changed: 39 additions & 19 deletions

File tree

library/Icinga/Web/Form/ConfigForm.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function ensureAssembled(): static
6161
* Populate the form elements from the configuration
6262
*
6363
* @return void
64+
*
65+
* @throws ProgrammingError
6466
*/
6567
protected function populateFromConfig(): void
6668
{
@@ -84,7 +86,7 @@ protected function populateFromConfig(): void
8486
}
8587

8688
/**
87-
* Get the section and key from the element name.
89+
* Get the section and key from the element name
8890
*
8991
* @param string $name The element name
9092
*
@@ -122,7 +124,10 @@ public function getConfigValue(string $name, mixed $default = null): mixed
122124
/**
123125
* Persist the current configuration to disk
124126
*
125-
* If an error occurs, the form will be re-rendered with the error message and the raw INI configuration.
127+
* If an error occurs, the form will be re-rendered with the error message
128+
* and the raw INI configuration.
129+
*
130+
* @throws ProgrammingError
126131
*/
127132
protected function save(): void
128133
{
@@ -176,7 +181,7 @@ protected function onSuccess(): void
176181
}
177182

178183
/**
179-
* Add the store button to the form.
184+
* Add the store button to the form
180185
*
181186
* @return void
182187
*/

library/Icinga/Web/Form/ConfigSectionForm.php

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ public function setAllowDeletion(bool $allowDeletion = true): static
144144
}
145145

146146
/**
147-
* Is the form allowed to delete the configuration section.
147+
* Whether the form is allowed to delete the configuration section
148+
*
148149
* Note: Creation forms are never allowed to be deleted.
150+
*
149151
* @return bool
150152
*/
151153
public function allowDeletion(): bool
@@ -157,13 +159,27 @@ public function allowDeletion(): bool
157159
return $this->allowDeletion;
158160
}
159161

162+
/**
163+
* Set the ability to rename the configuration section
164+
*
165+
* @param bool $allowRename Whether the form is allowed to rename the configuration section
166+
*
167+
* @return $this
168+
*/
160169
public function setAllowRename(bool $allowRename = true): static
161170
{
162171
$this->allowRename = $allowRename;
163172

164173
return $this;
165174
}
166175

176+
/**
177+
* Whether the form is allowed to rename the configuration section
178+
*
179+
* Note: Creation forms are never allowed to be rename forms.
180+
*
181+
* @return bool
182+
*/
167183
public function allowRename(): bool
168184
{
169185
if ($this->isCreateForm()) {
@@ -181,6 +197,8 @@ public function allowRename(): bool
181197
* This is done to allow for deletion of sections that contain invalid configuration.
182198
*
183199
* @return void
200+
*
201+
* @throws ProgrammingError
184202
*/
185203
protected function handleDelete(): void
186204
{
@@ -212,6 +230,8 @@ protected function handleDelete(): void
212230
* It renames the underlying section and updates the section name in the form.
213231
*
214232
* @return void
233+
*
234+
* @throws ProgrammingError
215235
*/
216236
protected function handleRename(): void
217237
{
@@ -255,9 +275,11 @@ public function hasDeleteButton(): bool
255275
}
256276

257277
/**
258-
* Add the section name element to the form. This element is used to create
259-
* a new configuration section with the given name. The added element
260-
* automatically validates that the name is unique within the configuration.
278+
* Add the section name element to the form
279+
*
280+
* This element is used to create a new configuration section with the given
281+
* name. The added element automatically validates that the name is unique
282+
* within the configuration.
261283
*
262284
* @param array $params Additional parameters to pass to the element constructor
263285
*
@@ -300,13 +322,6 @@ protected function addSectionNameElement(array $params = []): void
300322
$this->addElement('text', static::NAME_ELEMENT_NAME, $params);
301323
}
302324

303-
/**
304-
* Get the section and key from the element name.
305-
*
306-
* @param string $name The element name
307-
*
308-
* @return string[]|null
309-
*/
310325
protected function getIniKeyFromName(string $name): ?array
311326
{
312327
return [$this->section, $name];
@@ -340,11 +355,6 @@ protected function onSuccess(): void
340355
}
341356
}
342357

343-
/**
344-
* Add the store and optionally the delete buttons to the form.
345-
*
346-
* @return void
347-
*/
348358
protected function addButtonElements(): void
349359
{
350360
parent::addButtonElements();
@@ -367,6 +377,11 @@ protected function addButtonElements(): void
367377
->prepend($deleteButton);
368378
}
369379

380+
/**
381+
* Check if the form should rename the section for this request
382+
*
383+
* @return bool
384+
*/
370385
private function shouldRename(): bool
371386
{
372387
if (! $this->allowRename() || ! $this->hasBeenSubmitted() || ! $this->isValid()) {

0 commit comments

Comments
 (0)