0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-03 21:40:31 +00:00
nextcloud_server/apps/workflowengine/lib/Controller/RequestTimeController.php
Ferdinand Thiessen 832f79ac93
chore: apply code style
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-04-30 19:04:59 +02:00

37 lines
883 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);
}
}