CS: Fix docstrings in Icinga/Web/Widget/* and Icinga/Web/Controller/ActionController.php

refs #4512
This commit is contained in:
Eric Lippmann 2013-08-16 15:05:03 +02:00
parent aff2398c81
commit 7dc2f78b63
6 changed files with 115 additions and 110 deletions

View File

@ -25,6 +25,7 @@
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
*/ */
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Web\Controller; namespace Icinga\Web\Controller;
use \Icinga\Authentication\Manager as AuthManager; use \Icinga\Authentication\Manager as AuthManager;
@ -50,38 +51,37 @@ use \Zend_Controller_Action_HelperBroker as ZfActionHelper;
*/ */
class ActionController extends ZfController class ActionController extends ZfController
{ {
/** /**
* True to mark this layout to not render the full layout * True to mark this layout to not render the full layout
* *
* @var bool * @var bool
*/ */
protected $replaceLayout = false; protected $replaceLayout = false;
/** /**
* If true, this controller will be shown even when no authentication is available * If true, this controller will be shown even when no authentication is available
* Needed mainly for the authentication controller * Needed mainly for the authentication controller
* *
* @var bool * @var bool
*/ */
protected $handlesAuthentication = false; protected $handlesAuthentication = false;
/** /**
* Set true when this controller modifies the session. * Set true when this controller modifies the session
* *
* otherwise the session will be written back to disk and closed before the controller * otherwise the session will be written back to disk and closed before the controller
* action is executed, leading to every modification in the session to be lost after * action is executed, leading to every modification in the session to be lost after
* the response is submitted * the response is submitted
* *
* @var bool * @var bool
*/ */
protected $modifiesSession = false; protected $modifiesSession = false;
/** /**
* True if authentication suceeded, otherwise false * True if authentication suceeded, otherwise false
* *
* @var bool * @var bool
**/ */
protected $allowAccess = false; protected $allowAccess = false;
@ -107,15 +107,13 @@ class ActionController extends ZfController
*/ */
protected $action_name; protected $action_name;
/** /**
* The constructor starts benchmarking, loads the configuration and sets * The constructor starts benchmarking, loads the configuration and sets
* other useful controller properties * other useful controller properties
* *
* @param ZfRequest $request * @param ZfRequest $request
* @param ZfResponse $response * @param ZfResponse $response
* @param array $invokeArgs Any additional invocation arguments * @param array $invokeArgs Any additional invocation arguments
*/ */
public function __construct( public function __construct(
ZfRequest $request, ZfRequest $request,
@ -148,10 +146,10 @@ class ActionController extends ZfController
} }
/** /**
* Return the @see \Icinga\Widget\Web\Tabs of this view * Return the tabs
* *
* @return Tabs * @return \Icinga\Widget\Web\Tabs
**/ */
public function getTabs() public function getTabs()
{ {
return $this->view->tabs; return $this->view->tabs;

View File

@ -39,18 +39,22 @@ use \Icinga\Web\Url;
class BasketAction implements Tabextension class BasketAction implements Tabextension
{ {
/** /**
* @see Tabextension::apply() * Applies the dashboard actions to the provided tabset
*
* @param Tabs $tabs The tabs object to extend with
*
* @see \Icinga\Web\Widget\Tabextension::apply()
*/ */
public function apply(Tabs $tabs) public function apply(Tabs $tabs)
{ {
$tabs->addAsDropdown( $tabs->addAsDropdown(
'basket', 'basket',
array( array(
'title' => 'URL Basket', 'title' => 'URL Basket',
'icon' => 'img/classic/basket.png', 'icon' => 'img/classic/basket.png',
'url' => Url::fromPath('basket/add'), 'url' => Url::fromPath('basket/add'),
'urlParams' => array( 'urlParams' => array(
'url' => Url::fromRequest()->getRelativeUrl() 'url' => Url::fromRequest()->getRelativeUrl()
) )
) )
); );

View File

@ -43,19 +43,20 @@ class DashboardAction implements Tabextension
/** /**
* Applies the dashboard actions to the provided tabset * Applies the dashboard actions to the provided tabset
* *
* @param Tabs The tabs object to extend with * @param Tabs $tabs The tabs object to extend with
* @see Tabextension::apply() *
* @see \Icinga\Web\Widget\Tabextension::apply()
*/ */
public function apply(Tabs $tabs) public function apply(Tabs $tabs)
{ {
$tabs->addAsDropdown( $tabs->addAsDropdown(
'dashboard', 'dashboard',
array( array(
'title' => 'Add to Dashboard', 'title' => 'Add to Dashboard',
'iconCls' => 'dashboard', 'iconCls' => 'dashboard',
'url' => Url::fromPath('dashboard/addurl'), 'url' => Url::fromPath('dashboard/addurl'),
'urlParams' => array( 'urlParams' => array(
'url' => Url::fromRequest()->getRelativeUrl() 'url' => Url::fromRequest()->getRelativeUrl()
) )
) )
); );

View File

@ -28,15 +28,13 @@
namespace Icinga\Web\Widget\Tabextension; namespace Icinga\Web\Widget\Tabextension;
use Icinga\Application\Logger; use \Icinga\Application\Logger;
use Icinga\Web\Widget\Tab; use \Icinga\Web\Widget\Tab;
use Icinga\Web\Widget\Tabs; use \Icinga\Web\Widget\Tabs;
use Icinga\Web\Url; use \Icinga\Web\Url;
/** /**
* Tabextension that offers different output formats for the user in the dropdown area * Tabextension that offers different output formats for the user in the dropdown area
*
*
*/ */
class OutputFormat implements Tabextension class OutputFormat implements Tabextension
{ {
@ -97,7 +95,7 @@ class OutputFormat implements Tabextension
* In general, it's assumed that all types are supported when an outputFormat extension * In general, it's assumed that all types are supported when an outputFormat extension
* is added, so this class offers to remove specific types instead of adding ones * is added, so this class offers to remove specific types instead of adding ones
* *
* @param array $disabled An array of output types to <b>not</b> show. * @param array $disabled An array of output types to <b>not</b> show.
* *
*/ */
public function __construct(array $disabled = array()) public function __construct(array $disabled = array())
@ -119,9 +117,9 @@ class OutputFormat implements Tabextension
/** /**
* Applies the format selectio to the provided tabset * Applies the format selectio to the provided tabset
* *
* @param Tabs The tabs object to extend with * @param Tabs $tabs The tabs object to extend with
* *
* @see Tabextension::apply() * @see Tabextension::apply()
*/ */
public function apply(Tabs $tabs) public function apply(Tabs $tabs)
{ {

View File

@ -31,19 +31,20 @@ namespace Icinga\Web\Widget\Tabextension;
use \Icinga\Web\Widget\Tabs; use \Icinga\Web\Widget\Tabs;
/** /**
* Tabextension interface that allows to extend a tabbar with reusable components. * Tabextension interface that allows to extend a tabbar with reusable components
* *
* Tabs can be either extended by creating a tabextension and calling the apply method * Tabs can be either extended by creating a `Tabextension` and calling the `apply()` method
* or by calling the tabs @see \Icinga\Web\Widget\Tabs::extend() method and providing * or by calling the `\Icinga\Web\Widget\Tabs` `extend()` method and providing
* a tab extension. * a tab extension
* *
**/ * @see \Icinga\Web\Widget\Tabs::extend()
*/
interface Tabextension interface Tabextension
{ {
/** /**
* Apply this tabextension to the provided tabs * Apply this tabextension to the provided tabs
* *
* @param Tabs $tabs The tabbar to modify * @param Tabs $tabs The tabbar to modify
**/ */
public function apply(Tabs $tabs); public function apply(Tabs $tabs);
} }

View File

@ -31,12 +31,10 @@ namespace Icinga\Web\Widget;
use \Icinga\Exception\ProgrammingError; use \Icinga\Exception\ProgrammingError;
use \Icinga\Web\Widget\Tabextension\Tabextension; use \Icinga\Web\Widget\Tabextension\Tabextension;
use \Zend_View_Abstract; use \Zend_View_Abstract;
use \Countable; use \Countable;
/** /**
* Navigation tab widget * Navigation tab widget
*
*/ */
class Tabs implements Countable, Widget class Tabs implements Countable, Widget
{ {
@ -45,11 +43,11 @@ class Tabs implements Countable, Widget
* *
* @var string * @var string
*/ */
private $baseTpl =<<<'EOT' private $baseTpl = <<< 'EOT'
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
{TABS} {TABS}
{DROPDOWN} {DROPDOWN}
</ul> </ul>
EOT; EOT;
/** /**
@ -57,13 +55,15 @@ EOT;
* *
* @var string * @var string
*/ */
private $dropdownTpl =<<<'EOT' private $dropdownTpl = <<< 'EOT'
<li class="dropdown pull-right "> <li class="dropdown pull-right ">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list-ul"> </i></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu"> <i class="icon-list-ul"></i>
{TABS} </a>
</ul> <ul class="dropdown-menu">
</li> {TABS}
</ul>
</li>
EOT; EOT;
@ -93,11 +93,12 @@ EOT;
* *
* If another tab is currently active it will be deactivated * If another tab is currently active it will be deactivated
* *
* @param string $name Name of the tab going to be activated * @param string $name Name of the tab going to be activated
* *
* @throws ProgrammingError if given tab name doesn't exist * @return self
*
* @throws ProgrammingError When the given tab name doesn't exist
* *
* @return self
*/ */
public function activate($name) public function activate($name)
{ {
@ -124,9 +125,9 @@ EOT;
/** /**
* Set the CSS class name(s) for the &lt;ul&gt; element * Set the CSS class name(s) for the &lt;ul&gt; element
* *
* @param string $name CSS class name(s) * @param string $name CSS class name(s)
* *
* @return self * @return self
*/ */
public function setClass($name) public function setClass($name)
{ {
@ -137,9 +138,9 @@ EOT;
/** /**
* Whether the given tab name exists * Whether the given tab name exists
* *
* @param string $name Tab name * @param string $name Tab name
* *
* @return bool * @return bool
*/ */
public function has($name) public function has($name)
{ {
@ -149,11 +150,11 @@ EOT;
/** /**
* Whether the given tab name exists * Whether the given tab name exists
* *
* @param string $name The tab you're interested in * @param string $name The tab you're interested in
* *
* @throws ProgrammingError if given tab name doesn't exist * @return Tab
* *
* @return Tab * @throws ProgrammingError When the given tab name doesn't exist
*/ */
public function get($name) public function get($name)
{ {
@ -169,12 +170,12 @@ EOT;
* A unique tab name is required, the Tab itself can either be an array * A unique tab name is required, the Tab itself can either be an array
* with tab properties or an instance of an existing Tab * with tab properties or an instance of an existing Tab
* *
* @param string $name The new tab name * @param string $name The new tab name
* @param array|Tab The tab itself of it's properties * @param array|Tab $tab The tab itself of it's properties
* *
* @throws ProgrammingError if tab name already exists * @return self
* *
* @return self * @throws ProgrammingError When the tab name already exists
*/ */
public function add($name, $tab) public function add($name, $tab)
{ {
@ -196,10 +197,10 @@ EOT;
* exists. The tab can either be an array with tab properties or an instance * exists. The tab can either be an array with tab properties or an instance
* of an existing Tab * of an existing Tab
* *
* @param string $name The new tab name * @param string $name The new tab name
* @param array|Tab The tab itself of it's properties * @param array|Tab $tab The tab itself of it's properties
* *
* @return self * @return self
*/ */
public function set($name, $tab) public function set($name, $tab)
{ {
@ -227,9 +228,9 @@ EOT;
/** /**
* Render the dropdown area with it's tabs and return the resulting HTML * Render the dropdown area with it's tabs and return the resulting HTML
* *
* @param Zend_View_Abstract $view The view used for rendering * @param Zend_View_Abstract $view The view used for rendering
* *
* @return mixed|string * @return mixed|string
*/ */
private function renderDropdownTabs(Zend_View_Abstract $view) private function renderDropdownTabs(Zend_View_Abstract $view)
{ {
@ -244,15 +245,15 @@ EOT;
} }
$tabs .= $tab->render($view); $tabs .= $tab->render($view);
} }
return str_replace("{TABS}", $tabs, $this->dropdownTpl); return str_replace('{TABS}', $tabs, $this->dropdownTpl);
} }
/** /**
* Render all tabs, except the ones in dropdown area and return the resulting HTML * Render all tabs, except the ones in dropdown area and return the resulting HTML
* *
* @param Zend_View_Abstract $view The view used for rendering * @param Zend_View_Abstract $view The view used for rendering
* *
* @return string * @return string
*/ */
private function renderTabs(Zend_View_Abstract $view) private function renderTabs(Zend_View_Abstract $view)
{ {
@ -268,6 +269,8 @@ EOT;
} }
/** /**
* Render to HTML
*
* @see Widget::render * @see Widget::render
*/ */
public function render(Zend_View_Abstract $view) public function render(Zend_View_Abstract $view)
@ -277,17 +280,17 @@ EOT;
} }
$html = $this->baseTpl; $html = $this->baseTpl;
$html = str_replace("{TABS}", $this->renderTabs($view), $html); $html = str_replace('{TABS}', $this->renderTabs($view), $html);
$html = str_replace("{DROPDOWN}", $this->renderDropdownTabs($view), $html); $html = str_replace('{DROPDOWN}', $this->renderDropdownTabs($view), $html);
return $html; return $html;
} }
/** /**
* Return the number of tabs * Return the number of tabs
* *
* @see Countable * @return int
* *
* @return int * @see Countable
*/ */
public function count() public function count()
{ {
@ -307,9 +310,9 @@ EOT;
/** /**
* Apply a Tabextension on this tabs object * Apply a Tabextension on this tabs object
* *
* @param Tabextension $tabextension * @param Tabextension $tabextension
* *
* @return self * @return self
*/ */
public function extend(Tabextension $tabextension) public function extend(Tabextension $tabextension)
{ {