// Copyright 2021 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package util import "reflect" // PaginateSlice cut a slice as per pagination options // if page = 0 it do not paginate func PaginateSlice(list interface{}, page, pageSize int) interface{} { if page <= 0 || pageSize <= 0 { return list } if reflect.TypeOf(list).Kind() != reflect.Slice { return list } listValue := reflect.ValueOf(list) page-- if page*pageSize >= listValue.Len() { return listValue.Slice(listValue.Len(), listValue.Len()).Interface() } listValue = listValue.Slice(page*pageSize, listValue.Len()) if listValue.Len() > pageSize { return listValue.Slice(0, pageSize).Interface() } return listValue.Interface() } Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/lib/public/Federation/ICloudId.php
blob: 0985544fee8dc83e93827217da4ee565f7227516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
 * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * 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, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */

namespace OCP\Federation;

/**
 * Parsed federated cloud id
 *
 * @since 12.0.0
 */
interface ICloudId {
	/**
	 * The remote cloud id
	 *
	 * @return string
	 * @since 12.0.0
	 */
	public function getId();

	/**
	 * Get a clean representation of the cloud id for display
	 *
	 * @return string
	 * @since 12.0.0
	 */
	public function getDisplayId();

	/**
	 * The username on the remote server
	 *
	 * @return string
	 * @since 12.0.0
	 */
	public function getUser();

	/**
	 * The base address of the remote server
	 *
	 * @return string
	 * @since 12.0.0
	 */
	public function getRemote();
}