0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-23 08:28:36 +00:00
nextcloud_server/apps/workflowengine/lib/Controller/RequestTimeController.php
provokateurin e64667df37
refactor(workflowengine): Replace security annotations with respective attributes
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-07-27 21:36:15 +02:00

36 lines
882 B
PHP

<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\WorkflowEngine\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\JSONResponse;
class RequestTimeController extends Controller {
/**
* @param string $search
* @return JSONResponse
*/
#[NoAdminRequired]
public function getTimezones($search = '') {
$timezones = \DateTimeZone::listIdentifiers();
if ($search !== '') {
$timezones = array_filter($timezones, function ($timezone) use ($search) {
return stripos($timezone, $search) !== false;
});
}
$timezones = array_slice($timezones, 0, 10);
$response = [];
foreach ($timezones as $timezone) {
$response[$timezone] = $timezone;
}
return new JSONResponse($response);
}
}