Add missing phpdoc for public API

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-02-09 09:41:04 +01:00 committed by Roeland Jago Douma
parent 4f83462f67
commit 038aad73c7
No known key found for this signature in database
GPG key ID: F941078878347C0C
3 changed files with 75 additions and 11 deletions

View file

@ -6,18 +6,18 @@
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

View file

@ -25,33 +25,67 @@ namespace OCP\AppFramework\Http\Template;
use OCP\AppFramework\Http\TemplateResponse;
/**
* Class PublicTemplateResponse
*
* @package OCP\AppFramework\Http\Template
* @since 14.0.0
*/
class PublicTemplateResponse extends TemplateResponse {
private $headerTitle = '';
private $headerDetails = '';
private $headerActions = [];
/**
* PublicTemplateResponse constructor.
*
* @param string $appName
* @param string $templateName
* @param array $params
* @since 14.0.0
*/
public function __construct(string $appName, string $templateName, array $params = array()) {
parent::__construct($appName, $templateName, $params, 'public');
\OC_Util::addScript('core', 'public/publicpage');
}
/**
* @param string $title
* @since 14.0.0
*/
public function setHeaderTitle(string $title) {
$this->headerTitle = $title;
}
/**
* @return string
* @since 14.0.0
*/
public function getHeaderTitle(): string {
return $this->headerTitle;
}
/**
* @param string $details
* @since 14.0.0
*/
public function setHeaderDetails(string $details) {
$this->headerDetails = $details;
}
/**
* @return string
* @since 14.0.0
*/
public function getHeaderDetails(): string {
return $this->headerDetails;
}
/**
* @param array $actions
* @since 14.0.0
*/
public function setHeaderActions(array $actions) {
foreach ($actions as $action) {
if ($actions instanceof IMenuAction) {
@ -61,10 +95,18 @@ class PublicTemplateResponse extends TemplateResponse {
}
}
/**
* @param IMenuAction $action
* @since 14.0.0
*/
public function addAction(IMenuAction $action) {
$this->headerActions[] = $action;
}
/**
* @return IMenuAction
* @since 14.0.0
*/
public function getPrimaryAction(): IMenuAction {
$lowest = null;
foreach ($this->headerActions as $action) {
@ -75,12 +117,17 @@ class PublicTemplateResponse extends TemplateResponse {
return $lowest;
}
/**
* @return int
* @since 14.0.0
*/
public function getActionCount(): int {
return count($this->headerActions);
}
/**
* @return IMenuAction[]
* @since 14.0.0
*/
public function getOtherActions(): array {
$list = [];
@ -93,7 +140,10 @@ class PublicTemplateResponse extends TemplateResponse {
return $list;
}
/**
* @return string
* @since 14.0.0
*/
public function render() {
$params = array_merge($this->getParams(), [
'template' => $this,

View file

@ -29,6 +29,7 @@ use OCP\Util;
* Class SimpleMenuAction
*
* @package OCP\AppFramework\Http\Template
* @since 14.0.0
*/
class SimpleMenuAction implements IMenuAction {
@ -59,6 +60,7 @@ class SimpleMenuAction implements IMenuAction {
* @param string $link
* @param int $priority
* @param string $detail
* @since 14.0.0
*/
public function __construct(string $id, string $label, string $icon, string $link = '', int $priority = 100, string $detail = '') {
$this->id = $id;
@ -71,6 +73,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @param string $id
* @since 14.0.0
*/
public function setId(string $id) {
$this->id = $id;
@ -78,6 +81,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @param string $label
* @since 14.0.0
*/
public function setLabel(string $label) {
$this->label = $label;
@ -85,6 +89,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @param string $detail
* @since 14.0.0
*/
public function setDetail(string $detail) {
$this->detail = $detail;
@ -92,6 +97,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @param string $icon
* @since 14.0.0
*/
public function setIcon(string $icon) {
$this->icon = $icon;
@ -99,6 +105,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @param string $link
* @since 14.0.0
*/
public function setLink(string $link) {
$this->link = $link;
@ -106,6 +113,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @param int $priority
* @since 14.0.0
*/
public function setPriority(int $priority) {
$this->priority = $priority;
@ -113,6 +121,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @return string
* @since 14.0.0
*/
public function getId(): string {
return $this->id;
@ -120,6 +129,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @return string
* @since 14.0.0
*/
public function getLabel(): string {
return $this->label;
@ -127,6 +137,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @return string
* @since 14.0.0
*/
public function getIcon(): string {
return $this->icon;
@ -134,6 +145,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @return string
* @since 14.0.0
*/
public function getLink(): string {
return $this->link;
@ -141,6 +153,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @return int
* @since 14.0.0
*/
public function getPriority(): int {
return $this->priority;
@ -148,6 +161,7 @@ class SimpleMenuAction implements IMenuAction {
/**
* @return string
* @since 14.0.0
*/
public function render(): string {
$detailContent = ($this->detail !== '') ? '&nbsp;<span class="download-size">(' . Util::sanitizeHTML($this->detail) . ')</span>' : '';