2016-10-12 06:08:42 -04:00
|
|
|
<?php
|
2024-11-06 15:31:41 -05:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2016-10-12 06:08:42 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-10-12 06:08:42 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCP\RichObjectStrings;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class Validator
|
|
|
|
|
*
|
2024-11-11 01:27:00 -05:00
|
|
|
* @psalm-type RichObjectParameter = array{
|
|
|
|
|
* type: string,
|
|
|
|
|
* id: string,
|
|
|
|
|
* name: string,
|
|
|
|
|
* server?: string,
|
|
|
|
|
* link?: string,
|
|
|
|
|
* 'call-type'?: 'one2one'|'group'|'public',
|
|
|
|
|
* 'icon-url'?: string,
|
|
|
|
|
* 'message-id'?: string,
|
|
|
|
|
* boardname?: string,
|
|
|
|
|
* stackname?: string,
|
|
|
|
|
* size?: string,
|
|
|
|
|
* path?: string,
|
|
|
|
|
* mimetype?: string,
|
|
|
|
|
* 'preview-available'?: 'yes'|'no',
|
|
|
|
|
* mtime?: string,
|
|
|
|
|
* latitude?: string,
|
|
|
|
|
* longitude?: string,
|
|
|
|
|
* description?: string,
|
|
|
|
|
* thumb?: string,
|
|
|
|
|
* website?: string,
|
|
|
|
|
* visibility?: '0'|'1',
|
|
|
|
|
* assignable?: '0'|'1',
|
|
|
|
|
* conversation?: string,
|
|
|
|
|
* etag?: string,
|
|
|
|
|
* permissions?: string,
|
|
|
|
|
* width?: string,
|
|
|
|
|
* height?: string,
|
2024-11-18 04:40:49 -05:00
|
|
|
* blurhash?: string,
|
2024-11-11 01:27:00 -05:00
|
|
|
* }
|
|
|
|
|
*
|
2016-11-15 12:51:52 -05:00
|
|
|
* @since 11.0.0
|
2016-10-12 06:08:42 -04:00
|
|
|
*/
|
|
|
|
|
interface IValidator {
|
2024-11-06 15:31:41 -05:00
|
|
|
/**
|
2024-11-07 04:36:32 -05:00
|
|
|
* Only alphanumeric, dash, underscore and dot are allowed, starting with a character
|
2024-11-06 15:31:41 -05:00
|
|
|
* @since 31.0.0
|
|
|
|
|
*/
|
|
|
|
|
public const PLACEHOLDER_REGEX = '[A-Za-z][A-Za-z0-9\-_.]+';
|
|
|
|
|
|
2016-10-12 06:08:42 -04:00
|
|
|
/**
|
|
|
|
|
* @param string $subject
|
2024-11-11 01:27:00 -05:00
|
|
|
* @param array<non-empty-string, RichObjectParameter> $parameters
|
2016-10-12 06:08:42 -04:00
|
|
|
* @throws InvalidObjectExeption
|
2016-11-15 12:51:52 -05:00
|
|
|
* @since 11.0.0
|
2016-10-12 06:08:42 -04:00
|
|
|
*/
|
2024-11-06 15:31:41 -05:00
|
|
|
public function validate(string $subject, array $parameters): void;
|
2016-10-12 06:08:42 -04:00
|
|
|
}
|