ipl: phpdoc, cleanup

This commit is contained in:
Thomas Gelf 2018-05-06 09:08:37 +02:00
parent 01c3a553ba
commit 319b000407
4 changed files with 41 additions and 8 deletions

View File

@ -36,6 +36,8 @@ abstract class BaseHtmlElement extends HtmlDocument
/**
* @return Attributes
* @throws \Icinga\Exception\IcingaException
* @throws \Icinga\Exception\ProgrammingError
*/
public function getAttributes()
{
@ -63,10 +65,11 @@ abstract class BaseHtmlElement extends HtmlDocument
}
/**
* @param $key
* @param $value
* @param string $key
* @param mixed $value
* @return $this
* @throws \Icinga\Exception\ProgrammingError
* @throws \Icinga\Exception\IcingaException
*/
public function setAttribute($key, $value)
{
@ -116,6 +119,7 @@ abstract class BaseHtmlElement extends HtmlDocument
/**
* @param array|ValidHtml|string $content
* @return $this
* @throws \Icinga\Exception\IcingaException
*/
public function add($content)
{
@ -124,11 +128,14 @@ abstract class BaseHtmlElement extends HtmlDocument
$this->assemble();
}
return parent::add($content);
parent::add($content);
return $this;
}
/**
* @return string
* @throws \Icinga\Exception\ProgrammingError
*/
public function render()
{
@ -156,6 +163,10 @@ abstract class BaseHtmlElement extends HtmlDocument
}
}
/**
* @return string
* @throws \Icinga\Exception\ProgrammingError
*/
public function renderAttributes()
{
if ($this->attributes === null && empty($this->defaultAttributes)) {

View File

@ -46,6 +46,7 @@ class Table extends BaseHtmlElement
*
* @param $content
* @return $this
* @throws \Icinga\Exception\IcingaException
*/
public function setCaption($content)
{
@ -200,7 +201,7 @@ class Table extends BaseHtmlElement
* @param HtmlElement $tr
* @param $row
* @return HtmlElement
* @throws \Icinga\Exception\ProgrammingError
* @throws \Icinga\Exception\IcingaException
*/
public function addRowClasses(HtmlElement $tr, $row)
{
@ -266,6 +267,7 @@ class Table extends BaseHtmlElement
/**
* @return HtmlElement
* @throws \Icinga\Exception\IcingaException
*/
public function nextBody()
{
@ -279,6 +281,7 @@ class Table extends BaseHtmlElement
/**
* @return HtmlElement
* @throws \Icinga\Exception\IcingaException
*/
public function nextHeader()
{
@ -292,6 +295,7 @@ class Table extends BaseHtmlElement
/**
* @return string
* @throws \Icinga\Exception\IcingaException
*/
public function renderContent()
{

View File

@ -33,7 +33,7 @@ trait ControlsAndContentHelper
public function controls()
{
if ($this->controls === null) {
$this->view->controls = $this->controls = Controls::create();
$this->view->controls = $this->controls = new Controls();
}
return $this->controls;
@ -72,7 +72,7 @@ trait ControlsAndContentHelper
public function content()
{
if ($this->content === null) {
$this->view->content = $this->content = Content::create();
$this->view->content = $this->content = new Content();
}
return $this->content;

View File

@ -33,6 +33,7 @@ class Controls extends BaseHtmlElement
* @param $title
* @param null $subTitle
* @return $this
* @throws \Icinga\Exception\IcingaException
*/
public function addTitle($title, $subTitle = null)
{
@ -44,6 +45,11 @@ class Controls extends BaseHtmlElement
return $this->setTitleElement($this->renderTitleElement());
}
/**
* @param BaseHtmlElement $element
* @return $this
* @throws \Icinga\Exception\IcingaException
*/
public function setTitleElement(BaseHtmlElement $element)
{
if ($this->titleElement !== null) {
@ -86,6 +92,7 @@ class Controls extends BaseHtmlElement
/**
* @param Tabs $tabs
* @return $this
* @throws \Icinga\Exception\ProgrammingError
*/
public function prependTabs(Tabs $tabs)
{
@ -103,7 +110,8 @@ class Controls extends BaseHtmlElement
}
/**
* @return Html
* @return ActionBar
* @throws \Icinga\Exception\IcingaException
*/
public function getActionBar()
{
@ -114,6 +122,11 @@ class Controls extends BaseHtmlElement
return $this->actions;
}
/**
* @param HtmlDocument $actionBar
* @return $this
* @throws \Icinga\Exception\IcingaException
*/
public function setActionBar(HtmlDocument $actionBar)
{
if ($this->actions !== null) {
@ -128,10 +141,11 @@ class Controls extends BaseHtmlElement
/**
* @return BaseHtmlElement
* @throws \Icinga\Exception\IcingaException
*/
protected function renderTitleElement()
{
$h1 = Html::tag('h1')->setContent($this->title);
$h1 = Html::tag('h1', null, $this->title);
if ($this->subTitle) {
$h1->setSeparator(' ')->add(
Html::tag('small', null, $this->subTitle)
@ -141,6 +155,10 @@ class Controls extends BaseHtmlElement
return $h1;
}
/**
* @return string
* @throws \Icinga\Exception\IcingaException
*/
public function renderContent()
{
if (null !== $this->tabs) {